33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { BaseStatusModel } from 'src/core/modules/data/model/base-status.model';
|
|
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
|
import { Column, Entity, OneToMany } from 'typeorm';
|
|
import { UserPrivilegeEntity } from '../../domain/entities/user-privilege.entity';
|
|
import { UserPrivilegeConfigurationModel } from './user-privilege-configuration.model';
|
|
import { UserModel } from 'src/modules/user-related/user/data/models/user.model';
|
|
|
|
@Entity(TABLE_NAME.USER_PRIVILEGE)
|
|
export class UserPrivilegeModel
|
|
extends BaseStatusModel<UserPrivilegeEntity>
|
|
implements UserPrivilegeEntity
|
|
{
|
|
@Column('varchar', { name: 'name', length: 125 })
|
|
name: string;
|
|
|
|
@OneToMany(
|
|
() => UserPrivilegeConfigurationModel,
|
|
(model) => model.user_privilege,
|
|
{
|
|
cascade: true,
|
|
onDelete: 'CASCADE',
|
|
onUpdate: 'CASCADE',
|
|
},
|
|
)
|
|
user_privilege_configurations: UserPrivilegeConfigurationModel[];
|
|
|
|
@OneToMany(() => UserModel, (model) => model.user_privilege, {
|
|
onDelete: 'CASCADE',
|
|
onUpdate: 'CASCADE',
|
|
})
|
|
users: UserModel[];
|
|
}
|