Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@Field({ nullable: true })
@MaxLength(24)
@IsOptional()
username?: string;
}
@InputType()
export class UserCreateInput {
@Field()
@IsEmail()
@MaxLength(64)
email: string;
@Field()
@MaxLength(24)
username: string;
@Field()
@MinLength(6)
@MaxLength(64)
password: string;
@Field({ nullable: true })
name?: string;
@Field({ nullable: true })
country?: string;
@Field({ nullable: true })
city?: string;
import { Cluster as ICluster } from '@ngx-starter-kit/models';
import { Exclude } from 'class-transformer';
import { IsAscii, IsNotEmpty, IsUrl, MaxLength, MinLength } from 'class-validator';
import { Column, Entity, Index, OneToMany, RelationId } from 'typeorm';
import { AuditBase } from '../../core/entities/audit-base';
import { Project } from '../project.entity';
@Entity('cluster')
export class Cluster extends AuditBase implements ICluster {
@IsNotEmpty()
@IsAscii()
@MinLength(3)
@MaxLength(20)
@Index({ unique: true })
@Column({ length: 15 })
name: string;
@IsNotEmpty()
@MinLength(3)
@MaxLength(6)
@Column({ length: 6 })
ver: string;
@IsNotEmpty()
@IsUrl()
@MinLength(10)
@MaxLength(256)
@Column()
baseUrl: string;
import { ApiModelProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsNotEmpty, MaxLength } from 'class-validator';
import { ProjectDto } from './project.dto';
export class StatusDto {
@ApiModelProperty({ type: Number })
id: number;
@MaxLength(100)
@ApiModelProperty()
name: string;
@MaxLength(255)
@IsNotEmpty()
@ApiModelProperty()
title: string;
@Type(() => ProjectDto)
@IsNotEmpty()
@ApiModelProperty({ type: ProjectDto })
project: ProjectDto;
}
import { ApiModelProperty } from '@nestjs/swagger';
import { IsOptional, MaxLength } from 'class-validator';
export class InGroupDto {
@IsOptional()
id: number;
@MaxLength(100)
@ApiModelProperty()
name: string;
@MaxLength(255)
@ApiModelProperty()
title: string;
}
@Matches(RegExp('^[a-zA-Z0-9\\-]+$'))
@MaxLength(32)
@IsLowercase()
@Column('text')
username: string;
@IsEmail()
@Column('text')
email: string;
@IsNotEmpty()
@Column('text')
passwordHash: string;
@IsNotEmpty()
@MaxLength(20)
@Column('text')
firstName: string;
@IsNotEmpty()
@MaxLength(40)
@Column('text')
lastName: string;
@IsOptional()
@MaxLength(40)
@Column('text', { nullable: true })
middleName?: string;
@IsOptional()
@IsUrl()
@Column('text', { nullable: true })
@Column({ name: 'access_token', length: 500 })
@IsNotEmpty()
@MaxLength(500)
accessToken: string = undefined;
@Column({ name: 'refresh_token', length: 200, nullable: true })
@MaxLength(200)
@IsOptional()
refreshToken: string = undefined;
@Column({ type: Date, name: 'expires_at', nullable: true })
expiresAt: Date = undefined;
@Column({ name: 'token_type', length: 200, nullable: true })
@MaxLength(200)
@IsOptional()
tokenType: string = undefined;
@Column({ length: 512, nullable: true })
@MaxLength(512)
@IsOptional()
scope: string = undefined;
@ManyToOne(type => User, { eager: true })
@IsNotEmpty()
@JoinColumn({ name: 'user_id' })
user: User = undefined;
@BeforeInsert()
doBeforeInsertion() {
const errors = validateSync(this, { validationError: { target: false } });
export class UserDto {
@ApiModelProperty({ type: Number })
id: number;
@Exclude()
@ApiModelPropertyOptional()
password: string;
@ApiModelPropertyOptional({ type: String })
lastLogin: Date;
@ApiModelPropertyOptional({ type: Boolean })
isSuperuser: boolean;
@MaxLength(150)
@ApiModelProperty()
username: string;
@MaxLength(30)
@ApiModelProperty()
firstName: string;
@MaxLength(30)
@ApiModelProperty()
lastName: string;
@MaxLength(254)
@ApiModelProperty()
email: string;
@ApiModelPropertyOptional({ type: Boolean })
import { ApiModelProperty, ApiModelPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsNotEmpty, MaxLength } from 'class-validator';
import { UserDto } from '@rucken/core-nestjs';
import { StatusDto } from './status.dto';
export class ProjectDto {
@ApiModelProperty({ type: Number })
id: number;
@MaxLength(255)
@IsNotEmpty()
@ApiModelProperty()
title: string;
@MaxLength(512)
@ApiModelPropertyOptional()
description: string;
@ApiModelPropertyOptional({ type: Boolean })
isPublic: boolean;
@Type(() => StatusDto)
@ApiModelProperty({ type: StatusDto, isArray: true })
statuses: StatusDto[];
@Type(() => UserDto)
ManyToOne,
OneToMany,
PrimaryGeneratedColumn,
UpdateDateColumn
} from 'typeorm';
import { Status } from './status.entity';
import { Task } from './task.entity';
@Entity({ name: 'projects' })
export class Project {
@PrimaryGeneratedColumn()
id: number = undefined;
@Column({ length: 255 })
@IsNotEmpty()
@MaxLength(255)
title: string = undefined;
@Column({ length: 512, nullable: true })
@MaxLength(512)
@IsOptional()
description: string = undefined;
@Column({ name: 'is_public', default: false })
isPublic: boolean = undefined;
@CreateDateColumn({ name: 'created_at', nullable: true })
createdAt: Date = undefined;
@UpdateDateColumn({ name: 'updated_at', nullable: true })
updatedAt: Date = undefined;
import { ApiModelProperty, ApiModelPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsOptional, MaxLength } from 'class-validator';
import { GroupDto } from '../dto/group.dto';
export class InCreateUserDto {
@IsOptional()
id: number;
@MaxLength(128)
@ApiModelPropertyOptional()
password: string;
@ApiModelPropertyOptional({ type: String })
lastLogin: Date;
@ApiModelProperty({ type: Boolean })
isSuperuser: boolean;
@MaxLength(150)
@ApiModelProperty()
username: string;
@MaxLength(30)
@ApiModelProperty()
firstName: string;