apps/api: account: remove db props from token payload

This commit is contained in:
vchikalkin 2024-01-16 12:31:25 +03:00
parent f19f7af6a0
commit f7ab0dc2d7
2 changed files with 5 additions and 3 deletions

View File

@ -48,7 +48,7 @@ export class AccountService {
const payload: TokenPayload = {
username: login,
...omit(account.toJSON(), ['password']),
...omit(account.toJSON(), ['password', '_id', '__v']),
};
return this.jwtService.sign(payload);

View File

@ -11,12 +11,14 @@ export class Account {
@ApiResponseProperty()
@ApiProperty()
@Prop({ index: { unique: true }, required: true })
username: string;
public username: string;
@ApiResponseProperty()
@ApiProperty()
@Prop({ required: true })
password: string;
public password: string;
readonly [key: string]: unknown;
}
export const AccountSchema = SchemaFactory.createForClass(Account);