feat(classes): optimize teacher dashboard ui and implement grade management

This commit is contained in:
SpecialX
2026-01-14 13:59:11 +08:00
parent ade8d4346c
commit 9bfc621d3f
104 changed files with 12793 additions and 2309 deletions

View File

@@ -0,0 +1,45 @@
import "server-only"
import { cache } from "react"
import { eq } from "drizzle-orm"
import { db } from "@/shared/db"
import { users } from "@/shared/db/schema"
export type UserProfile = {
id: string
name: string | null
email: string
image: string | null
role: string | null
phone: string | null
address: string | null
gender: string | null
age: number | null
onboardedAt: Date | null
createdAt: Date
updatedAt: Date
}
export const getUserProfile = cache(async (userId: string): Promise<UserProfile | null> => {
const user = await db.query.users.findFirst({
where: eq(users.id, userId),
})
if (!user) return null
return {
id: user.id,
name: user.name,
email: user.email,
image: user.image,
role: user.role,
phone: user.phone,
address: user.address,
gender: user.gender,
age: user.age,
onboardedAt: user.onboardedAt,
createdAt: user.createdAt,
updatedAt: user.updatedAt,
}
})