feat(be): add duplicate course with input parameters#3457
Open
Choi-Jung-Hyeon wants to merge 9 commits intomainfrom
Open
feat(be): add duplicate course with input parameters#3457Choi-Jung-Hyeon wants to merge 9 commits intomainfrom
Choi-Jung-Hyeon wants to merge 9 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the course duplication functionality by allowing users to specify custom courseNum and semester values instead of copying them from the original course. The changes are backend-only, with frontend modifications planned for a separate PR.
Changes:
- Added
DuplicateCourseInputtype to accept courseNum and semester parameters - Updated
duplicateCoursemutation to accept input parameter and apply custom values - Modified all existing tests to use the new input parameter structure
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/backend/apps/admin/src/group/model/duplicate-course.input.ts | New GraphQL InputType defining courseNum and semester fields for course duplication |
| apps/backend/apps/admin/src/group/group.resolver.ts | Added DuplicateCourseInput parameter to duplicateCourse mutation |
| apps/backend/apps/admin/src/group/group.service.ts | Updated duplicateCourse method signature and implementation to override courseNum/semester with input values; updated JSDoc |
| apps/backend/apps/admin/src/group/group.service.spec.ts | Updated all four test cases to include the new duplicateInput parameter |
Comments suppressed due to low confidence (1)
apps/backend/apps/admin/src/group/group.service.spec.ts:427
- The test should verify that the duplicated course uses the courseNum and semester from the duplicateInput parameter. Currently, the test mocks db.group.create to return groupWithAssignment which contains the original course info. Consider adding an assertion or spy to verify that the create method is called with the correct courseNum ('SWE3099') and semester ('2026 Spring') values from duplicateInput.
it('should duplicate course successfully', async () => {
db.user.findUnique.resolves({ canCreateCourse: true })
const groupWithAssignment = {
...group,
assignment: [{ id: 999 }, { id: 1000 }]
}
db.assignmentProblem.findMany.resolves([
{ order: 1, problemId: 1, score: 100 }
])
db.group.findUniqueOrThrow.resolves(groupWithAssignment)
db.group.create.resolves(groupWithAssignment)
db.assignment.findFirst.onFirstCall().resolves({
id: 999,
groupId,
startTime: new Date(Date.now() - 1000),
endTime: new Date(Date.now() + 1000),
createTime: new Date(),
updateTime: new Date(),
title: 'Original Assignment'
})
db.assignment.findFirst.onSecondCall().resolves({
id: 1000,
groupId,
startTime: new Date(Date.now() - 1000),
endTime: new Date(Date.now() + 1000),
createTime: new Date(),
updateTime: new Date(),
title: 'Original Assignment'
})
db.assignment.create.onFirstCall().resolves({
id: 999
})
db.assignment.create.onSecondCall().resolves({
id: 1000
})
const result = await service.duplicateCourse(
groupId,
userId,
duplicateInput
)
expect(result).to.deep.equal({
duplicatedCourse: groupWithAssignment,
originAssignments: [999, 1000],
copiedAssignments: [999, 1000]
})
})
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… group duplication
RyuRaseul
reviewed
Feb 27, 2026
Contributor
|
해당 PR과 관련없는 이야기지만 추가적으로 제가 생각하기에는 나중에 교수님과 미팅을 통해 좀 더 관련 기능을 구체화할 필요성이 있다고 느껴졌습니다 (프론트, 백 모두) |
RyuRaseul
reviewed
Feb 27, 2026
RyuRaseul
approved these changes
Mar 1, 2026
RyuRaseul
approved these changes
Mar 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Course 복제(
duplicateCourse) 시 원본 Course의courseNum(학수번호)과semester(학기)를 그대로 복사하던 기존 동작을 변경하여, 사용자가 직접 새로운 학수번호와 학기를 입력할 수 있도록 개선합니다.변경 사항:
[NEW] duplicate-course.input.ts:DuplicateCourseInputGraphQL InputType 생성 (courseNum,semester필드)[MODIFY] group.resolver.ts:duplicateCoursemutation에DuplicateCourseInput파라미터 추가[MODIFY] group.service.ts:duplicateCourse메서드에서 복제된 CourseInfo의courseNum,semester를 input 값으로 덮어쓰도록 수정, JSDoc 업데이트[MODIFY] group.service.spec.ts: 기존duplicateCourse테스트 4개를 새로운input파라미터에 맞게 수정Before:
After:
Additional context
Before submitting the PR, please make sure you do the following
fixes #123).