File

src/modules/user/entities/user-auth.entity.ts

Extends

AbstractEntity

Index

Properties
Methods

Properties

dtoClass
Default value : UserAuthDto
Optional lastFailedLoggedDate
Type : Date
Decorators :
@Column({nullable: true})
Optional lastLogoutDate
Type : Date
Decorators :
@Column({nullable: true})
Optional lastSuccessfulLoggedDate
Type : Date
Decorators :
@Column({nullable: true})
password
Type : string
Decorators :
@Column()
role
Type : RoleType
Decorators :
@Column({type: 'enum', enum: RoleType, default: undefined})
updatedAt
Type : Date
Decorators :
@UpdateDateColumn({type: 'timestamp with time zone', nullable: true})
user
Type : UserEntity
Decorators :
@OneToOne(undefined, undefined, {nullable: false, onDelete: 'CASCADE'})
@JoinColumn()
Abstract dtoClass
Inherited from AbstractEntity
Defined in AbstractEntity:13
id
Type : number
Decorators :
@PrimaryGeneratedColumn('increment')
Inherited from AbstractEntity
Defined in AbstractEntity:7
uuid
Type : string
Decorators :
@Column()
@Generated('uuid')
Inherited from AbstractEntity
Defined in AbstractEntity:11

Methods

toDto
toDto(options?: any)
Inherited from AbstractEntity
Defined in AbstractEntity:15
Parameters :
Name Type Optional
options any Yes
Returns : T
import { AbstractEntity } from 'common/entities';
import { UserAuthDto } from '../dtos';
import { UserEntity } from '../entities';
import {
  Column,
  Entity,
  JoinColumn,
  OneToOne,
  UpdateDateColumn,
} from 'typeorm';
import { RoleType } from 'common/constants';

@Entity({ name: 'users_auth' })
export class UserAuthEntity extends AbstractEntity<UserAuthDto> {
  @Column({ type: 'enum', enum: RoleType, default: RoleType.USER })
  role: RoleType;
  
  @Column()
  password: string;

  @Column({ nullable: true })
  lastSuccessfulLoggedDate?: Date;

  @Column({ nullable: true })
  lastFailedLoggedDate?: Date;

  @Column({ nullable: true })
  lastLogoutDate?: Date;

  @UpdateDateColumn({
    type: 'timestamp with time zone',
    nullable: true,
  })
  updatedAt: Date;

  @OneToOne(() => UserEntity, (user: UserEntity) => user.userAuth, {
    nullable: false,
    onDelete: 'CASCADE',
  })
  @JoinColumn()
  user: UserEntity;

  dtoClass = UserAuthDto;
}

result-matching ""

    No results matching ""