We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6c00f79 commit 6c663a7Copy full SHA for 6c663a7
server/src/user/user.service.ts
@@ -146,23 +146,21 @@ export class UserService {
146
147
if (email) {
148
user = await this.findByEmail(email);
149
- }
150
-
151
- if (id) {
+ } else if (id) {
152
user = await this.findByID(id);
153
154
155
- if (username) {
+ } else if (username) {
156
user = await this.findByUsername(username);
157
158
159
- if (!user) {
+ } else {
160
throw new HttpException(
161
'You must provide an email, ID or username',
162
HttpStatus.BAD_REQUEST,
163
);
164
}
165
+ if (!user) {
+ throw new HttpException('User not found', HttpStatus.NOT_FOUND);
+ }
+
166
return UserProfileViewDto.fromUserDocument(user);
167
168
0 commit comments