-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/82-match-history
- Loading branch information
Showing
5 changed files
with
96 additions
and
66 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
backend/src/interceptors/remove-users-fields/remove-users-fields.interceptor.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { | ||
CallHandler, | ||
ExecutionContext, | ||
Injectable, | ||
NestInterceptor, | ||
} from '@nestjs/common'; | ||
import { User } from '@prisma/client'; | ||
import { Observable } from 'rxjs'; | ||
import { map } from 'rxjs/operators'; | ||
|
||
@Injectable() | ||
export class RemoveUsersFieldsInterceptor implements NestInterceptor { | ||
intercept(context: ExecutionContext, next: CallHandler): Observable<User> { | ||
return next.handle().pipe( | ||
map((user) => { | ||
if (!user) { | ||
return user; | ||
} | ||
delete user.refreshToken; | ||
delete user.mfaSecret; | ||
delete user.mfaEnabled; | ||
return user; | ||
}), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { IsBoolean, IsOptional, IsString } from 'class-validator'; | ||
|
||
export class PatchUserDto { | ||
@IsString() | ||
@IsOptional() | ||
displayName?: string; | ||
|
||
@IsString() | ||
@IsOptional() | ||
avatar?: string; | ||
|
||
@IsBoolean() | ||
@IsOptional() | ||
mfaEnabled?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters