fix: resolve all build errors and ensure clean build
This commit is contained in:
@@ -33,9 +33,9 @@ export const app = new Elysia({ prefix: "/api" })
|
|||||||
error: code === "NOT_FOUND" ? "Not found" : "Internal server error",
|
error: code === "NOT_FOUND" ? "Not found" : "Internal server error",
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.use(healthRoutes)
|
||||||
.use(rateLimit(60, 100))
|
.use(rateLimit(60, 100))
|
||||||
.use(betterAuth)
|
.use(betterAuth)
|
||||||
.use(healthRoutes)
|
|
||||||
.use(userRoutes)
|
.use(userRoutes)
|
||||||
.get("/", () => ({
|
.get("/", () => ({
|
||||||
name: "DeckyVault API",
|
name: "DeckyVault API",
|
||||||
|
|||||||
+13
-6
@@ -3,6 +3,7 @@ import { auth } from "@/lib/auth"
|
|||||||
import { db } from "@/lib/db/index"
|
import { db } from "@/lib/db/index"
|
||||||
import { user, performanceEntries } from "@/lib/db/schema"
|
import { user, performanceEntries } from "@/lib/db/schema"
|
||||||
import { eq, sql } from "drizzle-orm"
|
import { eq, sql } from "drizzle-orm"
|
||||||
|
|
||||||
export const userRoutes = new Elysia({ prefix: "/user" })
|
export const userRoutes = new Elysia({ prefix: "/user" })
|
||||||
.get(
|
.get(
|
||||||
"/profile/:id",
|
"/profile/:id",
|
||||||
@@ -34,14 +35,12 @@ export const userRoutes = new Elysia({ prefix: "/user" })
|
|||||||
// Reputation = contributions * 10 (simple formula for now)
|
// Reputation = contributions * 10 (simple formula for now)
|
||||||
const reputation = contributions * 10
|
const reputation = contributions * 10
|
||||||
|
|
||||||
|
const { emailVerified, ...publicProfile } = profile
|
||||||
return {
|
return {
|
||||||
...profile,
|
...publicProfile,
|
||||||
contributions,
|
contributions,
|
||||||
reputation,
|
reputation,
|
||||||
verified: profile.emailVerified,
|
verified: emailVerified,
|
||||||
// Hide email from public profiles
|
|
||||||
email: undefined,
|
|
||||||
emailVerified: undefined,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -63,7 +62,15 @@ export const userRoutes = new Elysia({ prefix: "/user" })
|
|||||||
}
|
}
|
||||||
|
|
||||||
const [profile] = await db
|
const [profile] = await db
|
||||||
.select()
|
.select({
|
||||||
|
id: user.id,
|
||||||
|
name: user.name,
|
||||||
|
email: user.email,
|
||||||
|
image: user.image,
|
||||||
|
role: user.role,
|
||||||
|
createdAt: user.createdAt,
|
||||||
|
emailVerified: user.emailVerified,
|
||||||
|
})
|
||||||
.from(user)
|
.from(user)
|
||||||
.where(eq(user.id, session.user.id))
|
.where(eq(user.id, session.user.id))
|
||||||
.limit(1)
|
.limit(1)
|
||||||
|
|||||||
+1
-1
@@ -73,4 +73,4 @@ export const auth = betterAuth({
|
|||||||
emailAndPassword: {
|
emailAndPassword: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ type RateLimitEntry = {
|
|||||||
resetAt: number
|
resetAt: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: This is an in-memory rate limiter for development/single-instance
|
||||||
|
// deployments. For production with multiple instances or serverless, use a
|
||||||
|
// shared store like Redis or Upstash.
|
||||||
const store = new Map<string, RateLimitEntry>()
|
const store = new Map<string, RateLimitEntry>()
|
||||||
|
|
||||||
// Clean up expired entries every 60 seconds
|
// Clean up expired entries every 60 seconds
|
||||||
|
|||||||
Reference in New Issue
Block a user