feat: 重构用户角色系统为管理员标识
- 将用户角色字段从role改为is_admin布尔值 - 更新相关API权限检查逻辑 - 修改数据库schema和迁移文件 - 调整前端用户显示逻辑 - 添加API响应工具函数 - 优化权限检查中间件 - 重构英雄组件为原子组件
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ export const users = sqliteTable('users', {
|
||||
email: text('email').notNull().unique(),
|
||||
passwordHash: text('password_hash'),
|
||||
name: text('name').notNull(),
|
||||
role: text('role', { enum: ['admin', 'editor', 'viewer'] }).notNull().default('editor'),
|
||||
isAdmin: integer('is_admin', { mode: 'boolean' }).notNull().default(false),
|
||||
avatar: text('avatar'),
|
||||
createdAt: integer('created_at', { mode: 'timestamp' }).notNull(),
|
||||
updatedAt: integer('updated_at', { mode: 'timestamp' }).notNull(),
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ async function seed() {
|
||||
email: 'admin@novalon.cn',
|
||||
passwordHash: hashedPassword,
|
||||
name: '系统管理员',
|
||||
role: 'admin',
|
||||
isAdmin: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user