Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
username: string;
password: string;
@IsEmail()
@IsNotEmpty()
email: string;
isSuperuser: boolean;
isStaff: boolean;
@ValidateNested()
@IsOptional()
@Type(serializeModel(Department))
department: Department = new Department();
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
dateOfBirth: string;
toString() {
return this.username;
}
constructor(data?: any) {
plainToClassFromExist(this, data);
}
}
description: string = undefined;
@IsNotEmpty()
@Type(serializeModel(Status))
@Transform(transformStringToObject, { toPlainOnly: true })
status: Status = undefined;
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
openAt: Date = undefined;
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
closeAt: Date = undefined;
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
createdAt: Date = undefined;
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
updatedAt: Date = undefined;
toString() {
return this.title;
}
get range() {
const arr: string[] = [];
if (this.openAt) {
arr.push(DateTime.fromJSDate(this.openAt).toLocaleString());
}
if (this.openAt && this.closeAt) {
arr.push(' - ');
}
if (this.closeAt) {
arr.push(DateTime.fromJSDate(this.closeAt).toLocaleString());
}
return arr.join('');
@IsNotEmpty()
username: string;
password: string;
@IsEmail()
@IsNotEmpty()
email: string;
isSuperuser: boolean;
isStaff: boolean;
@ValidateNested()
@IsOptional()
@Type(serializeModel(Department))
department: Department = new Department();
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
dateOfBirth: string;
toString() {
return this.username;
}
constructor(data?: any) {
plainToClassFromExist(this, data);
}
}
@IsEmail(undefined)
email: string = undefined;
isSuperuser = false;
isStaff = false;
isActive = false;
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
lastLogin: Date = undefined;
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
dateJoined: Date = undefined;
@IsOptional()
@Type(serializeModel(Group))
groups: Group[] = [];
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
dateOfBirth: Date = undefined;
get permissionNames() {
const permissions = [];
if (this.groups) {
this.groups.forEach(group => group.permissions.forEach(permission => permissions.push(permission.name)));
}
return permissions;
}
toString() {
return `${this.firstName} ${this.lastName} (${this.username})`.trim();
}
get fullName() {
return `${this.firstName} ${this.lastName}`.trim();
}
get rolesAsString() {
const roles: string[] = [];
groups: Group
};
id: number = undefined;
@IsNotEmpty()
username: string = undefined;
password: string = undefined;
rePassword: string = undefined;
firstName: string = undefined;
lastName: string = undefined;
@IsNotEmpty()
@IsEmail(undefined)
email: string = undefined;
isSuperuser = false;
isStaff = false;
isActive = false;
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
lastLogin: Date = undefined;
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
dateJoined: Date = undefined;
@IsOptional()
@Type(serializeModel(Group))
groups: Group[] = [];
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
dateOfBirth: Date = undefined;
get permissionNames() {
const permissions = [];
if (this.groups) {
this.groups.forEach(group => group.permissions.forEach(permission => permissions.push(permission.name)));
}
id: number = undefined;
@IsNotEmpty()
@Type(serializeModel(Project))
@Transform(transformStringToObject, { toPlainOnly: true })
project: Project = undefined;
@IsNotEmpty()
title: string = undefined;
description: string = undefined;
@IsNotEmpty()
@Type(serializeModel(Status))
@Transform(transformStringToObject, { toPlainOnly: true })
status: Status = undefined;
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
openAt: Date = undefined;
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
closeAt: Date = undefined;
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
createdAt: Date = undefined;
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
updatedAt: Date = undefined;
toString() {
return this.title;
}
get range() {
const arr: string[] = [];
if (this.openAt) {
arr.push(DateTime.fromJSDate(this.openAt).toLocaleString());
}
export function TransformBoolean(): any {
return Transform(v => v === 'true' || v === 'True' || v === 1 || v === '1');
}
export function TransformNumber(opt?: TransformNumberOptions): any {
const { defaultValue, max, min } = opt || ({} as TransformNumberOptions);
return Transform(v => (isNaN(v) ? defaultValue : max && v > max ? max : min && v < min ? min : +v));
}
name: translate('Name'),
title: translate('Title'),
contentType: translate('Content type'),
createTitle: translate('Add new permission'),
viewTitle: translate('Permission #{{id}}'),
updateTitle: translate('Update permission #{{id}}'),
deleteTitle: translate('Delete permission #{{id}}'),
deleteMessage: translate('Do you really want to delete permission?'),
selectTitle: translate('Select permission')
};
id: number = undefined;
@IsNotEmpty()
name: string = undefined;
title: string = undefined;
@Type(serializeModel(ContentType))
@Transform(transformStringToObject, { toPlainOnly: true })
contentType: ContentType = undefined;
get contentTypeAsString() {
if (this.contentType) {
return this.contentType;
}
return undefined;
}
toString() {
return this.title;
}
}
status: translate('Status'),
openAt: translate('Open at'),
closeAt: translate('Close at'),
createdAt: translate('Created at'),
updatedAt: translate('Updated at'),
range: translate('Range'),
createTitle: translate('Add new task'),
viewTitle: translate('Task #{{id}}'),
updateTitle: translate('Update task #{{id}}'),
deleteTitle: translate('Delete task #{{id}}'),
deleteMessage: translate('Do you really want to delete task?')
};
id: number = undefined;
@IsNotEmpty()
@Type(serializeModel(Project))
@Transform(transformStringToObject, { toPlainOnly: true })
project: Project = undefined;
@IsNotEmpty()
title: string = undefined;
description: string = undefined;
@IsNotEmpty()
@Type(serializeModel(Status))
@Transform(transformStringToObject, { toPlainOnly: true })
status: Status = undefined;
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
openAt: Date = undefined;
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })
closeAt: Date = undefined;
@Transform(transformStringToDate, { toClassOnly: true })
@Transform(transformDateToString, { toPlainOnly: true })