Skip to content

Commit

Permalink
Merge branch 'add-get-current-account-info'
Browse files Browse the repository at this point in the history
  • Loading branch information
giserman001 committed Jul 29, 2024
2 parents 31a6d77 + b99ff28 commit 5be1125
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 181 deletions.
71 changes: 28 additions & 43 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ datasource db {
url = env("DATABASE_URL")
}

// 权限表类型枚举
enum PermissionType {
MENU
BUTTON
}

model User {
id Int @id @default(autoincrement())
username String @unique
Expand All @@ -28,66 +34,45 @@ model User {
}

model Role {
id Int @id @default(autoincrement())
name String @unique @map("role_name")
description String?
user User[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("co_roles")
}

// 角色&菜单中间表
// model RoleRelationMenu {
// roleId Int
// role Role @relation(fields: [roleId], references: [id])
// menuId Int
// menu Menu @relation(fields: [menuId], references: [id])
// createdAt DateTime @default(now())

// @@id([roleId, menuId])
// @@map("co_role_relation_menu")
// }

model Menu {
id Int @id @default(autoincrement())
// 菜单名字
name String @unique @map("menu_name")
order Int?
parentId Int?
icon String
// 组件路径
component String
// 路由
path String
name String @unique @map("role_name")
description String?
user User[]
PermissionRelationRole PermissionRelationRole[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
PermissionRelationMenu PermissionRelationMenu[]
@@map("co_menus")
@@map("co_roles")
}

model Permission {
id Int @id @default(autoincrement())
// 权限名字
name String @unique @map("permission_name")
des String?
name String @unique @map("permission_name") // 权限名字
order Int?
parentId Int?
parent Permission? @relation("parent_children", fields: [parentId], references: [id])
children Permission[] @relation("parent_children")
icon String?
component String? // 组件路径
path String? // 路由
type PermissionType @default(MENU) // 权限类型,菜单或按钮
status Int @default(1) // 状态,1:启用,0:禁用
description String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
PermissionRelationMenu PermissionRelationMenu[]
PermissionRelationRole PermissionRelationRole[]
@@map("co_permissions")
}

// 角色&权限中间表
model PermissionRelationMenu {
model PermissionRelationRole {
permissionId Int
permission Permission @relation(fields: [permissionId], references: [id])
menuId Int
menu Menu @relation(fields: [menuId], references: [id])
roleId Int
role Role @relation(fields: [roleId], references: [id])
createdAt DateTime @default(now())
@@id([permissionId, menuId])
@@map("co_permission_relation_menu")
@@id([permissionId, roleId])
@@map("co_permission_relation_role")
}
35 changes: 0 additions & 35 deletions src/modules/menu/dto/create-menu.dto.ts

This file was deleted.

4 changes: 0 additions & 4 deletions src/modules/menu/dto/update-menu.dto.ts

This file was deleted.

60 changes: 0 additions & 60 deletions src/modules/menu/menu.controller.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/modules/menu/menu.module.ts

This file was deleted.

28 changes: 0 additions & 28 deletions src/modules/menu/menu.service.ts

This file was deleted.

40 changes: 38 additions & 2 deletions src/modules/permission/dto/create-permission.dto.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,50 @@
import { ApiProperty } from 'uni-nest';
import { PermissionType } from '@prisma/client';

export class CreatePermissionDto {
@ApiProperty({
description: '父节点'
})
parentId: number;
@ApiProperty({
description: '权限名',
required: true
})
name: string;

@ApiProperty({
description: '描述',
description: '排序'
})
order: number;

@ApiProperty({
description: '菜单图标'
})
icon: string;

@ApiProperty({
description: '组件路径'
})
component: string;

@ApiProperty({
description: '菜单图标'
})
path: string;

@ApiProperty({
description: '权限类型(MENU BUTTON)',
enum: PermissionType
})
type: number;

@ApiProperty({
description: '权限状态(1:启用 0:禁用)'
})
status: number;

@ApiProperty({
description: '描述'
})
des: string;
description: string;
}

0 comments on commit 5be1125

Please sign in to comment.