mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-06 01:21:39 -04:00
feat(user-info-dto): split email into separate DTO
The email address should only be available in /me routes. This commit splits the email address into a new FullUserInfoDto. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
a7edf00ebc
commit
0394679134
7 changed files with 44 additions and 12 deletions
|
@ -9,7 +9,7 @@ import { Repository } from 'typeorm';
|
|||
|
||||
import { AlreadyInDBError, NotInDBError } from '../errors/errors';
|
||||
import { ConsoleLoggerService } from '../logger/console-logger.service';
|
||||
import { UserInfoDto } from './user-info.dto';
|
||||
import { FullUserInfoDto, UserInfoDto } from './user-info.dto';
|
||||
import { UserRelationEnum } from './user-relation.enum';
|
||||
import { User } from './user.entity';
|
||||
|
||||
|
@ -111,6 +111,19 @@ export class UsersService {
|
|||
* @return {(UserInfoDto)} the built UserInfoDto
|
||||
*/
|
||||
toUserDto(user: User): UserInfoDto {
|
||||
return {
|
||||
username: user.username,
|
||||
displayName: user.displayName,
|
||||
photo: this.getPhotoUrl(user),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Build FullUserInfoDto from a user.
|
||||
* @param {User=} user - the user to use
|
||||
* @return {(UserInfoDto)} the built FullUserInfoDto
|
||||
*/
|
||||
toFullUserDto(user: User): FullUserInfoDto {
|
||||
return {
|
||||
username: user.username,
|
||||
displayName: user.displayName,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue