refactor: change the role to roles and many to many

This commit is contained in:
mahyargdz
2025-02-16 16:58:51 +03:30
parent 9cdd7ef28e
commit ad673613d9
32 changed files with 264 additions and 88 deletions
@@ -0,0 +1,14 @@
import { Column, Entity, ManyToMany } from "typeorm";
import { Role } from "./role.entity";
import { BaseEntity } from "../../../common/entities/base.entity";
import { PermissionEnum } from "../enums/permission.enum";
@Entity()
export class Permission extends BaseEntity {
@Column({ type: "enum", enum: PermissionEnum, nullable: false, unique: true })
name: PermissionEnum;
@ManyToMany(() => Role, (role) => role.permissions)
roles: Role[];
}