Skip to content

feat(be): add duplicate course with input parameters#3457

Merged
Choi-Jung-Hyeon merged 13 commits intomainfrom
t2601-add-id-sem-duplicatecourse
Mar 18, 2026
Merged

feat(be): add duplicate course with input parameters#3457
Choi-Jung-Hyeon merged 13 commits intomainfrom
t2601-add-id-sem-duplicatecourse

Conversation

@Choi-Jung-Hyeon
Copy link
Copy Markdown
Contributor

Description

Course 복제(duplicateCourse) 시 원본 Course의 courseNum(학수번호)과 semester(학기)를 그대로 복사하던 기존 동작을 변경하여, 사용자가 직접 새로운 학수번호와 학기를 입력할 수 있도록 개선합니다.

변경 사항:

  • [NEW] duplicate-course.input.tsDuplicateCourseInput GraphQL InputType 생성 (courseNumsemester 필드)
  • [MODIFY] group.resolver.tsduplicateCourse mutation에 DuplicateCourseInput 파라미터 추가
  • [MODIFY] group.service.tsduplicateCourse 메서드에서 복제된 CourseInfo의 courseNumsemester를 input 값으로 덮어쓰도록 수정, JSDoc 업데이트
  • [MODIFY] group.service.spec.ts: 기존 duplicateCourse 테스트 4개를 새로운 input 파라미터에 맞게 수정

Before:

duplicateCourse(groupId) → 원본 courseNum/semester 그대로 복사

After:

duplicateCourse(groupId, input: { courseNum, semester }) → 사용자 입력값으로 courseNum/semester 설정

Additional context

  • 이 PR은 Backend만 포함합니다. Frontend(입력 필드 UI 추가, GraphQL mutation 변수 수정)는 별도 PR에서 작업 예정입니다.

Before submitting the PR, please make sure you do the following

Copilot AI review requested due to automatic review settings February 26, 2026 18:17
@Choi-Jung-Hyeon Choi-Jung-Hyeon changed the title feat(be): add duplicate course functionality with input parameters feat(be): add duplicate course with input parameters Feb 26, 2026
@Choi-Jung-Hyeon Choi-Jung-Hyeon requested review from RyuRaseul and Copilot and removed request for Copilot February 26, 2026 18:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 DuplicateCourseInput type to accept courseNum and semester parameters
  • Updated duplicateCourse mutation 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.

Comment thread apps/backend/apps/admin/src/group/model/duplicate-course.input.ts
Comment thread apps/backend/apps/admin/src/group/group.service.ts Outdated
Comment thread apps/backend/apps/admin/src/group/group.service.ts
@RyuRaseul
Copy link
Copy Markdown
Contributor

해당 PR과 관련없는 이야기지만 추가적으로 제가 생각하기에는 나중에 교수님과 미팅을 통해 좀 더 관련 기능을 구체화할 필요성이 있다고 느껴졌습니다 (프론트, 백 모두)

Comment thread apps/backend/apps/admin/src/group/group.service.spec.ts
@RyuRaseul RyuRaseul enabled auto-merge March 1, 2026 05:38
@RyuRaseul RyuRaseul added this pull request to the merge queue Mar 17, 2026
@Choi-Jung-Hyeon Choi-Jung-Hyeon removed this pull request from the merge queue due to a manual request Mar 17, 2026
@github-project-automation github-project-automation Bot moved this to Pending ✋ in Codedang Mar 17, 2026
@github-project-automation github-project-automation Bot moved this from Pending ✋ to Approved 👌 in Codedang Mar 17, 2026
@RyuRaseul RyuRaseul added this pull request to the merge queue Mar 18, 2026
@Choi-Jung-Hyeon Choi-Jung-Hyeon removed this pull request from the merge queue due to a manual request Mar 18, 2026
@Choi-Jung-Hyeon Choi-Jung-Hyeon added this pull request to the merge queue Mar 18, 2026
Merged via the queue into main with commit e9dbc9f Mar 18, 2026
11 checks passed
@Choi-Jung-Hyeon Choi-Jung-Hyeon deleted the t2601-add-id-sem-duplicatecourse branch March 18, 2026 07:13
@github-project-automation github-project-automation Bot moved this from Approved 👌 to Done ✔️ in Codedang Mar 18, 2026
egg-zz pushed a commit that referenced this pull request Mar 25, 2026
### Description

Course 복제(`duplicateCourse`) 시 원본
Course의 `courseNum`(학수번호)과 `semester`(학기)를 그대로 복사하던 기존 동작을 변경하여, 사용자가 직접
새로운 학수번호와 학기를 입력할 수 있도록 개선합니다.

**변경 사항:**

- **`[NEW] duplicate-course.input.ts`**: `DuplicateCourseInput` GraphQL
InputType 생성 (`courseNum`, `semester` 필드)
- **`[MODIFY]
group.resolver.ts`**: `duplicateCourse` mutation에 `DuplicateCourseInput` 파라미터
추가
- **`[MODIFY] group.service.ts`**: `duplicateCourse` 메서드에서 복제된
CourseInfo의 `courseNum`, `semester`를 input 값으로 덮어쓰도록 수정, JSDoc 업데이트
- **`[MODIFY] group.service.spec.ts`**: 기존 `duplicateCourse` 테스트 4개를
새로운 `input` 파라미터에 맞게 수정

**Before:**

```
duplicateCourse(groupId) → 원본 courseNum/semester 그대로 복사
```

**After:**

```
duplicateCourse(groupId, input: { courseNum, semester }) → 사용자 입력값으로 courseNum/semester 설정
```

### **Additional context**

- 이 PR은 **Backend만** 포함합니다. Frontend(입력 필드 UI 추가, GraphQL mutation 변수
수정)는 별도 PR에서 작업 예정입니다.

---

### Before submitting the PR, please make sure you do the following

- [ ] Read the [Contributing
Guidelines](https://github.com/skkuding/next/blob/main/CONTRIBUTING.md)
- [ ] Read the [Contributing
Guidelines](https://github.com/skkuding/next/blob/main/CONTRIBUTING.md#pr-and-branch)
and follow the [Commit
Convention](https://github.com/skkuding/next/blob/main/CONTRIBUTING.md#commit-convention)
- [ ] Provide a description in this PR that addresses **what** the PR is
solving, or reference the issue that it solves (e.g. `fixes #123`).
- [ ] Ideally, include relevant tests that fail without this PR but pass
with it.

---------

Co-authored-by: Dohyun Ryu <113527604+RyuRaseul@users.noreply.github.com>
Co-authored-by: RyuRaseul <ydh88283072@gmail.com>
Co-authored-by: sanghyeonjung <jeongsanghyeon255@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done ✔️

Development

Successfully merging this pull request may close these issues.

4 participants