Skip to content

Commit

Permalink
[FIX] 특정 학과 학생 논문 정보 업데이트 오류 수정 (#130)
Browse files Browse the repository at this point in the history
* fix: 학생이 본심 논문 수정 시 수정지시사항 반영 학과 체크

* fix: 관리자가 본심 논문 수정 시 수정지시사항 반영 학과 체크

* fix: 논문 정보 업데이트 API 다시 수정

* fix: 학생 엑셀 업로드로 논문 제목 수정시 생길 수 있는 오류 수정
  • Loading branch information
yesjuhee authored May 9, 2024
1 parent d4b05b5 commit c91b5bf
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 28 deletions.
38 changes: 22 additions & 16 deletions src/modules/students/students.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,12 @@ export class StudentsService {
where: { id: mainThesisInfo.id },
data: { title: thesisTitle },
});
await tx.thesisInfo.update({
where: { id: revisionThesisInfo.id },
data: { title: thesisTitle },
});
if (revisionThesisInfo) {
await tx.thesisInfo.update({
where: { id: revisionThesisInfo.id },
data: { title: thesisTitle },
});
}
}

// 지도 정보 수정 (reviewer, review)
Expand Down Expand Up @@ -1572,9 +1574,9 @@ export class StudentsService {
(thesisFile) => thesisFile.type === ThesisFileType.PRESENTATION
)[0];

const [thesisInfo] = await this.prismaService.$transaction([
const thesisInfo = await this.prismaService.$transaction(async (tx) => {
// 본심 논문 정보 업데이트
this.prismaService.thesisInfo.update({
const thesisData = await tx.thesisInfo.update({
where: { id: mainThesisInfo.id },
data: {
title,
Expand All @@ -1600,17 +1602,21 @@ export class StudentsService {
include: { file: true },
},
},
}),
// 수정지시사항 논문 정보 업데이트
this.prismaService.thesisInfo.update({
where: { id: revisionThesisInfo.id },
data: {
title,
abstract,
},
}),
]);
});

if (revisionThesisInfo) {
// 수정지시사항 논문 정보 업데이트 : 수정 지시시항 포함 학과만!!
await tx.thesisInfo.update({
where: { id: revisionThesisInfo.id },
data: {
title,
abstract,
},
});
}

return thesisData;
});
return thesisInfo;
} // 수정 지시사항 반영 단계일 경우
else if (currentStage === Stage.REVISION) {
Expand Down
30 changes: 18 additions & 12 deletions src/modules/theses/theses.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ export class ThesesService {
(thesisInfo) => thesisInfo.stage === Stage.REVISION
)[0];

const [thesisInfo] = await this.prismaService.$transaction([
const thesisInfo = await this.prismaService.$transaction(async (tx) => {
// 본심 논문 정보 업데이트
this.prismaService.thesisInfo.update({
const thesisData = tx.thesisInfo.update({
where: { id },
data: {
title,
Expand All @@ -106,16 +106,22 @@ export class ThesesService {
include: { file: true },
},
},
}),
// 수정지시사항 논문 정보 업데이트
this.prismaService.thesisInfo.update({
where: { id: revisionThesisInfo.id },
data: {
title,
abstract,
},
}),
]);
});

if (revisionThesisInfo) {
// 수정지시사항 논문 정보 업데이트 : 수정 지시시항 포함 학과만!!
await tx.thesisInfo.update({
where: { id: revisionThesisInfo.id },
// where: { id: revisionThesisInfo.id },
data: {
title,
abstract,
},
});
}

return thesisData;
});

return thesisInfo;
} // 수정 지시사항 반영 단계일 경우
Expand Down

0 comments on commit c91b5bf

Please sign in to comment.