Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dashboard page (Uploads table), create a reusable TableBuilder #51

Merged
merged 15 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/src/services/agencies/agencies.scenarios.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Prisma, agency } from '@prisma/client'

import type { ScenarioData } from '@redwoodjs/testing/api'

export const standard = defineScenario<Prisma.agencyCreateArgs>({
Expand Down
25 changes: 12 additions & 13 deletions api/src/services/agencies/agencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,16 @@ export const deleteAgency: MutationResolvers['deleteAgency'] = ({ id }) => {
})
}

export const agenciesByOrganization: QueryResolvers['agenciesByOrganization'] = async ({
organizationId,
}) => {
try {
const agencies = await db.agency.findMany({
where: { organizationId },
})
return agencies || [] // Return an empty array if null is received
} catch (error) {
console.error(error)
// Handle the error appropriately; maybe log it and return an empty array
return []
export const agenciesByOrganization: QueryResolvers['agenciesByOrganization'] =
async ({ organizationId }) => {
try {
const agencies = await db.agency.findMany({
where: { organizationId },
})
return agencies || [] // Return an empty array if null is received
} catch (error) {
console.error(error)
// Handle the error appropriately; maybe log it and return an empty array
return []
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Prisma, ExpenditureCategory } from '@prisma/client'

import type { ScenarioData } from '@redwoodjs/testing/api'

export const standard = defineScenario<Prisma.ExpenditureCategoryCreateArgs>({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Prisma, InputTemplate } from '@prisma/client'

import type { ScenarioData } from '@redwoodjs/testing/api'

export const standard = defineScenario<Prisma.InputTemplateCreateArgs>({
Expand Down
1 change: 1 addition & 0 deletions api/src/services/organizations/organizations.scenarios.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Prisma, Organization } from '@prisma/client'

import type { ScenarioData } from '@redwoodjs/testing/api'

export const standard = defineScenario<Prisma.OrganizationCreateArgs>({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Prisma, OutputTemplate } from '@prisma/client'

import type { ScenarioData } from '@redwoodjs/testing/api'

export const standard = defineScenario<Prisma.OutputTemplateCreateArgs>({
Expand Down
1 change: 1 addition & 0 deletions api/src/services/projects/projects.scenarios.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Prisma, Project } from '@prisma/client'

import type { ScenarioData } from '@redwoodjs/testing/api'

export const standard = defineScenario<Prisma.ProjectCreateArgs>({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Prisma, ReportingPeriod } from '@prisma/client'

import type { ScenarioData } from '@redwoodjs/testing/api'

export const standard = defineScenario<Prisma.ReportingPeriodCreateArgs>({
Expand Down
1 change: 1 addition & 0 deletions api/src/services/roles/roles.scenarios.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Prisma, Role } from '@prisma/client'

import type { ScenarioData } from '@redwoodjs/testing/api'

export const standard = defineScenario<Prisma.RoleCreateArgs>({
Expand Down
83 changes: 0 additions & 83 deletions api/src/services/uploadValidations/uploadValidations.test.ts

This file was deleted.

40 changes: 20 additions & 20 deletions api/src/services/uploads/uploads.scenarios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ export const standard = defineScenario<Prisma.UploadCreateArgs>({
one: {
data: {
filename: 'String',
updatedAt: '2023-12-08T21:03:09.638Z',
updatedAt: '2023-12-10T04:48:04.896Z',
uploadedBy: {
create: {
email: 'String',
updatedAt: '2023-12-08T21:03:09.638Z',
updatedAt: '2023-12-10T04:48:04.896Z',
organization: { create: { name: 'String' } },
},
},
Expand All @@ -20,23 +20,23 @@ export const standard = defineScenario<Prisma.UploadCreateArgs>({
reportingPeriod: {
create: {
name: 'String',
startDate: '2023-12-08T21:03:09.638Z',
endDate: '2023-12-08T21:03:09.638Z',
updatedAt: '2023-12-08T21:03:09.638Z',
startDate: '2023-12-10T04:48:04.896Z',
endDate: '2023-12-10T04:48:04.896Z',
updatedAt: '2023-12-10T04:48:04.896Z',
inputTemplate: {
create: {
name: 'String',
version: 'String',
effectiveDate: '2023-12-08T21:03:09.638Z',
updatedAt: '2023-12-08T21:03:09.638Z',
effectiveDate: '2023-12-10T04:48:04.896Z',
updatedAt: '2023-12-10T04:48:04.896Z',
},
},
outputTemplate: {
create: {
name: 'String',
version: 'String',
effectiveDate: '2023-12-08T21:03:09.638Z',
updatedAt: '2023-12-08T21:03:09.638Z',
effectiveDate: '2023-12-10T04:48:04.896Z',
updatedAt: '2023-12-10T04:48:04.896Z',
},
},
},
Expand All @@ -45,19 +45,19 @@ export const standard = defineScenario<Prisma.UploadCreateArgs>({
create: {
name: 'String',
code: 'String',
updatedAt: '2023-12-08T21:03:09.638Z',
updatedAt: '2023-12-10T04:48:04.896Z',
},
},
},
},
two: {
data: {
filename: 'String',
updatedAt: '2023-12-08T21:03:09.638Z',
updatedAt: '2023-12-10T04:48:04.896Z',
uploadedBy: {
create: {
email: 'String',
updatedAt: '2023-12-08T21:03:09.638Z',
updatedAt: '2023-12-10T04:48:04.896Z',
organization: { create: { name: 'String' } },
},
},
Expand All @@ -66,23 +66,23 @@ export const standard = defineScenario<Prisma.UploadCreateArgs>({
reportingPeriod: {
create: {
name: 'String',
startDate: '2023-12-08T21:03:09.638Z',
endDate: '2023-12-08T21:03:09.638Z',
updatedAt: '2023-12-08T21:03:09.638Z',
startDate: '2023-12-10T04:48:04.896Z',
endDate: '2023-12-10T04:48:04.896Z',
updatedAt: '2023-12-10T04:48:04.896Z',
inputTemplate: {
create: {
name: 'String',
version: 'String',
effectiveDate: '2023-12-08T21:03:09.638Z',
updatedAt: '2023-12-08T21:03:09.638Z',
effectiveDate: '2023-12-10T04:48:04.896Z',
updatedAt: '2023-12-10T04:48:04.896Z',
},
},
outputTemplate: {
create: {
name: 'String',
version: 'String',
effectiveDate: '2023-12-08T21:03:09.639Z',
updatedAt: '2023-12-08T21:03:09.639Z',
effectiveDate: '2023-12-10T04:48:04.896Z',
updatedAt: '2023-12-10T04:48:04.896Z',
},
},
},
Expand All @@ -91,7 +91,7 @@ export const standard = defineScenario<Prisma.UploadCreateArgs>({
create: {
name: 'String',
code: 'String',
updatedAt: '2023-12-08T21:03:09.639Z',
updatedAt: '2023-12-10T04:48:04.896Z',
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions api/src/services/uploads/uploads.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('uploads', () => {
organizationId: scenario.upload.two.organizationId,
reportingPeriodId: scenario.upload.two.reportingPeriodId,
expenditureCategoryId: scenario.upload.two.expenditureCategoryId,
updatedAt: '2023-12-08T21:03:09.551Z',
updatedAt: '2023-12-10T04:48:04.888Z',
},
})

Expand All @@ -51,7 +51,7 @@ describe('uploads', () => {
expect(result.expenditureCategoryId).toEqual(
scenario.upload.two.expenditureCategoryId
)
expect(result.updatedAt).toEqual(new Date('2023-12-08T21:03:09.551Z'))
expect(result.updatedAt).toEqual(new Date('2023-12-10T04:48:04.888Z'))
})

scenario('updates a upload', async (scenario: StandardScenario) => {
Expand Down
1 change: 1 addition & 0 deletions api/src/services/users/users.scenarios.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Prisma, User } from '@prisma/client'

import type { ScenarioData } from '@redwoodjs/testing/api'

export const standard = defineScenario<Prisma.UserCreateArgs>({
Expand Down
Loading
Loading