Skip to content

feat/remove-assignment-categories#137

Draft
play-ancora-gyungmin wants to merge 4 commits intodevfrom
feat/remove-assignment-categories
Draft

feat/remove-assignment-categories#137
play-ancora-gyungmin wants to merge 4 commits intodevfrom
feat/remove-assignment-categories

Conversation

@play-ancora-gyungmin
Copy link
Copy Markdown
Contributor

@play-ancora-gyungmin play-ancora-gyungmin commented Feb 21, 2026

🔗 관련 이슈

✨ 변경 사항

이번 PR에서 변경된 내용을 간단히 설명해주세요.

  • 과제 카테고리 테이블 제거
  • 과제 카테고리 관련 서비스 코드 제거
  • 과제 카테고리 엔드포인트 제거
  • 과제 생성 시 결과 프리셋 포함

🧪 테스트 방법

리뷰어가 어떻게 테스트하면 되는지 적어주세요.

  • 로컬에서 페이지 접속
  • 주요 기능 동작 확인

📸 스크린샷 (선택)

UI 변경이 있다면 첨부해주세요.

✅ 체크리스트

  • CI 통과
  • lint / type-check 통과
  • 관련 이슈와 연결됨
  • 불필요한 코드 제거

Summary by CodeRabbit

Release Notes

  • Removed Features

    • Assignment categories functionality has been removed. Result presets are now managed directly within assignment configuration.
  • New Features

    • Materials now support enhanced metadata including: description, subject field, external download URL capability, and soft delete support for archiving.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 21, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR removes the AssignmentCategory model and related infrastructure, replacing the category-based organization with a direct resultPresets array field on assignments. Changes span database schema, repositories, services, controllers, routes, validation schemas, and tests throughout the codebase.

Changes

Cohort / File(s) Summary
Database Schema & Migrations
prisma/migrations/20260221041053_remove_category/migration.sql, prisma/schema.prisma
Removed AssignmentCategory model and table; dropped category_id column and foreign key constraints from assignments; added result_presets array field to assignments; added description, subject, externalDownloadUrl, and deletedAt fields to Material model.
Repository Layer
src/repos/assignment-categories.repo.ts
Deleted entire AssignmentCategoryRepository class with all CRUD methods (create, findByInstructorId, findById, findByInstructorIdAndName, update, delete).
Repository Updates
src/repos/assignments.repo.ts, src/repos/assignment-results.repo.ts, src/repos/exams.repo.ts, src/repos/grades.repo.ts
Updated repository methods to use resultPresets instead of category relations; simplified nested includes by removing category selections; modified create/update signatures to accept resultPresets array instead of categoryId string.
Service Layer Removal
src/services/assignment-categories.service.ts, src/services/assignment-categories.service.test.ts
Deleted AssignmentCategoryService class and all public methods (createCategory, getCategoriesByInstructor, getCategoryById, updateCategory, deleteCategory); removed associated unit tests (237 lines).
Service Updates
src/services/assignments.service.ts, src/services/assignments.service.test.ts, src/services/assignment-results.service.ts, src/services/assignment-results.service.test.ts
Removed assignmentCategoryRepo dependency from AssignmentsService; updated create/update method signatures to use resultPresets instead of categoryId; updated reference paths from assignment.category.resultPresets to assignment.resultPresets; removed category validation logic and related tests.
Exam & Grade Services
src/services/exams.service.ts, src/services/exams.service.test.ts, src/services/grades.service.ts, src/services/grades.service.test.ts
Updated assignment data mapping to include resultPresets; removed category selection and category name references; updated test fixtures to reflect new assignment structure.
Controller & Routes
src/controllers/assignment-categories.controller.ts, src/routes/mgmt/v1/assignment-categories.route.ts, src/routes/mgmt/v1/index.ts, src/config/container.config.ts
Removed AssignmentCategoryController and all route handlers (createCategory, getCategories, getCategoryById, updateCategory, deleteCategory); deleted assignment-categories route file; removed route registration and DI container wiring for assignment category service and controller.
Validation Schemas
src/validations/assignment-categories.validation.ts, src/validations/assignments.validation.ts
Deleted entire assignment-categories validation module including schemas for create, update, and ID validation; updated assignments schema to replace categoryId field with resultPresets array field including deduplication validation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

Refactor, DB/Schema

Suggested reviewers

  • p-changki
  • yoorrll

Poem

🐰 The categories hop away, so neat,
ResultPresets now make assignments complete!
Less nesting, less code, the schema's refined,
One simpler path, a cleaner design!
Cheers to removal—less weight to bear,
More clarity blooms in the database air!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Changes are properly scoped to removing assignment categories and introducing resultPresets. However, the Material model received new fields (description, subject, externalDownloadUrl, deletedAt) that are unrelated to the assignment category removal objective. Move Material model field additions (description, subject, externalDownloadUrl, deletedAt) to a separate PR since they are unrelated to the assignment category removal scope.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'feat/remove-assignment-categories' clearly and specifically describes the main change: removal of assignment category functionality.
Linked Issues check ✅ Passed The pull request successfully addresses all coding objectives from issue #136: removes AssignmentCategory model from schema, eliminates category endpoints/routes, removes category service and controller, and replaces categoryId with resultPresets in assignments.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/remove-assignment-categories

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@play-ancora-gyungmin play-ancora-gyungmin self-assigned this Feb 21, 2026
@play-ancora-gyungmin play-ancora-gyungmin added Feature BE 백엔드라벨 API 엔드포인트 생성, 라우터, 컨트롤러 작업용 labels Feb 21, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/services/assignment-results.service.test.ts (1)

