Files
Picsur/shared/src/entities/user.entity.ts

32 lines
591 B
TypeScript
Raw Normal View History

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