Skip to content

Commit

Permalink
[PR][#76] 27차 회의 및 기타 요청 사항 처리 (#79)
Browse files Browse the repository at this point in the history
* feat: Add default value on study:recruited

* feat: Add findNotice by study id api

* feat: Init get pending members functions

* feat: Remove findPendingMembers
  • Loading branch information
selgyun authored Sep 22, 2023
1 parent a1d42bf commit 16a3f3b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Study" ALTER COLUMN "recruited" SET DEFAULT 1;
2 changes: 1 addition & 1 deletion src/database/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ model Study {
recruitStartDate DateTime
startDate DateTime
name String
recruited Int
recruited Int @default(1)
locationDetail String
templateContent String
total Int
Expand Down
5 changes: 5 additions & 0 deletions src/study/study.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ export class StudyController {
return this.studyService.findNotices(+id);
}

@Get(':id/notice')
findNotice(@Param('id') id: string): Promise<GetNoticeResponseDto> {
return this.studyService.findNotice(+id);
}

@Get(':id/journals')
findJournals(@Param('id') id: string): Promise<GetJournalResponseDto[]> {
return this.studyService.findJournals(+id);
Expand Down
12 changes: 12 additions & 0 deletions src/study/study.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,18 @@ export class StudyService {
return notices.map((notice) => GetNoticeResponseDto.fromNotice(notice));
}

async findNotice(id: number): Promise<GetNoticeResponseDto> {
const study = await this.findOne(id);
const notice = await this.prisma.notice.findFirst({
where: { studyId: study.id },
orderBy: {
updatedAt: 'desc',
},
});

return GetNoticeResponseDto.fromNotice(notice);
}

async findJournals(id: number): Promise<GetJournalResponseDto[]> {
const study = await this.findOne(id);
const journals = await this.prisma.journal.findMany({
Expand Down

0 comments on commit 16a3f3b

Please sign in to comment.