-
Notifications
You must be signed in to change notification settings - Fork 513
Add onboarding status to Project model and implement related database… #1246
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
bc87ba6
Add onboarding status to Project model and implement related database…
Developing-Gamer 5b006eb
Merge branch 'dev' into codex/add-multistep-onboarding-flow
Developing-Gamer 6657a2f
Refactor Project Onboarding Wizard: Remove domain setup step and upda…
Developing-Gamer b804a27
Add Error Capture for Link Existing Mode in Project Onboarding
Developing-Gamer eaa31a0
Merge branch 'dev' into codex/add-multistep-onboarding-flow
Developing-Gamer 3fe3649
Enhance Project Onboarding Status Handling and Validation
Developing-Gamer dbb3e7a
Refactor Project Onboarding Logic and Enhance Sign-In Method Handling
Developing-Gamer ab53a32
Merge branch 'dev' into codex/add-multistep-onboarding-flow
Developing-Gamer 2f62bcf
Fixed Tests
Developing-Gamer 4d7036d
Implement conditional handling for onboardingStatus in createOrUpdate…
Developing-Gamer 2cdc10a
Merge branch 'dev' into codex/add-multistep-onboarding-flow
Developing-Gamer b0c0111
Merge branch 'dev' into codex/add-multistep-onboarding-flow
Developing-Gamer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
apps/backend/prisma/migrations/20260312000000_add_project_onboarding_status/migration.sql
This file contains hidden or 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,16 @@ | ||
| ALTER TABLE "Project" | ||
| ADD COLUMN "onboardingStatus" TEXT NOT NULL DEFAULT 'completed'; | ||
|
|
||
| ALTER TABLE "Project" | ||
| ADD CONSTRAINT "Project_onboardingStatus_valid" | ||
| CHECK ( | ||
| "onboardingStatus" IN ( | ||
| 'config_choice', | ||
| 'apps_selection', | ||
| 'auth_setup', | ||
| 'domain_setup', | ||
| 'email_theme_setup', | ||
| 'payments_setup', | ||
| 'completed' | ||
| ) | ||
| ) NOT VALID; |
56 changes: 56 additions & 0 deletions
56
...a/migrations/20260312000000_add_project_onboarding_status/tests/default-and-constraint.ts
This file contains hidden or 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,56 @@ | ||
| import { randomUUID } from "crypto"; | ||
| import type { Sql } from "postgres"; | ||
| import { expect } from "vitest"; | ||
|
|
||
| export const preMigration = async (sql: Sql) => { | ||
| const projectId = `test-${randomUUID()}`; | ||
| await sql` | ||
| INSERT INTO "Project" ("id", "createdAt", "updatedAt", "displayName", "description", "isProductionMode") | ||
| VALUES (${projectId}, NOW(), NOW(), 'Onboarding Test', '', false) | ||
| `; | ||
| return { projectId }; | ||
| }; | ||
|
|
||
| export const postMigration = async (sql: Sql, ctx: Awaited<ReturnType<typeof preMigration>>) => { | ||
| const rows = await sql` | ||
| SELECT "onboardingStatus" | ||
| FROM "Project" | ||
| WHERE "id" = ${ctx.projectId} | ||
| `; | ||
| expect(rows).toHaveLength(1); | ||
| expect(rows[0].onboardingStatus).toBe("completed"); | ||
|
|
||
| const validProjectId = `test-${randomUUID()}`; | ||
| await sql` | ||
| INSERT INTO "Project" ( | ||
| "id", | ||
| "createdAt", | ||
| "updatedAt", | ||
| "displayName", | ||
| "description", | ||
| "isProductionMode", | ||
| "onboardingStatus" | ||
| ) | ||
| VALUES (${validProjectId}, NOW(), NOW(), 'Valid Status Project', '', false, 'auth_setup') | ||
| `; | ||
|
|
||
| const invalidProjectId = `test-${randomUUID()}`; | ||
| await expect(sql` | ||
| INSERT INTO "Project" ( | ||
| "id", | ||
| "createdAt", | ||
| "updatedAt", | ||
| "displayName", | ||
| "description", | ||
| "isProductionMode", | ||
| "onboardingStatus" | ||
| ) | ||
| VALUES (${invalidProjectId}, NOW(), NOW(), 'Invalid Status Project', '', false, 'invalid_status') | ||
| `).rejects.toThrow(/Project_onboardingStatus_valid/); | ||
|
|
||
| await expect(sql` | ||
| UPDATE "Project" | ||
| SET "onboardingStatus" = 'invalid_status' | ||
| WHERE "id" = ${ctx.projectId} | ||
| `).rejects.toThrow(/Project_onboardingStatus_valid/); | ||
| }; | ||
2 changes: 2 additions & 0 deletions
2
...sma/migrations/20260312000001_validate_project_onboarding_status_constraint/migration.sql
This file contains hidden or 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,2 @@ | ||
| ALTER TABLE "Project" | ||
| VALIDATE CONSTRAINT "Project_onboardingStatus_valid"; |
13 changes: 13 additions & 0 deletions
13
...0312000001_validate_project_onboarding_status_constraint/tests/constraint-is-validated.ts
This file contains hidden or 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,13 @@ | ||
| import type { Sql } from "postgres"; | ||
| import { expect } from "vitest"; | ||
|
|
||
| export const postMigration = async (sql: Sql) => { | ||
| const rows = await sql` | ||
| SELECT "convalidated" | ||
| FROM "pg_constraint" | ||
| WHERE "conname" = 'Project_onboardingStatus_valid' | ||
| `; | ||
|
|
||
| expect(rows).toHaveLength(1); | ||
| expect(rows[0].convalidated).toBe(true); | ||
| }; |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.