Skip to content

how to hide password when get the model #1712

Open
@susatyo441

Description

@susatyo441

Issue

How can I hide the password? is there any way to not select the password using typescript-sequelize?

Versions

  • sequelize: ^6.37.1
  • sequelize-typescript: 2.1.6
  • typescript: ^5.1.3

Issue type

  • bug report
  • [ x] feature request

Actual behavior

Expected behavior

Steps to reproduce

Related code

// src/models/user.model.ts

import { Table, Column, Model } from 'sequelize-typescript';
import { Exclude } from 'class-transformer';
import { IsNotEmpty } from 'class-validator';
import { IsEmail } from 'class-validator';

@Table
export class User extends Model {
  @Column
  @IsNotEmpty()
  name: string;

  @Column
  @IsEmail()
  email: string;

  @Column
  @Exclude({ toPlainOnly: true })
  password: string;

  @Column({
    type: 'ENUM',
    values: ['l', 'p'],
  })
  gender: string;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions