【发布时间】:2019-03-21 21:05:35
【问题描述】:
仅当登录用户与实体具有相同的 id 时,我才会序列化实体用户的属性“电子邮件”。
实体用户:
@Entity()
@Exclude()
export class User {
@Expose()
@PrimaryGeneratedColumn("uuid")
id: string;
@Expose() // Only if logged user == this
@Column({nullable: true, default: null})
public email: string;
@Expose()
@Column({nullable: true, default: null})
public username: string;
@Column({nullable: true, default: null})
public password: string;
@CreateDateColumn()
public create_at: Date;
@UpdateDateColumn()
public update_at: Date;
}
【问题讨论】:
标签: javascript node.js nestjs typeorm