mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
Update migrations and fix seeding.
This commit is contained in:
parent
7c2105d437
commit
8894fbf98b
8 changed files with 1951 additions and 42 deletions
10
package.json
10
package.json
|
|
@ -5,8 +5,8 @@
|
|||
"scripts": {
|
||||
"db:push": "drizzle-kit push",
|
||||
"db:generate": "drizzle-kit generate",
|
||||
"db:migrate": "tsx src/db/migrate.ts",
|
||||
"db:seed": "tsx src/db/seed.ts",
|
||||
"db:migrate": "tsx src/lib/server/api/infrastructure/database/migrate.ts",
|
||||
"db:seed": "tsx src/lib/server/api/infrastructure/database/seed.ts",
|
||||
"db:studio": "drizzle-kit studio --verbose",
|
||||
"dev": "NODE_OPTIONS=\"--inspect\" vite dev --host",
|
||||
"build": "vite build",
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
"test:ui": "svelte-kit sync && playwright test --ui",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"initialize": "pnpm install && docker compose up --no-recreate -d && pnpm db:migrate",
|
||||
"initialize": "pnpm install && docker compose up --no-recreate -d && pnpm db:migrate && pnpm db:seed",
|
||||
"lint": "prettier --plugin-search-dir . --check . && eslint .",
|
||||
"format": "prettier --plugin-search-dir . --write .",
|
||||
"site:update": "pnpm update -i -L",
|
||||
|
|
@ -63,8 +63,8 @@
|
|||
"svelte-sequential-preprocessor": "^2.0.1",
|
||||
"sveltekit-flash-message": "^2.4.4",
|
||||
"sveltekit-rate-limiter": "^0.5.2",
|
||||
"sveltekit-superforms": "^2.16.1",
|
||||
"tailwindcss": "^3.4.9",
|
||||
"sveltekit-superforms": "^2.17.0",
|
||||
"tailwindcss": "^3.4.10",
|
||||
"ts-node": "^10.9.2",
|
||||
"tslib": "^2.6.3",
|
||||
"tsx": "^4.17.0",
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ importers:
|
|||
version: 4.29.2
|
||||
formsnap:
|
||||
specifier: ^1.0.1
|
||||
version: 1.0.1(svelte@5.0.0-next.175)(sveltekit-superforms@2.16.1(@sveltejs/kit@2.5.22(@sveltejs/vite-plugin-svelte@3.1.1(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175))
|
||||
version: 1.0.1(svelte@5.0.0-next.175)(sveltekit-superforms@2.17.0(@sveltejs/kit@2.5.22(@sveltejs/vite-plugin-svelte@3.1.1(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175))
|
||||
handlebars:
|
||||
specifier: ^4.7.8
|
||||
version: 4.7.8
|
||||
|
|
@ -148,10 +148,10 @@ importers:
|
|||
version: 2.5.2
|
||||
tailwind-variants:
|
||||
specifier: ^0.2.1
|
||||
version: 0.2.1(tailwindcss@3.4.9(ts-node@10.9.2(@types/node@20.14.15)(typescript@5.5.4)))
|
||||
version: 0.2.1(tailwindcss@3.4.10(ts-node@10.9.2(@types/node@20.14.15)(typescript@5.5.4)))
|
||||
tailwindcss-animate:
|
||||
specifier: ^1.0.7
|
||||
version: 1.0.7(tailwindcss@3.4.9(ts-node@10.9.2(@types/node@20.14.15)(typescript@5.5.4)))
|
||||
version: 1.0.7(tailwindcss@3.4.10(ts-node@10.9.2(@types/node@20.14.15)(typescript@5.5.4)))
|
||||
tsyringe:
|
||||
specifier: ^4.8.0
|
||||
version: 4.8.0
|
||||
|
|
@ -280,11 +280,11 @@ importers:
|
|||
specifier: ^0.5.2
|
||||
version: 0.5.2(@sveltejs/kit@2.5.22(@sveltejs/vite-plugin-svelte@3.1.1(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))
|
||||
sveltekit-superforms:
|
||||
specifier: ^2.16.1
|
||||
version: 2.16.1(@sveltejs/kit@2.5.22(@sveltejs/vite-plugin-svelte@3.1.1(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)
|
||||
specifier: ^2.17.0
|
||||
version: 2.17.0(@sveltejs/kit@2.5.22(@sveltejs/vite-plugin-svelte@3.1.1(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)
|
||||
tailwindcss:
|
||||
specifier: ^3.4.9
|
||||
version: 3.4.9(ts-node@10.9.2(@types/node@20.14.15)(typescript@5.5.4))
|
||||
specifier: ^3.4.10
|
||||
version: 3.4.10(ts-node@10.9.2(@types/node@20.14.15)(typescript@5.5.4))
|
||||
ts-node:
|
||||
specifier: ^10.9.2
|
||||
version: 10.9.2(@types/node@20.14.15)(typescript@5.5.4)
|
||||
|
|
@ -1951,8 +1951,8 @@ packages:
|
|||
'@sinclair/typebox@0.27.8':
|
||||
resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==}
|
||||
|
||||
'@sinclair/typebox@0.32.34':
|
||||
resolution: {integrity: sha512-a3Z3ytYl6R/+7ldxx04PO1semkwWlX/8pTqxsPw4quIcIXDFPZhOc1Wx8azWmkU26ccK3mHwcWenn0avNgAKQg==}
|
||||
'@sinclair/typebox@0.32.35':
|
||||
resolution: {integrity: sha512-Ul3YyOTU++to8cgNkttakC0dWvpERr6RYoHO2W47DLbFvrwBDJUY31B1sImH6JZSYc4Kt4PyHtoPNu+vL2r2dA==}
|
||||
|
||||
'@sodaru/yup-to-json-schema@2.0.1':
|
||||
resolution: {integrity: sha512-lWb0Wiz8KZ9ip/dY1eUqt7fhTPmL24p6Hmv5Fd9pzlzAdw/YNcWZr+tiCT4oZ4Zyxzi9+1X4zv82o7jYvcFxYA==}
|
||||
|
|
@ -4524,8 +4524,8 @@ packages:
|
|||
peerDependencies:
|
||||
'@sveltejs/kit': 1.x || 2.x
|
||||
|
||||
sveltekit-superforms@2.16.1:
|
||||
resolution: {integrity: sha512-RNBdN43xge/ADmc3s7+pfdnRGuZ9gZiqpX6VKAQCnCI+ICc5rrPv5idYbx4iuY1Ia0lRMAq1hP0x2oHaPjB+Kg==}
|
||||
sveltekit-superforms@2.17.0:
|
||||
resolution: {integrity: sha512-QrX8pkcmE0XoeVU42zMhsah4FoDrgtPc/4cZEr38rDlgU+DE0xNc5J0E7z1456sUJNbFjaB0+HZwwAkX0vYqaA==}
|
||||
peerDependencies:
|
||||
'@sveltejs/kit': 1.x || 2.x
|
||||
svelte: 3.x || 4.x || >=5.0.0-next.51
|
||||
|
|
@ -4547,8 +4547,8 @@ packages:
|
|||
peerDependencies:
|
||||
tailwindcss: '>=3.0.0 || insiders'
|
||||
|
||||
tailwindcss@3.4.9:
|
||||
resolution: {integrity: sha512-1SEOvRr6sSdV5IDf9iC+NU4dhwdqzF4zKKq3sAbasUWHEM6lsMhX+eNN5gkPx1BvLFEnZQEUFbXnGj8Qlp83Pg==}
|
||||
tailwindcss@3.4.10:
|
||||
resolution: {integrity: sha512-KWZkVPm7yJRhdu4SRSl9d4AK2wM3a50UsvgHZO7xY77NQr2V+fIrEuoDGQcbvswWvFGbS2f6e+jC/6WJm1Dl0w==}
|
||||
engines: {node: '>=14.0.0'}
|
||||
hasBin: true
|
||||
|
||||
|
|
@ -4613,8 +4613,8 @@ packages:
|
|||
peerDependencies:
|
||||
typescript: '>=4.2.0'
|
||||
|
||||
ts-deepmerge@7.0.0:
|
||||
resolution: {integrity: sha512-WZ/iAJrKDhdINv1WG6KZIGHrZDar6VfhftG1QJFpVbOYZMYJLJOvZOo1amictRXVdBXZIgBHKswMTXzElngprA==}
|
||||
ts-deepmerge@7.0.1:
|
||||
resolution: {integrity: sha512-JBFCmNenZdUCc+TRNCtXVM6N8y/nDQHAcpj5BlwXG/gnogjam1NunulB9ia68mnqYI446giMfpqeBFFkOleh+g==}
|
||||
engines: {node: '>=14.13.1'}
|
||||
|
||||
ts-interface-checker@0.1.13:
|
||||
|
|
@ -6142,7 +6142,7 @@ snapshots:
|
|||
|
||||
'@sinclair/typebox@0.27.8': {}
|
||||
|
||||
'@sinclair/typebox@0.32.34':
|
||||
'@sinclair/typebox@0.32.35':
|
||||
optional: true
|
||||
|
||||
'@sodaru/yup-to-json-schema@2.0.1':
|
||||
|
|
@ -7271,11 +7271,11 @@ snapshots:
|
|||
cross-spawn: 7.0.3
|
||||
signal-exit: 4.1.0
|
||||
|
||||
formsnap@1.0.1(svelte@5.0.0-next.175)(sveltekit-superforms@2.16.1(@sveltejs/kit@2.5.22(@sveltejs/vite-plugin-svelte@3.1.1(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)):
|
||||
formsnap@1.0.1(svelte@5.0.0-next.175)(sveltekit-superforms@2.17.0(@sveltejs/kit@2.5.22(@sveltejs/vite-plugin-svelte@3.1.1(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)):
|
||||
dependencies:
|
||||
nanoid: 5.0.7
|
||||
svelte: 5.0.0-next.175
|
||||
sveltekit-superforms: 2.16.1(@sveltejs/kit@2.5.22(@sveltejs/vite-plugin-svelte@3.1.1(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)
|
||||
sveltekit-superforms: 2.17.0(@sveltejs/kit@2.5.22(@sveltejs/vite-plugin-svelte@3.1.1(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)
|
||||
|
||||
forwarded@0.2.0: {}
|
||||
|
||||
|
|
@ -8866,18 +8866,18 @@ snapshots:
|
|||
'@isaacs/ttlcache': 1.4.1
|
||||
'@sveltejs/kit': 2.5.22(@sveltejs/vite-plugin-svelte@3.1.1(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8))
|
||||
|
||||
sveltekit-superforms@2.16.1(@sveltejs/kit@2.5.22(@sveltejs/vite-plugin-svelte@3.1.1(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175):
|
||||
sveltekit-superforms@2.17.0(@sveltejs/kit@2.5.22(@sveltejs/vite-plugin-svelte@3.1.1(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175):
|
||||
dependencies:
|
||||
'@sveltejs/kit': 2.5.22(@sveltejs/vite-plugin-svelte@3.1.1(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8)))(svelte@5.0.0-next.175)(vite@5.4.0(@types/node@20.14.15)(sass@1.77.8))
|
||||
devalue: 5.0.0
|
||||
just-clone: 6.2.0
|
||||
memoize-weak: 1.0.2
|
||||
svelte: 5.0.0-next.175
|
||||
ts-deepmerge: 7.0.0
|
||||
ts-deepmerge: 7.0.1
|
||||
optionalDependencies:
|
||||
'@exodus/schemasafe': 1.3.0
|
||||
'@gcornut/valibot-json-schema': 0.31.0
|
||||
'@sinclair/typebox': 0.32.34
|
||||
'@sinclair/typebox': 0.32.35
|
||||
'@sodaru/yup-to-json-schema': 2.0.1
|
||||
'@vinejs/vine': 1.8.0
|
||||
arktype: 2.0.0-beta.0
|
||||
|
|
@ -8893,16 +8893,16 @@ snapshots:
|
|||
|
||||
tailwind-merge@2.5.2: {}
|
||||
|
||||
tailwind-variants@0.2.1(tailwindcss@3.4.9(ts-node@10.9.2(@types/node@20.14.15)(typescript@5.5.4))):
|
||||
tailwind-variants@0.2.1(tailwindcss@3.4.10(ts-node@10.9.2(@types/node@20.14.15)(typescript@5.5.4))):
|
||||
dependencies:
|
||||
tailwind-merge: 2.5.2
|
||||
tailwindcss: 3.4.9(ts-node@10.9.2(@types/node@20.14.15)(typescript@5.5.4))
|
||||
tailwindcss: 3.4.10(ts-node@10.9.2(@types/node@20.14.15)(typescript@5.5.4))
|
||||
|
||||
tailwindcss-animate@1.0.7(tailwindcss@3.4.9(ts-node@10.9.2(@types/node@20.14.15)(typescript@5.5.4))):
|
||||
tailwindcss-animate@1.0.7(tailwindcss@3.4.10(ts-node@10.9.2(@types/node@20.14.15)(typescript@5.5.4))):
|
||||
dependencies:
|
||||
tailwindcss: 3.4.9(ts-node@10.9.2(@types/node@20.14.15)(typescript@5.5.4))
|
||||
tailwindcss: 3.4.10(ts-node@10.9.2(@types/node@20.14.15)(typescript@5.5.4))
|
||||
|
||||
tailwindcss@3.4.9(ts-node@10.9.2(@types/node@20.14.15)(typescript@5.5.4)):
|
||||
tailwindcss@3.4.10(ts-node@10.9.2(@types/node@20.14.15)(typescript@5.5.4)):
|
||||
dependencies:
|
||||
'@alloc/quick-lru': 5.2.0
|
||||
arg: 5.0.2
|
||||
|
|
@ -8984,7 +8984,7 @@ snapshots:
|
|||
dependencies:
|
||||
typescript: 5.5.4
|
||||
|
||||
ts-deepmerge@7.0.0: {}
|
||||
ts-deepmerge@7.0.1: {}
|
||||
|
||||
ts-interface-checker@0.1.13: {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import * as envs from '$env/static/private';
|
||||
import env from '../../../../env';
|
||||
|
||||
const isPreview = process.env.VERCEL_ENV === 'preview' || process.env.VERCEL_ENV === 'development';
|
||||
|
||||
|
|
@ -11,4 +11,4 @@ if (process.env.NODE_ENV === 'production' || process.env.VERCEL_ENV === 'product
|
|||
domain = 'localhost';
|
||||
}
|
||||
|
||||
export const config = { ...envs, isProduction: process.env.NODE_ENV === 'production' || process.env.VERCEL_ENV === 'production', domain };
|
||||
export const config = { ...env, isProduction: process.env.NODE_ENV === 'production' || process.env.VERCEL_ENV === 'production', domain };
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
CREATE TABLE IF NOT EXISTS "credentials" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
"type" text DEFAULT 'password' NOT NULL,
|
||||
"secret_data" text NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE IF NOT EXISTS "federated_identity" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
"identity_provider" text NOT NULL,
|
||||
"federated_user_id" text NOT NULL,
|
||||
"federated_username" text NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "credentials" ADD CONSTRAINT "credentials_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "federated_identity" ADD CONSTRAINT "federated_identity_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "users" DROP COLUMN IF EXISTS "hashed_password";
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -22,6 +22,13 @@
|
|||
"when": 1720626020902,
|
||||
"tag": "0002_fancy_valkyrie",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 3,
|
||||
"version": "7",
|
||||
"when": 1723593488634,
|
||||
"tag": "0003_worried_taskmaster",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { Table, getTableName, sql } from 'drizzle-orm';
|
||||
import env from '../../../../../env';
|
||||
import { db, pool } from '$db';
|
||||
import { db, pool } from './index';
|
||||
import * as schema from './tables';
|
||||
import * as seeds from './seeds';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { eq } from 'drizzle-orm';
|
||||
import { Argon2id } from 'oslo/password';
|
||||
import { type db } from '$db';
|
||||
import * as schema from '$db/schema';
|
||||
import { type db } from '$lib/server/api/infrastructure/database';
|
||||
import * as schema from '$lib/server/api/infrastructure/database/tables';
|
||||
import users from './data/users.json';
|
||||
import { config } from '../../../common/config';
|
||||
|
||||
|
|
@ -31,7 +31,6 @@ export default async function seed(db: db) {
|
|||
.values({
|
||||
username: `${config.ADMIN_USERNAME}`,
|
||||
email: '',
|
||||
hashed_password: await new Argon2id().hash(`${config.ADMIN_PASSWORD}`),
|
||||
first_name: 'Brad',
|
||||
last_name: 'S',
|
||||
verified: true,
|
||||
|
|
@ -41,6 +40,14 @@ export default async function seed(db: db) {
|
|||
|
||||
console.log('Admin user created.', adminUser);
|
||||
|
||||
await db
|
||||
.insert(schema.credentialsTable)
|
||||
.values({
|
||||
user_id: adminUser[0].id,
|
||||
type: schema.CredentialsType.PASSWORD,
|
||||
secret_data: await new Argon2id().hash(`${config.ADMIN_PASSWORD}`),
|
||||
});
|
||||
|
||||
await db
|
||||
.insert(schema.collections)
|
||||
.values({ user_id: adminUser[0].id })
|
||||
|
|
@ -52,20 +59,22 @@ export default async function seed(db: db) {
|
|||
.onConflictDoNothing();
|
||||
|
||||
await db
|
||||
.insert(schema.userRoles)
|
||||
.insert(schema.user_roles)
|
||||
.values({
|
||||
user_id: adminUser[0].id,
|
||||
role_id: adminRole[0].id,
|
||||
primary: true,
|
||||
})
|
||||
.onConflictDoNothing();
|
||||
|
||||
console.log('Admin user given admin role.');
|
||||
|
||||
await db
|
||||
.insert(schema.userRoles)
|
||||
.insert(schema.user_roles)
|
||||
.values({
|
||||
user_id: adminUser[0].id,
|
||||
role_id: userRole[0].id,
|
||||
primary: false,
|
||||
})
|
||||
.onConflictDoNothing();
|
||||
|
||||
|
|
@ -76,9 +85,13 @@ export default async function seed(db: db) {
|
|||
.insert(schema.usersTable)
|
||||
.values({
|
||||
...user,
|
||||
hashed_password: await new Argon2id().hash(user.password),
|
||||
})
|
||||
.returning();
|
||||
await db.insert(schema.credentialsTable).values({
|
||||
user_id: insertedUser?.id,
|
||||
type: schema.CredentialsType.PASSWORD,
|
||||
secret_data: await new Argon2id().hash(user.password),
|
||||
})
|
||||
await db.insert(schema.collections).values({ user_id: insertedUser?.id });
|
||||
await db.insert(schema.wishlists).values({ user_id: insertedUser?.id });
|
||||
await Promise.all(
|
||||
|
|
@ -86,7 +99,8 @@ export default async function seed(db: db) {
|
|||
const foundRole = await db.query.roles.findFirst({
|
||||
where: eq(schema.roles.name, role.name),
|
||||
});
|
||||
await db.insert(schema.userRoles).values({
|
||||
if (!foundRole) { throw new Error('Role not found'); };
|
||||
await db.insert(schema.user_roles).values({
|
||||
user_id: insertedUser?.id,
|
||||
role_id: foundRole?.id,
|
||||
primary: role?.primary,
|
||||
|
|
|
|||
Loading…
Reference in a new issue