117-117: ⚠️ Potential issue | 🟡 Minor

Remove the stale developer-note comment.

This comment openly admits that some createResult test cases were omitted. It should not be committed — either remove it (if coverage is intentionally limited) or add the missing test cases it references.

🧹 Proposed fix
-    // ... other createResult tests remain logically similar, omitted for brevity but should be included if rewriting whole file ...
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/services/assignment-results.service.test.ts` at line 117, Remove the
stale developer-note comment that admits omitted createResult tests in the test
file; locate the comment in src/services/assignment-results.service.test.ts near
the createResult test suite (references to createResult tests) and either delete
that developer-note line entirely or replace it by adding the missing test cases
it references so the file no longer contains a comment claiming tests were
omitted.
🧹 Nitpick comments (2)
src/services/grades.service.ts (1)

507-525: Consider removing the dead categoryName: null field from the response shape

categoryName is hardcoded to null and has no downstream logic — it's kept solely in the API response object. Leaving it creates an ever-null field that could confuse future maintainers or API consumers.

If no frontend currently reads categoryName, the cleanest approach is to drop it from the returned object. If backward compat is needed, leave it as-is but document the deprecation.

♻️ Optional cleanup
       return {
         assignmentId: assignment.id,
         title: assignment.title,
-        categoryName: null,
         resultIndex: studentResult?.resultIndex ?? null,
         resultLabel,
       };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/services/grades.service.ts` around lines 507 - 525, The returned object
in the assignments map contains a dead field categoryName set to null; remove
the categoryName: null property from the object returned in the assignments
variable (inside the assignmentsOnExamReport.map callback) and update any
related types/DTOs or interfaces that describe this response shape (e.g., the
assignments response type or ExamReportAssignment DTO) so callers and
type-checking reflect the removal; if backward compatibility is required
instead, add a clear deprecation comment near the property and keep it
unchanged.
src/services/assignments.service.ts (1)

9-12: Remove unused prisma dependency from constructor.

PrismaClient is injected but never referenced in any method. Remove it from the constructor and update the container wiring at line 313 of src/config/container.config.ts:

♻️ Changes required
--- a/src/services/assignments.service.ts
+++ b/src/services/assignments.service.ts
@@ -8,7 +8,6 @@ import {
 export class AssignmentsService {
   constructor(
     private readonly assignmentsRepo: AssignmentsRepository,
-    private readonly prisma: PrismaClient,
   ) {}
--- a/src/config/container.config.ts
+++ b/src/config/container.config.ts
@@ -310,7 +310,7 @@ const assignmentResultsRepo = new AssignmentResultsRepository(prisma);
 
-const assignmentsService = new AssignmentsService(assignmentsRepo, prisma);
+const assignmentsService = new AssignmentsService(assignmentsRepo);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/services/assignments.service.ts` around lines 9 - 12, The constructor of
AssignmentsService currently injects a PrismaClient that is never used; remove
the prisma: PrismaClient parameter and its import from
src/services/assignments.service.ts, update the AssignmentsService constructor
to only accept private readonly assignmentsRepo: AssignmentsRepository, and then
update the DI/container registration that instantiates AssignmentsService to
stop passing the PrismaClient (remove the prisma argument from the
provider/factory that constructs AssignmentsService). Ensure imports and types
are cleaned up so no unused PrismaClient references remain.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/services/assignment-results.service.test.ts`:
- Line 117: Remove the stale developer-note comment that admits omitted
createResult tests in the test file; locate the comment in
src/services/assignment-results.service.test.ts near the createResult test suite
(references to createResult tests) and either delete that developer-note line
entirely or replace it by adding the missing test cases it references so the
file no longer contains a comment claiming tests were omitted.

---

Nitpick comments:
In `@src/services/assignments.service.ts`:
- Around line 9-12: The constructor of AssignmentsService currently injects a
PrismaClient that is never used; remove the prisma: PrismaClient parameter and
its import from src/services/assignments.service.ts, update the
AssignmentsService constructor to only accept private readonly assignmentsRepo:
AssignmentsRepository, and then update the DI/container registration that
instantiates AssignmentsService to stop passing the PrismaClient (remove the
prisma argument from the provider/factory that constructs AssignmentsService).
Ensure imports and types are cleaned up so no unused PrismaClient references
remain.

In `@src/services/grades.service.ts`:
- Around line 507-525: The returned object in the assignments map contains a
dead field categoryName set to null; remove the categoryName: null property from
the object returned in the assignments variable (inside the
assignmentsOnExamReport.map callback) and update any related types/DTOs or
interfaces that describe this response shape (e.g., the assignments response
type or ExamReportAssignment DTO) so callers and type-checking reflect the
removal; if backward compatibility is required instead, add a clear deprecation
comment near the property and keep it unchanged.

Copy link
Copy Markdown
Contributor

@rklpoi5678 rklpoi5678 left a comment

Choose a reason for hiding this comment

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

좋습니다.

@play-ancora-gyungmin play-ancora-gyungmin deleted the feat/remove-assignment-categories branch February 25, 2026 08:38
@play-ancora-gyungmin play-ancora-gyungmin restored the feat/remove-assignment-categories branch February 25, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API 엔드포인트 생성, 라우터, 컨트롤러 작업용 BE 백엔드라벨 Feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BE] [Task ID: W4-BE-F-03] 과제 오버엔지니어링 제거

2 participants