-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into as/add-local-auth-module
- Loading branch information
Showing
18 changed files
with
99 additions
and
86 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
43 changes: 43 additions & 0 deletions
43
...db/migrations/20240214193745_remove_user_validation_subrecipients_relations/migration.sql
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `certifiedById` on the `Subrecipient` table. All the data in the column will be lost. | ||
- You are about to drop the column `invalidatedById` on the `UploadValidation` table. All the data in the column will be lost. | ||
- You are about to drop the column `validatedById` on the `UploadValidation` table. All the data in the column will be lost. | ||
- You are about to drop the column `organizationId` on the `User` table. All the data in the column will be lost. | ||
- Made the column `name` on table `User` required. This step will fail if there are existing NULL values in that column. | ||
- Made the column `agencyId` on table `User` required. This step will fail if there are existing NULL values in that column. | ||
- Made the column `role` on table `User` required. This step will fail if there are existing NULL values in that column. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "Subrecipient" DROP CONSTRAINT "Subrecipient_certifiedById_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "UploadValidation" DROP CONSTRAINT "UploadValidation_invalidatedById_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "UploadValidation" DROP CONSTRAINT "UploadValidation_validatedById_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "User" DROP CONSTRAINT "User_agencyId_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "User" DROP CONSTRAINT "User_organizationId_fkey"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "Subrecipient" DROP COLUMN "certifiedById"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "UploadValidation" DROP COLUMN "invalidatedById", | ||
DROP COLUMN "validatedById"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "User" DROP COLUMN "organizationId", | ||
ADD COLUMN "isActive" BOOLEAN NOT NULL DEFAULT true, | ||
ALTER COLUMN "name" SET NOT NULL, | ||
ALTER COLUMN "agencyId" SET NOT NULL, | ||
ALTER COLUMN "role" SET NOT NULL; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "User" ADD CONSTRAINT "User_agencyId_fkey" FOREIGN KEY ("agencyId") REFERENCES "Agency"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
8 changes: 8 additions & 0 deletions
8
api/db/migrations/20240216211114_make_user_email_unique/migration.sql
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
Warnings: | ||
- A unique constraint covering the columns `[email]` on the table `User` will be added. If there are existing duplicate values, this will fail. | ||
*/ | ||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); |
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
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 |
---|---|---|
|
@@ -17,9 +17,11 @@ export const standard = defineScenario<Prisma.SubrecipientCreateArgs>({ | |
updatedAt: '2023-12-09T14:50:18.317Z', | ||
uploadedBy: { | ||
create: { | ||
email: 'String', | ||
name: 'String', | ||
email: '[email protected]', | ||
updatedAt: '2023-12-09T14:50:18.317Z', | ||
organization: { create: { name: 'String' } }, | ||
agency: { create: { name: 'String', code: 'String' } }, | ||
role: 'USDR_ADMIN', | ||
}, | ||
}, | ||
agency: { create: { name: 'String', code: 'String' } }, | ||
|
@@ -73,9 +75,11 @@ export const standard = defineScenario<Prisma.SubrecipientCreateArgs>({ | |
updatedAt: '2023-12-09T14:50:18.317Z', | ||
uploadedBy: { | ||
create: { | ||
email: 'String', | ||
name: 'String', | ||
email: '[email protected]', | ||
updatedAt: '2023-12-09T14:50:18.317Z', | ||
organization: { create: { name: 'String' } }, | ||
agency: { create: { name: 'String', code: 'String' } }, | ||
role: 'USDR_ADMIN', | ||
}, | ||
}, | ||
agency: { create: { name: 'String', code: 'String' } }, | ||
|
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 |
---|---|---|
|
@@ -7,7 +7,14 @@ export const standard = defineScenario<Prisma.UploadCreateArgs>({ | |
one: { | ||
data: { | ||
filename: 'String', | ||
uploadedBy: { create: { email: 'String' } }, | ||
uploadedBy: { | ||
create: { | ||
email: '[email protected]', | ||
name: 'String', | ||
role: 'USDR_ADMIN', | ||
agency: { create: { name: 'String', code: 'String' } }, | ||
}, | ||
}, | ||
agency: { create: { name: 'String', code: 'String' } }, | ||
organization: { create: { name: 'String' } }, | ||
reportingPeriod: { | ||
|
@@ -37,7 +44,14 @@ export const standard = defineScenario<Prisma.UploadCreateArgs>({ | |
two: { | ||
data: { | ||
filename: 'String', | ||
uploadedBy: { create: { email: 'String' } }, | ||
uploadedBy: { | ||
create: { | ||
email: '[email protected]', | ||
name: 'String', | ||
role: 'USDR_ADMIN', | ||
agency: { create: { name: 'String', code: 'String' } }, | ||
}, | ||
}, | ||
agency: { create: { name: 'String', code: 'String' } }, | ||
organization: { create: { name: 'String' } }, | ||
reportingPeriod: { | ||
|
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 |
---|---|---|
|
@@ -26,9 +26,8 @@ export const standard = defineScenario< | |
user: { | ||
one: { | ||
data: { | ||
email: 'String', | ||
email: '[email protected]', | ||
name: 'String', | ||
organization: { create: { name: 'String' } }, | ||
agency: { create: { name: 'String', code: 'String' } }, | ||
role: 'ORGANIZATION_ADMIN', | ||
}, | ||
|
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 |
---|---|---|
|
@@ -25,22 +25,20 @@ describe('users', () => { | |
scenario('creates a user', async (scenario: StandardScenario) => { | ||
mockCurrentUser({ | ||
id: scenario.user.one.id, | ||
organizationId: scenario.user.one.organizationId, | ||
email: '[email protected]', | ||
email: scenario.user.one.email, | ||
roles: ['USDR_ADMIN'], | ||
}) | ||
|
||
const result = await createUser({ | ||
input: { | ||
name: scenario.user.one.name, | ||
email: scenario.user.one.email, | ||
email: '[email protected]', | ||
name: 'String', | ||
agencyId: scenario.agency.one.id, | ||
role: 'ORGANIZATION_STAFF', | ||
role: 'USDR_ADMIN', | ||
}, | ||
}) | ||
|
||
expect(result.email).toEqual(scenario.user.one.email) | ||
expect(result.organizationId).toEqual(scenario.organization.one.id) | ||
expect(result.email).toEqual('[email protected]') | ||
}) | ||
|
||
scenario('updates a user', async (scenario: StandardScenario) => { | ||
|
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
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
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 |
---|---|---|
|
@@ -11,7 +11,6 @@ export const QUERY = gql` | |
name | ||
agencyId | ||
organizationId | ||
role | ||
createdAt | ||
updatedAt | ||
|
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 |
---|---|---|
|
@@ -14,7 +14,6 @@ export const QUERY = gql` | |
agency { | ||
name | ||
} | ||
organizationId | ||
role | ||
createdAt | ||
updatedAt | ||
|
Oops, something went wrong.