refactor: reorganize imports in course route and update middleware for course tags endpoint
This commit is contained in:
@@ -4,6 +4,7 @@ import { and, eq } from 'drizzle-orm';
|
||||
|
||||
import { User } from 'better-auth';
|
||||
import { db } from '@db/drizzle';
|
||||
import { markUserAndProfileEmailVerified } from '@db/queries/auth';
|
||||
|
||||
const DEFAULT_STUDENT_ROLE_ID = 3;
|
||||
|
||||
@@ -60,6 +61,8 @@ export async function ensureOrgMembership(
|
||||
updatedAt: new Date().toISOString()
|
||||
})
|
||||
.where(eq(schema.organizationInvite.id, invite.id));
|
||||
|
||||
await markUserAndProfileEmailVerified(userId, tx);
|
||||
});
|
||||
|
||||
console.debug('User joined org via invite:', orgId);
|
||||
|
||||
@@ -515,6 +515,12 @@ export async function getExerciseWithRelationsOptimized(
|
||||
*/
|
||||
export async function syncOptionIdSequence(dbClient: DbOrTxClient = db): Promise<void> {
|
||||
await dbClient.execute(
|
||||
sql`SELECT setval(pg_get_serial_sequence('option', 'id'), COALESCE((SELECT MAX(id) FROM "option"), 0))`
|
||||
sql`
|
||||
SELECT setval(
|
||||
pg_get_serial_sequence('option', 'id'),
|
||||
COALESCE((SELECT MAX(id) FROM "option"), 1),
|
||||
EXISTS(SELECT 1 FROM "option")
|
||||
)
|
||||
`
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user