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",
|
||||
}
|
||||
})
|
||||
.use(healthRoutes)
|
||||
.use(rateLimit(60, 100))
|
||||
.use(betterAuth)
|
||||
.use(healthRoutes)
|
||||
.use(userRoutes)
|
||||
.get("/", () => ({
|
||||
name: "DeckyVault API",
|
||||
|
||||
+13
-6
@@ -3,6 +3,7 @@ import { auth } from "@/lib/auth"
|
||||
import { db } from "@/lib/db/index"
|
||||
import { user, performanceEntries } from "@/lib/db/schema"
|
||||
import { eq, sql } from "drizzle-orm"
|
||||
|
||||
export const userRoutes = new Elysia({ prefix: "/user" })
|
||||
.get(
|
||||
"/profile/:id",
|
||||
@@ -34,14 +35,12 @@ export const userRoutes = new Elysia({ prefix: "/user" })
|
||||
// Reputation = contributions * 10 (simple formula for now)
|
||||
const reputation = contributions * 10
|
||||
|
||||
const { emailVerified, ...publicProfile } = profile
|
||||
return {
|
||||
...profile,
|
||||
...publicProfile,
|
||||
contributions,
|
||||
reputation,
|
||||
verified: profile.emailVerified,
|
||||
// Hide email from public profiles
|
||||
email: undefined,
|
||||
emailVerified: undefined,
|
||||
verified: emailVerified,
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -63,7 +62,15 @@ export const userRoutes = new Elysia({ prefix: "/user" })
|
||||
}
|
||||
|
||||
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)
|
||||
.where(eq(user.id, session.user.id))
|
||||
.limit(1)
|
||||
|
||||
@@ -5,6 +5,9 @@ type RateLimitEntry = {
|
||||
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>()
|
||||
|
||||
// Clean up expired entries every 60 seconds
|
||||
|
||||
Reference in New Issue
Block a user