mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 10:25:23 +00:00
29 lines
836 B
TypeScript
29 lines
836 B
TypeScript
import { Column, Entity, OneToMany } from 'typeorm';
|
|
import { AbstractEntity } from '../../abstract/entities/abstract.entity';
|
|
import { PermissionType } from '@app/common/constants/permission-type.enum';
|
|
import { PermissionTypeDto } from '../dtos/permission.dto';
|
|
import { DeviceUserPermissionEntity } from '../../device/entities';
|
|
|
|
@Entity({ name: 'permission-type' })
|
|
export class PermissionTypeEntity extends AbstractEntity<PermissionTypeDto> {
|
|
@Column({
|
|
nullable: false,
|
|
enum: Object.values(PermissionType),
|
|
})
|
|
type: string;
|
|
|
|
@OneToMany(
|
|
() => DeviceUserPermissionEntity,
|
|
(permission) => permission.permissionType,
|
|
{
|
|
nullable: true,
|
|
},
|
|
)
|
|
permission: DeviceUserPermissionEntity[];
|
|
|
|
constructor(partial: Partial<PermissionTypeEntity>) {
|
|
super();
|
|
Object.assign(this, partial);
|
|
}
|
|
}
|