Skip to content

[Refactor] TypeORM 엔티티와 리포지토리 도메인 모듈로 이동 - #82

Merged
JangDongHo merged 1 commit into
devfrom
refactor/co-locate-typeorm-files
Jun 11, 2026
Merged

JangDongHo merged 1 commit into
devfrom
refactor/co-locate-typeorm-files

Conversation

@JangDongHo

@JangDongHo JangDongHo commented Jun 11, 2026 •

Copy link
Copy Markdown
Member

📌 개요

  • TypeORM 엔티티와 리포지토리를 각 도메인 모듈 내부로 이동하고, DB/로거 설정은 인프라 계층으로 정리했습니다.

✨ 작업 내용

  • src/type-orm/entities에 모여 있던 엔티티와 리포지토리를 api/public/* 도메인 모듈 내부로 이동했습니다.
  • 식당, 공지사항, 학사일정 모듈에서 별도 repository module을 제거하고 각 모듈이 TypeOrmModule.forFeature(...)와 repository provider를 직접 등록하도록 변경했습니다.
  • 사용자, 캠퍼스, 단과대학, 학과, 셔틀 등 기존 도메인 모듈과 서비스/컨트롤러/테스트의 import 경로를 새 구조 기준으로 갱신했습니다.
  • 전역 성격의 DatabaseModule, LoggerModule을 infrastructure 아래로 이동해 도메인/API 모듈과 인프라 설정의 책임을 분리했습니다.
  • 기존 type-orm/entities 및 repository module 참조가 남지 않도록 정리했습니다.

🔥 변경 이유

  • 엔티티와 리포지토리를 사용하는 도메인 모듈 가까이에 두어 관련 코드를 찾기 쉽게 만들기 위함입니다.
  • repository 등록 책임을 각 모듈로 옮겨 도메인별 의존성을 명확히 하고, 별도 repository module로 인한 간접 구조를 줄였습니다.
  • DB 연결과 로거 설정은 특정 API 도메인이 아닌 애플리케이션 인프라 설정이므로 별도 계층으로 분리했습니다.

🧪 테스트

  • 정상 동작 확인
  • 예외 케이스 확인
  • pnpm lint:check 통과
  • pnpm test 통과: 7개 테스트 스위트, 60개 테스트
  • pnpm build 통과
  • type-orm/entities, repository.module, 기존 logger/database 경로 참조가 남지 않은 것을 확인했습니다.

🔗 관련 이슈

  • 해당 없음

Summary by CodeRabbit

릴리스 노트

  • Chores
    • 내부 모듈 구조를 재정리하여 코드 조직을 개선했습니다.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6fb69dd0-9bbf-440d-aa9d-e1c2d94f937a

📥 Commits

Reviewing files that changed from the base of the PR and between b1beaf4 and 2a2f0a9.

📒 Files selected for processing (47)
  • services/api/app/src/api/public/cafeterias/cafeterias.controller.ts
  • services/api/app/src/api/public/cafeterias/cafeterias.module.ts
  • services/api/app/src/api/public/cafeterias/cafeterias.repository.ts
  • services/api/app/src/api/public/cafeterias/cafeterias.service.spec.ts
  • services/api/app/src/api/public/cafeterias/cafeterias.service.ts
  • services/api/app/src/api/public/cafeterias/entities/cafeteria-diet.entity.ts
  • services/api/app/src/api/public/cafeterias/entities/cafeteria.entity.ts
  • services/api/app/src/api/public/campuses/campuses.module.ts
  • services/api/app/src/api/public/campuses/campuses.repository.ts
  • services/api/app/src/api/public/campuses/campuses.service.ts
  • services/api/app/src/api/public/campuses/entities/campus.entity.ts
  • services/api/app/src/api/public/colleges/colleges.module.ts
  • services/api/app/src/api/public/colleges/colleges.repository.ts
  • services/api/app/src/api/public/colleges/colleges.service.ts
  • services/api/app/src/api/public/colleges/entities/college.entity.ts
  • services/api/app/src/api/public/departments/departments.module.ts
  • services/api/app/src/api/public/departments/departments.repository.ts
  • services/api/app/src/api/public/departments/departments.service.ts
  • services/api/app/src/api/public/departments/entities/department.entity.ts
  • services/api/app/src/api/public/notices/entities/notice-category.entity.ts
  • services/api/app/src/api/public/notices/entities/notice.entity.ts
  • services/api/app/src/api/public/notices/notice-categories.repository.ts
  • services/api/app/src/api/public/notices/notices.controller.ts
  • services/api/app/src/api/public/notices/notices.module.ts
  • services/api/app/src/api/public/notices/notices.repository.ts
  • services/api/app/src/api/public/notices/notices.service.spec.ts
  • services/api/app/src/api/public/notices/notices.service.ts
  • services/api/app/src/api/public/schedules/academic-calendars.repository.ts
  • services/api/app/src/api/public/schedules/entities/academic-calendar.entity.ts
  • services/api/app/src/api/public/schedules/schedules.module.ts
  • services/api/app/src/api/public/schedules/schedules.service.ts
  • services/api/app/src/api/public/shuttles/entities/shuttle-timetable.entity.ts
  • services/api/app/src/api/public/shuttles/shuttle-timetable.repository.ts
  • services/api/app/src/api/public/shuttles/shuttles.module.ts
  • services/api/app/src/api/public/shuttles/shuttles.service.ts
  • services/api/app/src/api/public/users/entities/users.entity.ts
  • services/api/app/src/api/public/users/users.controller.ts
  • services/api/app/src/api/public/users/users.module.ts
  • services/api/app/src/api/public/users/users.repository.ts
  • services/api/app/src/api/public/users/users.service.spec.ts
  • services/api/app/src/api/public/users/users.service.ts
  • services/api/app/src/app.module.ts
  • services/api/app/src/infrastructure/logger/logger.module.ts
  • services/api/app/src/infrastructure/type-orm/database.module.ts
  • services/api/app/src/type-orm/entities/academic-calendars/academic-calendars-repository.module.ts
  • services/api/app/src/type-orm/entities/cafeterias/cafeterias-repository.module.ts
  • services/api/app/src/type-orm/entities/notices/notices-repository.module.ts

Walkthrough

이 PR은 TypeORM 엔티티와 저장소를 중앙 집중식 src/type-orm/entities/ 구조에서 각 기능 모듈(src/api/public/*/entities/) 내로 재구성합니다. 모든 import 경로가 업데이트되고, 모듈별 DI 설정이 직접 TypeOrmModule.forFeature()를 사용하도록 변경되며, 더 이상 필요하지 않은 3개의 중앙 저장소 모듈이 제거됩니다.

