Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | 1x 1x 1x 6x 6x 2x 2x 2x 2x 1x 6x 6x 4x 4x 4x 4x 4x 4x 4x 4x 2x 2x 2x 2x 2x 1x 1x 1x 1x | import { ClassError, ObjectBase } from '@tomei/general';
import { IUserPrivilegeAttr } from '../../interfaces/user-privilege.interface';
import { UserPrivilegeRepository } from './user-privilege.repository';
export class UserPrivilege extends ObjectBase {
TableName = 'sso_UserPrivilege';
ObjectType = 'UserPrivilege';
ObjectName: string;
ObjectId: string;
UserPrivilegeId: number;
UserId: number;
PrivilegeCode: string;
Status: string;
private _CreatedById: number;
private _UpdatedById: number;
private _CreatedAt: Date;
private _UpdatedAt: Date;
get CreatedById(): number {
return this._CreatedById;
}
get UpdatedById(): number {
return this._UpdatedById;
}
get CreatedAt(): Date {
return this._CreatedAt;
}
get UpdatedAt(): Date {
return this._UpdatedAt;
}
private static _Repository = new UserPrivilegeRepository();
private constructor(userPrivilegeAttr?: IUserPrivilegeAttr) {
super();
if (userPrivilegeAttr) {
this.UserPrivilegeId = userPrivilegeAttr.UserPrivilegeId;
this.UserId = userPrivilegeAttr.UserId;
this.PrivilegeCode = userPrivilegeAttr.PrivilegeCode;
this.Status = userPrivilegeAttr.Status;
this._CreatedById = userPrivilegeAttr.CreatedById;
this._UpdatedById = userPrivilegeAttr.UpdatedById;
this._CreatedAt = userPrivilegeAttr.CreatedAt;
this._UpdatedAt = userPrivilegeAttr.UpdatedAt;
}
}
public static async init(dbTransaction?: any, UserPrivilegeId?: number) {
try {
let userPrivilege = new UserPrivilege();
if (UserPrivilegeId) {
const userPrivilegeAttr = await this._Repository.findOne({
where: { UserPrivilegeId },
transaction: dbTransaction,
});
if (userPrivilegeAttr) {
userPrivilege = new UserPrivilege(userPrivilegeAttr);
} else {
throw new ClassError(
'UserPrivilege',
'UserPrivilegeErrMsg00',
'UserPrivilege not found',
);
}
}
return userPrivilege;
} catch (error) {
throw error;
}
}
}
|