2022-02-26 18:16:28 +01:00
|
|
|
import { Exclude, Expose } from 'class-transformer';
|
2022-02-26 16:06:32 +01:00
|
|
|
import {
|
|
|
|
|
IsDefined,
|
2022-02-26 18:16:28 +01:00
|
|
|
IsEmpty,
|
2022-02-26 16:06:32 +01:00
|
|
|
IsNotEmpty,
|
|
|
|
|
IsOptional,
|
|
|
|
|
} from 'class-validator';
|
|
|
|
|
import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
|
|
|
|
|
|
2022-02-26 18:16:28 +01:00
|
|
|
// Different data for public and private
|
|
|
|
|
|
2022-02-26 16:06:32 +01:00
|
|
|
@Entity()
|
|
|
|
|
export class EUser {
|
|
|
|
|
@PrimaryGeneratedColumn()
|
2022-02-26 18:16:28 +01:00
|
|
|
@IsOptional()
|
|
|
|
|
id?: number;
|
2022-02-26 16:06:32 +01:00
|
|
|
|
|
|
|
|
@Index()
|
|
|
|
|
@Column({ unique: true })
|
|
|
|
|
@IsNotEmpty()
|
|
|
|
|
username: string;
|
|
|
|
|
|
|
|
|
|
@Column({ default: false })
|
|
|
|
|
@IsDefined()
|
|
|
|
|
isAdmin: boolean;
|
|
|
|
|
|
|
|
|
|
@Column({ select: false })
|
|
|
|
|
@IsOptional()
|
2022-02-26 18:16:28 +01:00
|
|
|
@Exclude()
|
2022-02-26 16:06:32 +01:00
|
|
|
password?: string;
|
|
|
|
|
}
|