Changes

Public API 엔티티 및 저장소 모듈 재구성

Layer / File(s) Summary
공개 API 엔티티 경로 통합
src/api/public/cafeterias/entities/*, src/api/public/campuses/entities/*, src/api/public/colleges/entities/*, src/api/public/departments/entities/*, src/api/public/notices/entities/*, src/api/public/users/entities/*
모든 엔티티가 새로운 공개 API 디렉터리 구조로 이동되고, 엔티티 간 관계 import가 절대 경로 src/api/public/...로 업데이트됩니다.
저장소 import 경로 및 엔티티 참조 업데이트
src/api/public/*/cafeterias.repository.ts, src/api/public/*/campuses.repository.ts, src/api/public/*/colleges.repository.ts, src/api/public/*/departments.repository.ts, src/api/public/notices/*, src/api/public/schedules/*, src/api/public/shuttles/*, src/api/public/users/*
리포지토리 파일이 새로 이동된 엔티티 위치를 참조하고, 각 저장소의 도메인 기반 import 경로가 일관되게 정리됩니다.
기능 모듈 DI 구성 재조직
src/api/public/cafeterias/cafeterias.module.ts, src/api/public/notices/notices.module.ts, src/api/public/schedules/schedules.module.ts, src/api/public/users/users.module.ts 및 기타
각 기능 모듈이 중앙 저장소 모듈 대신 직접 TypeOrmModule.forFeature()와 저장소 제공자를 사용하도록 변경되어, 모듈 간 강결합이 제거됩니다.
서비스, 컨트롤러, 테스트 import 업데이트
src/api/public/*/cafeterias/*, src/api/public/*/notices/*, src/api/public/*/schedules/*, src/api/public/*/shuttles/*, src/api/public/*/users/*, *.spec.ts
모든 서비스, 컨트롤러, 테스트 파일이 저장소와 엔티티 import를 새로운 공개 API 경로로 업데이트하여 기존 TypeORM 중앙 경로와의 종속성이 제거됩니다.
중앙 저장소 모듈 제거
src/type-orm/entities/academic-calendars/academic-calendars-repository.module.ts, src/type-orm/entities/cafeterias/cafeterias-repository.module.ts, src/type-orm/entities/notices/notices-repository.module.ts
AcademicCalendarsRepositoryModule, CafeteriasRepositoryModule, NoticesRepositoryModule이 완전히 제거되어, 저장소 제공이 기능 모듈 내에서 직접 관리되도록 통합됩니다.
애플리케이션 루트 모듈 기반 시설 경로 업데이트
src/app.module.ts
AppModule에서 LoggerModule과 DatabaseModule의 import 경로가 새로운 기반 시설 디렉터리 위치(src/infrastructure/*)를 참조하도록 업데이트됩니다.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • GNU-connect/Server-Node#29: 학사 일정 모듈/서비스 배선 재구성 변경사항(SchedulesModule에서 AcademicCalendarsRepositoryModule 제거 및 직접 TypeOrmModule.forFeature 사용)이 해당 PR의 학사 일정 API 도입 및 저장소 구현과 직접 관련됩니다.
  • GNU-connect/Server-Node#11: 두 PR 모두 동일한 TypeORM 분할 재구성의 일부로, src/api/public/users/* 및 관련 campuses/colleges/departments 파일의 동일 모듈을 업데이트하여 import와 DI 배선을 재위치된 엔티티/저장소 경로로 변경합니다.
  • GNU-connect/Server-Node#22: 본 PR의 src/api/public/notices/* 재구성 변경사항(notices.module.ts/notices.service.ts/NoticesRepository 및 NoticeCategoriesRepository 배선)이 해당 PR의 새로운 대학 공지 엔드포인트 도입과 직접 겹칩니다.
  • GNU-connect/Server-Node#67: 본 PR의 식당 TypeORM/모듈/저장소 배선 재구성(CafeteriasNativeController/식단 엔드포인트 추가)이 직접 필요합니다.

Suggested labels

Refactor, Cafeteria, Notice, Schedule, Shuttle

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/co-locate-typeorm-files

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.

@JangDongHo
JangDongHo marked this pull request as ready for review June 11, 2026 08:44
@JangDongHo JangDongHo self-assigned this Jun 11, 2026
@JangDongHo JangDongHo changed the title TypeORM 엔티티와 리포지토리 도메인 모듈로 이동 [Refactor] TypeORM 엔티티와 리포지토리 도메인 모듈로 이동 Jun 11, 2026
@JangDongHo
JangDongHo merged commit 495c2fe into dev Jun 11, 2026
1 of 2 checks passed
@JangDongHo
JangDongHo deleted the refactor/co-locate-typeorm-files branch June 11, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant