user.entity.ts 528 B

123456789101112131415161718192021222324
  1. import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
  2. import { ApiProperty } from '@nestjs/swagger';
  3. import { classToPlain, Exclude } from 'class-transformer';
  4. @Entity('user')
  5. export class UserEntity extends BaseEntity {
  6. @ApiProperty()
  7. @PrimaryGeneratedColumn('uuid')
  8. id: number;
  9. @ApiProperty()
  10. @Column({ default: null })
  11. email: string;
  12. @ApiProperty()
  13. @Exclude({ toPlainOnly: true })
  14. @Column({ default: null })
  15. password: string;
  16. toJSON() {
  17. return classToPlain(this);
  18. }
  19. }