Skip to content

refactor: introduce express-cargo for Paylaod handling#287

Merged
yuchem2 merged 2 commits into
developfrom
FIENMEE-667
Nov 30, 2025
Merged

refactor: introduce express-cargo for Paylaod handling#287
yuchem2 merged 2 commits into
developfrom
FIENMEE-667

Conversation

@yuchem2

@yuchem2 yuchem2 commented Nov 25, 2025

Copy link
Copy Markdown
Member

API 레이어를 리팩토링하여 express-cargo 라이브러리를 도입하고, 요청 입력(query, body, params)을 일관되고 구조화된 방식으로 처리하도록 변경했습니다.

기존 로직과 완전히 동일화된 상태로 Payload 객체를 만들어 필요한 데이터를 가져오고 있습니다.

현재 미들웨어 관련한 로직은 미들웨어에 위임하고, 컨트롤러에 필요한 데이터만 가져오는 방식으로 코드를 작성하였습니다.

Refactored the API layer to use the express-cargo library for consistent and structured input handling (query, body, params).
This change replaces manual input processing with a declarative, class-based Payload system, enhancing code clarity and maintainability without altering existing external API behavior.
@notion-workspace

Copy link
Copy Markdown

express-cargo 도입

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @yuchem2, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 Pull Request는 API 레이어의 리팩토링을 통해 요청 데이터 처리 방식을 표준화하고 개선하는 데 중점을 둡니다. express-cargo 라이브러리를 도입하여 요청 입력(쿼리, 바디, 파라미터)을 일관되고 구조화된 Payload 객체로 변환함으로써, 컨트롤러 로직의 복잡성을 줄이고 코드의 유지보수성과 확장성을 향상시키는 것을 목표로 합니다. 이는 API 엔드포인트 전반에 걸쳐 적용되어 개발 효율성을 높이고 잠재적인 오류를 줄일 수 있습니다.

Highlights

  • express-cargo 라이브러리 도입: API 레이어에 express-cargo 라이브러리를 도입하여 요청(query, body, params) 데이터를 구조화되고 일관된 방식으로 처리하도록 변경했습니다. 이를 통해 컨트롤러 로직에서 요청 데이터 처리 부분을 분리하고 가독성을 높였습니다.
  • Payload 타입 정의: 각 API 엔드포인트의 요청 데이터를 위한 Payload 타입을 apps/server/src/types/payload 디렉토리에 새로 정의했습니다. 이 Payload 클래스들은 express-cargo의 데코레이터를 사용하여 유효성 검사 및 기본값 설정을 담당합니다.
  • 기존 API 엔드포인트 리팩토링: enquiries, events, notifications, s3, schedules, users 컨트롤러의 모든 관련 API 엔드포인트가 bindingCargo 미들웨어와 getCargo 함수를 사용하여 요청 데이터를 처리하도록 수정되었습니다. 이는 req.body, req.query, req.params에 직접 접근하는 대신 구조화된 Payload 객체를 사용하게 합니다.
  • 의존성 업데이트: 새로운 라이브러리 도입에 따라 express-cargoreflect-metadata 의존성이 package.json에 추가되었으며, pnpm-lock.yaml 파일이 업데이트되었습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

이번 PR은 express-cargo 라이브러리를 도입하여 API의 요청 처리를 구조화하고 검증 로직을 강화하는 중요한 리팩토링을 수행했습니다. 전반적으로 컨트롤러 코드가 훨씬 간결해지고 유지보수성이 향상된 점이 인상적입니다. 좋은 방향의 변경이라고 생각합니다.

다만, 날짜 관련 기본값을 처리하는 부분에서 몇 가지 잠재적인 버그와 이전 기능이 누락된 부분을 발견했습니다. 또한, 일부 코드를 조금 더 간결하게 개선할 수 있는 여지가 있어 관련하여 몇 가지 의견을 남깁니다. 자세한 내용은 각 파일의 주석을 참고해주세요.

Comment thread apps/server/src/controllers/v1/events.ts Outdated
Comment thread apps/server/src/controllers/v1/events.ts Outdated
Comment thread apps/server/src/controllers/v1/schedules.ts Outdated
Comment thread apps/server/src/controllers/v1/schedules.ts Outdated
Comment thread apps/server/src/types/payload/schedule.ts
Comment thread apps/server/src/controllers/v1/events.ts Outdated
@yuchem2 yuchem2 merged commit 6016f46 into develop Nov 30, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants