fix: switch backend to CommonJS, generate Drizzle migrations, add migrate script
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 4m23s
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 4m23s
- Remove "type": "module" and switch tsconfig to CommonJS/Node resolution to fix drizzle-kit ESM/CJS incompatibility - Strip .js extensions from all backend TypeScript imports - Fix gamification resolver: combine two .where() calls using and() - Fix index.ts: wrap top-level awaits in async main(), fix Fastify+yoga request handling via handleNodeRequestAndResponse - Generate initial Drizzle SQL migration (0000_pale_hellion.sql) for all 15 tables - Add src/scripts/migrate.ts: programmatic Drizzle migrator for production - Copy migrations folder into Docker image (Dockerfile.backend) - Add schema:migrate npm script Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { builder } from "../builder.js";
|
||||
import { LeaderboardEntryType, UserGamificationType, AchievementType } from "../types/index.js";
|
||||
import { user_stats, users, user_achievements, achievements, user_points } from "../../db/schema/index.js";
|
||||
import { eq, desc, gt, count, isNotNull } from "drizzle-orm";
|
||||
import { builder } from "../builder";
|
||||
import { LeaderboardEntryType, UserGamificationType, AchievementType } from "../types/index";
|
||||
import { user_stats, users, user_achievements, achievements, user_points } from "../../db/schema/index";
|
||||
import { eq, desc, gt, count, isNotNull, and } from "drizzle-orm";
|
||||
|
||||
builder.queryField("leaderboard", (t) =>
|
||||
t.field({
|
||||
@@ -73,8 +73,7 @@ builder.queryField("userGamification", (t) =>
|
||||
})
|
||||
.from(user_achievements)
|
||||
.leftJoin(achievements, eq(user_achievements.achievement_id, achievements.id))
|
||||
.where(eq(user_achievements.user_id, args.userId))
|
||||
.where(isNotNull(user_achievements.date_unlocked))
|
||||
.where(and(eq(user_achievements.user_id, args.userId), isNotNull(user_achievements.date_unlocked)))
|
||||
.orderBy(desc(user_achievements.date_unlocked));
|
||||
|
||||
const recentPoints = await ctx.db
|
||||
|
||||
Reference in New Issue
Block a user