-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CPF-410 Certify reporting period and transition to the next one (#421)
* create certifyReportingPeriodAndOpenNextPeriod mutation, make it accessible to admin roles only * modify reportingPeriods scenarios and add tests to verify certifyReportingPeriodAndOpenNextPeriod works as expected * add missing types to scenarios; eslint * code cleanup * throw error when no next period exists, return a descriptive error if possible
- Loading branch information
Showing
4 changed files
with
168 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
import type { Prisma, ReportingPeriod } from '@prisma/client' | ||
import type { | ||
Prisma, | ||
ReportingPeriod, | ||
Organization, | ||
Agency, | ||
User, | ||
} from '@prisma/client' | ||
|
||
import type { ScenarioData } from '@redwoodjs/testing/api' | ||
|
||
export const standard = defineScenario<Prisma.ReportingPeriodCreateArgs>({ | ||
export const standard = defineScenario< | ||
| Prisma.ReportingPeriodCreateArgs | ||
| Prisma.OrganizationCreateArgs | ||
| Prisma.AgencyCreateArgs | ||
| Prisma.UserCreateArgs | ||
>({ | ||
reportingPeriod: { | ||
one: { | ||
data: { | ||
|
@@ -28,8 +39,8 @@ export const standard = defineScenario<Prisma.ReportingPeriodCreateArgs>({ | |
two: { | ||
data: { | ||
name: 'String', | ||
startDate: '2024-01-12T15:48:11.499Z', | ||
endDate: '2024-01-12T15:48:11.499Z', | ||
startDate: '2024-01-14T15:48:11.499Z', | ||
endDate: '2024-01-14T15:48:11.499Z', | ||
inputTemplate: { | ||
create: { | ||
name: 'INPUT TEMPLATE TWO', | ||
|
@@ -47,6 +58,48 @@ export const standard = defineScenario<Prisma.ReportingPeriodCreateArgs>({ | |
}, | ||
}, | ||
}, | ||
organization: { | ||
one: (scenario) => ({ | ||
data: { | ||
name: 'USDR1', | ||
preferences: { | ||
current_reporting_period_id: scenario.reportingPeriod.one.id, | ||
}, | ||
}, | ||
}), | ||
}, | ||
agency: { | ||
one: (scenario) => ({ | ||
data: { | ||
name: 'String', | ||
code: 'String', | ||
organization: { | ||
connect: { | ||
id: scenario.organization.one.id, | ||
}, | ||
}, | ||
}, | ||
}), | ||
}, | ||
user: { | ||
one: (scenario) => ({ | ||
data: { | ||
email: '[email protected]', | ||
name: 'Org Admin', | ||
role: 'ORGANIZATION_ADMIN', | ||
agency: { connect: { id: scenario.agency.one.id } }, | ||
}, | ||
include: { | ||
agency: true, | ||
}, | ||
}), | ||
}, | ||
}) | ||
|
||
export type StandardScenario = ScenarioData<ReportingPeriod, 'reportingPeriod'> | ||
export type StandardScenario = ScenarioData< | ||
ReportingPeriod, | ||
'reportingPeriod' | ||
> & | ||
ScenarioData<Organization, 'organization'> & | ||
ScenarioData<Agency, 'agency'> & | ||
ScenarioData<User, 'user'> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters