Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Bentroen committed Feb 10, 2025
2 parents 4c8b1f9 + cd62317 commit 0bfbf0b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
16 changes: 16 additions & 0 deletions server/src/user/dto/user.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { User } from '../entity/user.entity';

export class UserDto {
username: string;
publicName: string;
email: string;
static fromEntity(user: User): UserDto {
const userDto: UserDto = {
username: user.username,
publicName: user.publicName,
email: user.email,
};

return userDto;
}
}
5 changes: 4 additions & 1 deletion server/src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { UpdateUsernameDto } from '@shared/validation/user/dto/UpdateUsername.dt
import { validate } from 'class-validator';
import { Model } from 'mongoose';

import { UserDto } from './dto/user.dto';
import { User, UserDocument } from './entity/user.entity';

@Injectable()
Expand Down Expand Up @@ -148,6 +149,8 @@ export class UserService {
user.username = username;
user.lastEdited = new Date();

return await user.save();
await user.save();

return UserDto.fromEntity(user);
}
}
File renamed without changes.

0 comments on commit 0bfbf0b

Please sign in to comment.