feat(admin): auth 层加 role 字段 + requireAdmin 中间件(查库验角色)

This commit is contained in:
Sisyphus committed 2026-08-22 21:40:54 +08:00
1 parent 079fcd230b
commit 89466d08a8
3 files changed
+45 -1

No files matched your search

+3
View File
@@ -28,6 +28,7 @@ export interface PublicUser {
id: string;
phone: string;
nickname: string | null;
role: string;
createdAt: string;
}
@@ -37,6 +38,7 @@ export interface UserRow {
phone: string;
password_hash: string;
nickname: string | null;
role: string;
created_at: string;
}
@@ -78,6 +80,7 @@ export function toPublicUser(row: UserRow): PublicUser {
id: row.id,
phone: row.phone,
nickname: row.nickname,
role: row.role || "user",
createdAt: row.created_at,
};
}