-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(api,mobile): Result 패턴 도입 및 레이어 아키텍처 재구성 (#116) #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dydals3440
merged 16 commits into
main
from
refactor/result-pattern-and-layer-restructure
Feb 6, 2026
Merged
Changes from 13 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
cf6b57c
feat(api): scheduledTime에 TIMESTAMPTZ 타입 적용
dydals3440 c009b19
feat(api): 타임존 지원 날짜 유틸리티 및 데코레이터 추가
dydals3440 c5066d1
refactor(api): Todo 모듈 타임존 지원 및 Overlapping Intervals 필터링
dydals3440 2daff1a
test(api): Todo 타임존 및 날짜 범위 필터링 테스트 추가
dydals3440 3af7623
feat(api): 알림 중복 발송 방지 로직 및 테스트 추가
dydals3440 0a78fee
refactor(api): Cheer/Nudge 모듈 타임존 지원 추가
dydals3440 80e6f21
feat(mobile): Result 패턴 및 에러 인프라 도입
dydals3440 befc2de
refactor(mobile): Auth 기능 레이어 재구성
dydals3440 ed82a75
refactor(mobile): Friend 기능 레이어 재구성
dydals3440 e00ab99
refactor(mobile): Notification 기능 레이어 재구성
dydals3440 f665815
refactor(mobile): Todo 기능 레이어 재구성
dydals3440 f54a3d2
refactor(mobile): DI 컨테이너 및 공유 유틸리티 업데이트
dydals3440 a6499d2
docs(mobile): 아키텍처 문서 및 에러 처리 가이드 업데이트
dydals3440 afbb965
style(api): startOfDayInTimezone 중복 JSDoc 주석 제거
dydals3440 5ff0c2d
docs(api): 문서 현행화 및 Swagger X-Timezone 헤더 추가
dydals3440 58c941a
docs(mobile): CLAUDE.md ClientError 용어 및 구조도 수정
dydals3440 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
apps/api/prisma/migrations/20260205233052_add_timestamptz_to_scheduled_time/migration.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| -- AlterTable | ||
| ALTER TABLE "Todo" ALTER COLUMN "scheduledTime" SET DATA TYPE TIMESTAMPTZ(3); |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| import { | ||
| getUserToday, | ||
| startOfDayInTimezone, | ||
| toDateString, | ||
| toScheduledTime, | ||
| } from "./date.util"; | ||
|
|
||
| describe("getUserToday", () => { | ||
| it("KST 자정 이후에도 한국 날짜를 반환한다", () => { | ||
| // KST 2026-02-07 01:00 = UTC 2026-02-06 16:00 | ||
| jest.useFakeTimers().setSystemTime(new Date("2026-02-06T16:00:00Z")); | ||
| const today = getUserToday("Asia/Seoul"); | ||
| expect(toDateString(today)).toBe("2026-02-07"); | ||
| jest.useRealTimers(); | ||
| }); | ||
|
|
||
| it("UTC 기본값으로 동작한다", () => { | ||
| jest.useFakeTimers().setSystemTime(new Date("2026-02-06T23:00:00Z")); | ||
| const today = getUserToday(); | ||
| expect(toDateString(today)).toBe("2026-02-06"); | ||
| jest.useRealTimers(); | ||
| }); | ||
|
|
||
| it("미국 동부 시간대에서 정확한 날짜를 반환한다", () => { | ||
| // EST 2026-02-06 23:30 = UTC 2026-02-07 04:30 | ||
| jest.useFakeTimers().setSystemTime(new Date("2026-02-07T04:30:00Z")); | ||
| const today = getUserToday("America/New_York"); | ||
| expect(toDateString(today)).toBe("2026-02-06"); | ||
| jest.useRealTimers(); | ||
| }); | ||
| }); | ||
|
|
||
| describe("startOfDayInTimezone", () => { | ||
| it("KST 타임존의 자정을 UTC로 변환한다", () => { | ||
| const date = new Date("2026-02-06T20:00:00Z"); // KST 2026-02-07 05:00 | ||
| const result = startOfDayInTimezone(date, "Asia/Seoul"); | ||
| expect(toDateString(result)).toBe("2026-02-07"); | ||
| expect(result.getUTCHours()).toBe(0); | ||
| expect(result.getUTCMinutes()).toBe(0); | ||
| }); | ||
|
|
||
| it("UTC 기본값으로 동작한다", () => { | ||
| const date = new Date("2026-02-06T15:30:00Z"); | ||
| const result = startOfDayInTimezone(date); | ||
| expect(toDateString(result)).toBe("2026-02-06"); | ||
| expect(result.getUTCHours()).toBe(0); | ||
| }); | ||
| }); | ||
|
|
||
| describe("toScheduledTime", () => { | ||
| it("KST 로컬 시간을 UTC로 변환한다", () => { | ||
| // KST 14:00 → UTC 05:00 | ||
| const result = toScheduledTime("2026-01-15", "14:00", "Asia/Seoul"); | ||
| expect(result.toISOString()).toBe("2026-01-15T05:00:00.000Z"); | ||
| }); | ||
|
|
||
| it("EST 로컬 시간을 UTC로 변환한다", () => { | ||
| // EST 14:00 → UTC 19:00 | ||
| const result = toScheduledTime("2026-01-15", "14:00", "America/New_York"); | ||
| expect(result.toISOString()).toBe("2026-01-15T19:00:00.000Z"); | ||
| }); | ||
|
|
||
| it("UTC 기본값으로 동작한다", () => { | ||
| const result = toScheduledTime("2026-01-15", "14:00"); | ||
| expect(result.toISOString()).toBe("2026-01-15T14:00:00.000Z"); | ||
| }); | ||
|
|
||
| it("자정 근처 타임존 변환 시 날짜가 올바르게 처리된다", () => { | ||
| // KST 01:00 → UTC 이전 날 16:00 | ||
| const result = toScheduledTime("2026-01-15", "01:00", "Asia/Seoul"); | ||
| expect(result.toISOString()).toBe("2026-01-14T16:00:00.000Z"); | ||
| }); | ||
| }); |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { Timezone } from "./timezone.decorator"; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { createParamDecorator, type ExecutionContext } from "@nestjs/common"; | ||
|
|
||
| export const Timezone = createParamDecorator( | ||
| (_data: unknown, ctx: ExecutionContext): string => { | ||
| const request = ctx.switchToHttp().getRequest(); | ||
| return request.headers["x-timezone"] || "UTC"; | ||
| }, | ||
| ); |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.