update entity id

This commit is contained in:
2026-02-05 10:08:37 +03:30
parent d4ae03fa4f
commit 068286e505
37 changed files with 185 additions and 209 deletions
+2 -11
View File
@@ -1,16 +1,13 @@
import { Collection, Entity, ManyToMany, OneToMany, OptionalProps, PrimaryKey, Property } from '@mikro-orm/core';
import { Permission } from './permission.entity';
import { RolePermission } from './rolePermission.entity';
import { ulid } from 'ulid';
import { Admin } from 'src/modules/admin/entities/admin.entity';
import { BaseEntity } from 'src/common/entities/base.entity';
@Entity({ tableName: 'roles' })
export class Role {
export class Role extends BaseEntity {
[OptionalProps]?: 'createdAt' | 'deletedAt' | 'admins';
@PrimaryKey({ type: 'string', columnType: 'char(26)' })
id: string = ulid()
@Property({ unique: true })
name: string;
@@ -26,10 +23,4 @@ export class Role {
@OneToMany(() => Admin, (admin) => admin.role)
admins: Admin
@Property({ defaultRaw: 'now()', columnType: 'timestamptz' })
createdAt: Date = new Date();
@Property({ nullable: true, columnType: 'timestamptz' })
deletedAt?: Date;
}