Skip to content

Commit

Permalink
feat : 개발용 user 전체 정보 user service에 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
seohyun-kim committed Dec 7, 2022
1 parent 0d47ec6 commit c546e63
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/entity/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Infer} from '../common/utils/zod';
import EventNotification from './EventNotification';
import EventLike from './EventLike';
import {log} from '../common/utils/log';
import {UserResponseScheme} from './schemes';
import {UserResponseScheme, UserResponseSchemeForDev} from './schemes';
import ImageUrlService from '../service/ImageUrlService';
import BaseBetterEntity from '../common/base/BaseBetterEntity';

Expand Down Expand Up @@ -149,4 +149,14 @@ export default class User extends BaseBetterEntity {
imageUrl: await ImageUrlService.makeUrl(this.imageUuid),
}
}

async toDevResponse(): Promise<Infer<typeof UserResponseSchemeForDev>> {
return {
id: this.id,
email: this.email,
nickname: this.nickname,
subscribingOn:this.subscribingOn,
createdAt: this.createdAt
}
}
}
4 changes: 4 additions & 0 deletions src/service/UserService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ class UserService {
return await User.findOneOrFail({where: {id}});
}

async getAllUsers(): Promise<User[]> {
return await User.find({order: {id: 'DESC'}});
}

async patchUser(id: number, body: Partial<Infer<typeof UpdateMeRequestScheme>>): Promise<string> {
const patchuser = await User.update(
{id},
Expand Down

0 comments on commit c546e63

Please sign in to comment.