feat(admin): auth 层加 role 字段 + requireAdmin 中间件(查库验角色)
This commit is contained in:
1 parent
079fcd230b
commit
89466d08a8
3 files changed
+45
-1
No files matched your search
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user