Loading apps/api/prisma/dev.db-journal (20.5 KiB) File changed.No diff preview for this file type. View original file View changed file apps/api/prisma/migrations/20250223112139_/migration.sql 0 → 100644 +25 −0 Original line number Diff line number Diff line -- RedefineTables PRAGMA defer_foreign_keys=ON; PRAGMA foreign_keys=OFF; CREATE TABLE "new_GitAccount" ( "id" TEXT NOT NULL PRIMARY KEY, "displayName" TEXT NOT NULL, "username" TEXT NOT NULL, "profileUrl" TEXT NOT NULL, "photos" TEXT NOT NULL, "email" TEXT NOT NULL, "accessToken" TEXT NOT NULL, "provider" TEXT NOT NULL, "accountId" TEXT NOT NULL, "userId" TEXT NOT NULL, "signIn" BOOLEAN NOT NULL DEFAULT false, CONSTRAINT "GitAccount_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE ); INSERT INTO "new_GitAccount" ("accessToken", "accountId", "displayName", "email", "id", "photos", "profileUrl", "provider", "signIn", "userId", "username") SELECT "accessToken", "accountId", "displayName", "email", "id", "photos", "profileUrl", "provider", "signIn", "userId", "username" FROM "GitAccount"; DROP TABLE "GitAccount"; ALTER TABLE "new_GitAccount" RENAME TO "GitAccount"; CREATE UNIQUE INDEX "GitAccount_provider_key" ON "GitAccount"("provider"); CREATE UNIQUE INDEX "GitAccount_accountId_key" ON "GitAccount"("accountId"); CREATE UNIQUE INDEX "GitAccount_userId_key" ON "GitAccount"("userId"); PRAGMA foreign_keys=ON; PRAGMA defer_foreign_keys=OFF; apps/api/prisma/schema.prisma +1 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ model GitAccount { accessToken String provider String @unique accountId String @unique userId String userId String @unique signIn Boolean @default(false) user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade) } No newline at end of file apps/api/src/auth/auth-git.service.ts +2 −2 Original line number Diff line number Diff line Loading @@ -20,8 +20,8 @@ export class AuthGitService { userId: string | undefined = undefined, ): Promise<PayloadType> { if (userId == undefined) { const account = await this.prismaService.gitAccount.findFirst({ where: { accountId: user.profile.id }, const account = await this.prismaService.gitAccount.findUnique({ where: { accountId: user.profile.id, signIn: true }, }); if (account && account.signIn) { return await this.authTokenService.getSignToken(account.userId); Loading Loading
apps/api/prisma/dev.db-journal (20.5 KiB) File changed.No diff preview for this file type. View original file View changed file
apps/api/prisma/migrations/20250223112139_/migration.sql 0 → 100644 +25 −0 Original line number Diff line number Diff line -- RedefineTables PRAGMA defer_foreign_keys=ON; PRAGMA foreign_keys=OFF; CREATE TABLE "new_GitAccount" ( "id" TEXT NOT NULL PRIMARY KEY, "displayName" TEXT NOT NULL, "username" TEXT NOT NULL, "profileUrl" TEXT NOT NULL, "photos" TEXT NOT NULL, "email" TEXT NOT NULL, "accessToken" TEXT NOT NULL, "provider" TEXT NOT NULL, "accountId" TEXT NOT NULL, "userId" TEXT NOT NULL, "signIn" BOOLEAN NOT NULL DEFAULT false, CONSTRAINT "GitAccount_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE ); INSERT INTO "new_GitAccount" ("accessToken", "accountId", "displayName", "email", "id", "photos", "profileUrl", "provider", "signIn", "userId", "username") SELECT "accessToken", "accountId", "displayName", "email", "id", "photos", "profileUrl", "provider", "signIn", "userId", "username" FROM "GitAccount"; DROP TABLE "GitAccount"; ALTER TABLE "new_GitAccount" RENAME TO "GitAccount"; CREATE UNIQUE INDEX "GitAccount_provider_key" ON "GitAccount"("provider"); CREATE UNIQUE INDEX "GitAccount_accountId_key" ON "GitAccount"("accountId"); CREATE UNIQUE INDEX "GitAccount_userId_key" ON "GitAccount"("userId"); PRAGMA foreign_keys=ON; PRAGMA defer_foreign_keys=OFF;
apps/api/prisma/schema.prisma +1 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ model GitAccount { accessToken String provider String @unique accountId String @unique userId String userId String @unique signIn Boolean @default(false) user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade) } No newline at end of file
apps/api/src/auth/auth-git.service.ts +2 −2 Original line number Diff line number Diff line Loading @@ -20,8 +20,8 @@ export class AuthGitService { userId: string | undefined = undefined, ): Promise<PayloadType> { if (userId == undefined) { const account = await this.prismaService.gitAccount.findFirst({ where: { accountId: user.profile.id }, const account = await this.prismaService.gitAccount.findUnique({ where: { accountId: user.profile.id, signIn: true }, }); if (account && account.signIn) { return await this.authTokenService.getSignToken(account.userId); Loading