From fb52e90f2a4c1e4c56c0d44a81242fa4df5a2479 Mon Sep 17 00:00:00 2001 From: rimit-rim Date: Sun, 7 Sep 2025 22:21:20 +0900 Subject: [PATCH 1/7] =?UTF-8?q?=F0=9F=90=9BFix:=20=EC=8B=9C=EA=B0=84=20?= =?UTF-8?q?=EC=98=A4=EC=B0=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/auth/auth.controller.js | 4 +-- src/helps/dto/helps.request.dto.js | 13 ++++++---- src/helps/helps.controller.js | 2 +- src/helps/helps.repository.js | 20 +++++++++++++++ src/jobs/close-expired-helps.job.js | 38 +++++++++-------------------- src/utils/time.js | 21 ++++++++++++++++ 6 files changed, 64 insertions(+), 34 deletions(-) create mode 100644 src/utils/time.js diff --git a/src/auth/auth.controller.js b/src/auth/auth.controller.js index 1d2b4ff..25647b1 100644 --- a/src/auth/auth.controller.js +++ b/src/auth/auth.controller.js @@ -475,8 +475,8 @@ import { AuthResponseDto } from "./dto/auth.response.dto.js"; // 로컬 개발용 const cookieOptsDev = { httpOnly: true, - secure: false, // http - sameSite: 'Lax', // 같은 PC 포트 간 요청만 + secure: true, // http + sameSite: 'None', // 같은 PC 포트 간 요청만 path: '/', maxAge: 7 * 24 * 60 * 60 * 1000, }; diff --git a/src/helps/dto/helps.request.dto.js b/src/helps/dto/helps.request.dto.js index 6faf60c..b97c72e 100644 --- a/src/helps/dto/helps.request.dto.js +++ b/src/helps/dto/helps.request.dto.js @@ -48,11 +48,14 @@ export class CreateHelpRequestDto { if (!this.serviceDate) { errors.push('서비스 날짜를 선택해주세요.'); } else { - const serviceDate = new Date(this.serviceDate); - const today = new Date(); - today.setHours(0, 0, 0, 0); - - if (serviceDate < today) { + // KST 기준으로 비교 → utils/time.js에서 헬퍼 불러와 사용 + // - toKstDateOnly: DB/입력 날짜를 KST 날짜 객체로 변환 + // - getKstStartOfTodayUtc: 오늘 00:00(KST)의 UTC (여기선 단순히 KST '오늘 00:00'을 만들어 비교) + const kstNow = new Date(new Date().toLocaleString("en-US", { timeZone: "Asia/Seoul" })); + kstNow.setHours(0, 0, 0, 0); // 오늘 KST 자정 + const serviceDateKst = new Date(new Date(this.serviceDate).toLocaleString("en-US", { timeZone: "Asia/Seoul" })); + serviceDateKst.setHours(0, 0, 0, 0); + if (serviceDateKst < kstNow) { errors.push('서비스 날짜는 오늘 또는 이후여야 합니다.'); } } diff --git a/src/helps/helps.controller.js b/src/helps/helps.controller.js index da923de..4523066 100644 --- a/src/helps/helps.controller.js +++ b/src/helps/helps.controller.js @@ -794,7 +794,7 @@ export class HelpsController { * schema: * type: integer * enum: [0, 1, 2] - * description: "매칭 상태 (0: 요청, 1: 배정, 2: 완료, 4: 모집종료)" + * description: "매칭 상태 (0: 요청, 1: 배정, 2: 완료)" * - in: query * name: helpTypes * schema: diff --git a/src/helps/helps.repository.js b/src/helps/helps.repository.js index 5eecc27..ea38eaa 100644 --- a/src/helps/helps.repository.js +++ b/src/helps/helps.repository.js @@ -287,6 +287,26 @@ export class HelpsRepository { data: { status: 4, updatedAt: new Date() } }); } + + // 과거 날짜 → 모집종료(4) 처리 + async closeExpiredByPastDate(todayStartUtc) { + return prisma.helpRequest.updateMany({ + where: { status: 0, serviceDate: { lt: todayStartUtc } }, + data: { status: 4, updatedAt: new Date() }, + }); + } + + // (B) 오늘 + 시작시간 경과 → 모집종료(4) 처리 + async closeExpiredByStartTimeToday({ todayStartUtc, tomorrowStartUtc, nowUtcTime }) { + return prisma.helpRequest.updateMany({ + where: { + status: 0, + serviceDate: { gte: todayStartUtc, lt: tomorrowStartUtc }, // 오늘(KST) + startTime: { lte: nowUtcTime }, // time-only(UTC) 비교 + }, + data: { status: 4, updatedAt: new Date() }, + }); + } } export const helpsRepository = new HelpsRepository(); \ No newline at end of file diff --git a/src/jobs/close-expired-helps.job.js b/src/jobs/close-expired-helps.job.js index 2eff0c3..28dd2a7 100644 --- a/src/jobs/close-expired-helps.job.js +++ b/src/jobs/close-expired-helps.job.js @@ -1,34 +1,20 @@ import cron from "node-cron"; import { helpsRepository } from "../helps/helps.repository.js"; +import { kstStartOfTodayAsUtc, kstStartOfTomorrowAsUtc, nowUtcTimeOfDayEpoch } from "../utils/time.js"; -/** - * 오늘의 "KST 자정(00:00)" 시각을 UTC Date 객체로 변환 - * - DB의 serviceDate 비교 기준으로 사용 - * - 예: 2025-09-06 00:00:00 (KST) → 2025-09-05 15:00:00 (UTC) - */ -function kstStartOfTodayAsUtc() { - const now = new Date(); - // 현재 시간을 KST로 변환 - const kstNow = new Date(now.toLocaleString("en-US", { timeZone: "Asia/Seoul" })); - kstNow.setHours(0, 0, 0, 0); // KST 자정으로 맞춤 - // KST → UTC 변환 (9시간 빼기) - return new Date(kstNow.getTime() - 9 * 60 * 60 * 1000); -} - -/** - * 모집종료(4) 상태 업데이트 스케줄러 - * - 서버 시작 시 즉시 1회 실행 - * - 이후 매 30분마다 실행 - */ export function scheduleCloseExpiredHelps() { const run = async () => { - const cutoffUtc = kstStartOfTodayAsUtc(); - const result = await helpsRepository.closeExpiredHelps(cutoffUtc); - console.log( - `[closeExpiredHelps] ${new Date().toISOString()} - updated ${result.count} rows` - ); + const todayStartUtc = kstStartOfTodayAsUtc(); + const tomorrowStartUtc = kstStartOfTomorrowAsUtc(); + const nowUtcTime = nowUtcTimeOfDayEpoch(); + + await helpsRepository.closeExpiredByPastDate(todayStartUtc); + await helpsRepository.closeExpiredByStartTimeToday({ + todayStartUtc, tomorrowStartUtc, nowUtcTime + }); + // console.log(`[closeExpiredHelps/update] past=${r1.count}, todayPastStart=${r2.count}`); }; - run(); // 서버 시작 시 즉시 1회 실행 - cron.schedule("*/30 * * * *", run, { timezone: "Asia/Seoul" }); // 30분마다 실행 + run(); // 서버 시작 시 즉시 실행 + cron.schedule("*/30 * * * *", run, { timezone: "Asia/Seoul" }); } diff --git a/src/utils/time.js b/src/utils/time.js new file mode 100644 index 0000000..fc3a99a --- /dev/null +++ b/src/utils/time.js @@ -0,0 +1,21 @@ +const KST_OFFSET_MS = 9 * 60 * 60 * 1000; + +/** 오늘 KST 00:00을 UTC Date로 반환 */ +export function kstStartOfTodayAsUtc() { + const nowUtcMs = Date.now(); + const nowKst = new Date(nowUtcMs + KST_OFFSET_MS); + nowKst.setHours(0, 0, 0, 0); + return new Date(nowKst.getTime() - KST_OFFSET_MS); +} + +/** 내일 KST 00:00을 UTC Date로 반환 */ +export function kstStartOfTomorrowAsUtc() { + const t = kstStartOfTodayAsUtc(); + return new Date(t.getTime() + 24 * 60 * 60 * 1000); +} + +/** 현재 시간을 UTC time-only(1970-01-01 기준)로 반환 */ +export function nowUtcTimeOfDayEpoch() { + const now = new Date(); + return new Date(Date.UTC(1970, 0, 1, now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds())); +} \ No newline at end of file From a0f2813d1f05b68efb467ee93ea22ad2344bce6a Mon Sep 17 00:00:00 2001 From: rimit-rim Date: Sun, 7 Sep 2025 23:32:40 +0900 Subject: [PATCH 2/7] =?UTF-8?q?=F0=9F=90=9BFix:=20=EC=8B=9C=EA=B0=84=20?= =?UTF-8?q?=EC=98=A4=EC=B0=A8=20(2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/helps/helps.repository.js | 69 +++++++++++++++++++++++++---- src/jobs/close-expired-helps.job.js | 11 +++-- src/utils/time.js | 29 +++++++----- 3 files changed, 88 insertions(+), 21 deletions(-) diff --git a/src/helps/helps.repository.js b/src/helps/helps.repository.js index ea38eaa..170e1c2 100644 --- a/src/helps/helps.repository.js +++ b/src/helps/helps.repository.js @@ -298,15 +298,68 @@ export class HelpsRepository { // (B) 오늘 + 시작시간 경과 → 모집종료(4) 처리 async closeExpiredByStartTimeToday({ todayStartUtc, tomorrowStartUtc, nowUtcTime }) { - return prisma.helpRequest.updateMany({ - where: { - status: 0, - serviceDate: { gte: todayStartUtc, lt: tomorrowStartUtc }, // 오늘(KST) - startTime: { lte: nowUtcTime }, // time-only(UTC) 비교 - }, - data: { status: 4, updatedAt: new Date() }, - }); + // KST 기준 현재 시:분을 추출해, 임계 UTC time-only(1970-01-01) 계산 + const now = new Date(); // UTC + const kstHour = (now.getUTCHours() + 9) % 24; // 현재 KST 시 + const kstMin = now.getUTCMinutes(); + + // KST 00:00에 해당하는 UTC time-only = 1970-01-01T15:00:00Z + const KST_MID_UTC = new Date(Date.UTC(1970, 0, 1, 15, 0, 0, 0)); + // (nowKst - 9h)을 time-only로 표현한 임계치 + const thresholdUtc = new Date(Date.UTC( + 1970, 0, 1, + nowUtcTime.getUTCHours(), nowUtcTime.getUTCMinutes(), nowUtcTime.getUTCSeconds() + )); + + // 기본 where: 오늘(KST) + 아직 요청 상태 + const base = { + status: 0, + serviceDate: { gte: todayStartUtc, lt: tomorrowStartUtc } + }; + + if (kstHour >= 9) { + // 구간 2개: [15:00, 24:00) ∪ [00:00, threshold] + return prisma.helpRequest.updateMany({ + where: { + ...base, + OR: [ + { startTime: { gte: KST_MID_UTC } }, + { startTime: { lte: thresholdUtc } } + ] + }, + data: { status: 4, updatedAt: new Date() } + }); + } else { + // 구간 1개: [15:00, threshold] + return prisma.helpRequest.updateMany({ + where: { + ...base, + startTime: { gte: KST_MID_UTC, lte: thresholdUtc } + }, + data: { status: 4, updatedAt: new Date() } + }); + } } + + /* async debugCheckRow(helpId, { todayStartUtc, tomorrowStartUtc, nowUtcTime }) { + const row = await prisma.helpRequest.findUnique({ + where: { id: helpId }, + select: { id: true, status: true, serviceDate: true, startTime: true }, + }); + + const inToday = + row.serviceDate >= todayStartUtc && row.serviceDate < tomorrowStartUtc; + const started = row.startTime <= nowUtcTime; + + console.log("[debugCheckRow]", { + id: row.id, + status: row.status, + serviceDate: row.serviceDate.toISOString(), + startTime: row.startTime.toISOString(), + inToday, started, + willUpdate: row.status === 0 && inToday && started, + }); + } */ } export const helpsRepository = new HelpsRepository(); \ No newline at end of file diff --git a/src/jobs/close-expired-helps.job.js b/src/jobs/close-expired-helps.job.js index 28dd2a7..a27c40e 100644 --- a/src/jobs/close-expired-helps.job.js +++ b/src/jobs/close-expired-helps.job.js @@ -1,6 +1,10 @@ import cron from "node-cron"; import { helpsRepository } from "../helps/helps.repository.js"; -import { kstStartOfTodayAsUtc, kstStartOfTomorrowAsUtc, nowUtcTimeOfDayEpoch } from "../utils/time.js"; +import { + kstStartOfTodayAsUtc, + kstStartOfTomorrowAsUtc, + nowUtcTimeOfDayEpoch +} from "../utils/time.js"; export function scheduleCloseExpiredHelps() { const run = async () => { @@ -12,9 +16,10 @@ export function scheduleCloseExpiredHelps() { await helpsRepository.closeExpiredByStartTimeToday({ todayStartUtc, tomorrowStartUtc, nowUtcTime }); - // console.log(`[closeExpiredHelps/update] past=${r1.count}, todayPastStart=${r2.count}`); + // await helpsRepository.debugCheckRow(24, { todayStartUtc, tomorrowStartUtc, nowUtcTime }); + }; - run(); // 서버 시작 시 즉시 실행 + run(); // 서버 시작 즉시 1회 cron.schedule("*/30 * * * *", run, { timezone: "Asia/Seoul" }); } diff --git a/src/utils/time.js b/src/utils/time.js index fc3a99a..4e21899 100644 --- a/src/utils/time.js +++ b/src/utils/time.js @@ -1,21 +1,30 @@ +const MS_PER_DAY = 24 * 60 * 60 * 1000; const KST_OFFSET_MS = 9 * 60 * 60 * 1000; -/** 오늘 KST 00:00을 UTC Date로 반환 */ +/** + * 오늘 KST 00:00을 "UTC Date"로 반환 + * 예) KST 2025-09-07 00:00:00 → UTC 2025-09-06 15:00:00 + */ export function kstStartOfTodayAsUtc() { - const nowUtcMs = Date.now(); - const nowKst = new Date(nowUtcMs + KST_OFFSET_MS); - nowKst.setHours(0, 0, 0, 0); - return new Date(nowKst.getTime() - KST_OFFSET_MS); + const nowUtcMs = Date.now(); // 현재 UTC epoch(ms) + const kstEpochMs = nowUtcMs + KST_OFFSET_MS; // KST 타임라인으로 이동 + const kstDays = Math.floor(kstEpochMs / MS_PER_DAY);// KST 기준 '오늘'의 일수 + const kstMidnightEpochMs = kstDays * MS_PER_DAY; // KST 자정(epoch, KST 타임라인) + const utcMs = kstMidnightEpochMs - KST_OFFSET_MS; // 다시 UTC로 환산 + return new Date(utcMs); } -/** 내일 KST 00:00을 UTC Date로 반환 */ +/** 내일 KST 00:00의 UTC Date */ export function kstStartOfTomorrowAsUtc() { - const t = kstStartOfTodayAsUtc(); - return new Date(t.getTime() + 24 * 60 * 60 * 1000); + const todayUtc = kstStartOfTodayAsUtc(); + return new Date(todayUtc.getTime() + MS_PER_DAY); } -/** 현재 시간을 UTC time-only(1970-01-01 기준)로 반환 */ +/** + * 현재 시간을 UTC time-only(1970-01-01 기준) Date로 반환 + * - DB TIME(@db.Time, UTC)와 안전 비교용 + */ export function nowUtcTimeOfDayEpoch() { - const now = new Date(); + const now = new Date(); // UTC 기준 시/분/초 사용 return new Date(Date.UTC(1970, 0, 1, now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds())); } \ No newline at end of file From 43c6123f86e1dd3a28849266c4b389d75103e11f Mon Sep 17 00:00:00 2001 From: rimit-rim Date: Thu, 11 Sep 2025 01:20:05 +0900 Subject: [PATCH 3/7] =?UTF-8?q?=E2=99=BB=20Refactor:=20imageUrl=20?= =?UTF-8?q?=EB=B3=80=EC=88=98=20=ED=86=B5=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/applications/applications.controller.js | 4 ++-- src/applications/dto/applications.response.dto.js | 4 ++-- src/helps/dto/helps.response.dto.js | 2 +- src/helps/helps.controller.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/applications/applications.controller.js b/src/applications/applications.controller.js index bb3a398..492a996 100644 --- a/src/applications/applications.controller.js +++ b/src/applications/applications.controller.js @@ -232,7 +232,7 @@ export class ApplicationsController { * helper: * id: 3 * nickname: "염둘" - * profileImageUrl: null + * imageUrl: null * reviewCount: 2 * ratingAvg: 5 * pagination: @@ -605,7 +605,7 @@ export class ApplicationsController { * requester: * id: 5 * nickname: "김엄마" - * profileImageUrl: "https://example.com/profile.jpg" + * imageUrl: "https://example.com/profile.jpg" * reviewCount: 12 * ratingAvg: 4.8 * pagination: diff --git a/src/applications/dto/applications.response.dto.js b/src/applications/dto/applications.response.dto.js index b64ab5b..17fd76b 100644 --- a/src/applications/dto/applications.response.dto.js +++ b/src/applications/dto/applications.response.dto.js @@ -73,7 +73,7 @@ export class ApplicantListItemDto { this.helper = { id: app.helper?.id ?? app.userId, nickname: app.helper?.nickname ?? "알수없음", - profileImageUrl: + imageUrl: app.helper?.imageUrl || app.helper?.kakaoProfileImageUrl || null, reviewCount: stats.reviewCount ?? 0, ratingAvg: stats.ratingAvg ?? 0, @@ -104,7 +104,7 @@ export class MyApplicationItemDto { requester: { id: app.helpRequest.requester.id, nickname: app.helpRequest.requester.nickname, - profileImageUrl: + imageUrl: app.helpRequest.requester.imageUrl || app.helpRequest.requester.kakaoProfileImageUrl || null, diff --git a/src/helps/dto/helps.response.dto.js b/src/helps/dto/helps.response.dto.js index c322459..a052953 100644 --- a/src/helps/dto/helps.response.dto.js +++ b/src/helps/dto/helps.response.dto.js @@ -148,7 +148,7 @@ export class MyHelpRequestListItemDto { if (helpRequest.applications && helpRequest.applications.length > 0) { this.applicants = helpRequest.applications.map(app => ({ helperId: app.userId, - helperImageUrl: app.helper.imageUrl || app.helper.kakaoProfileImageUrl + imageUrl: app.helper.imageUrl || app.helper.kakaoProfileImageUrl })); } diff --git a/src/helps/helps.controller.js b/src/helps/helps.controller.js index 4523066..155701d 100644 --- a/src/helps/helps.controller.js +++ b/src/helps/helps.controller.js @@ -999,7 +999,7 @@ export class HelpsController { * helperId: * type: integer * example: 5 - * helperImageUrl: + * imageUrl: * type: string * example: "https://example.com/helper1.jpg" * assignedHelper: From 644545c7a048427793d05e70d2831a6d900dc2e6 Mon Sep 17 00:00:00 2001 From: rimit-rim Date: Thu, 11 Sep 2025 21:51:56 +0900 Subject: [PATCH 4/7] =?UTF-8?q?:recycle:Refactor:=20help=20=EC=9D=91?= =?UTF-8?q?=EB=8B=B5=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/applications/applications.controller.js | 15 ++++++++++++--- src/applications/applications.repository.js | 5 +++++ src/applications/dto/applications.response.dto.js | 9 +++++++-- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/applications/applications.controller.js b/src/applications/applications.controller.js index 492a996..f17f90c 100644 --- a/src/applications/applications.controller.js +++ b/src/applications/applications.controller.js @@ -202,9 +202,13 @@ export class ApplicationsController { * help: * id: 6 * helpType: 4 - * helpTypeText: "기타" + * helpTypeText: "기타 돌봄" * status: 0 * statusText: "요청" + * serviceDate: "2025-08-20T00:00:00.000Z" + * startTime: "1970-01-01T01:30:00.000Z" + * endTime: "1970-01-01T03:00:00.000Z" + * addressText: "서울시 동대문구 한교동" * totalApplicants: 0 * applicants: [] * pagination: @@ -219,9 +223,13 @@ export class ApplicationsController { * help: * id: 16 * helpType: 1 - * helpTypeText: "등하원" + * helpTypeText: "등하원 돌봄" * status: 0 * statusText: "요청" + * serviceDate: "2025-08-20T00:00:00.000Z" + * startTime: "1970-01-01T01:30:00.000Z" + * endTime: "1970-01-01T03:00:00.000Z" + * addressText: "서울시 동대문구 한교동" * totalApplicants: 1 * applicants: * - applicationId: 1 @@ -598,10 +606,11 @@ export class ApplicationsController { * help: * id: 20 * helpType: 1 - * helpTypeText: "등하원" + * helpTypeText: "등하원 돌봄" * serviceDate: "2025-08-20T00:00:00.000Z" * startTime: "1970-01-01T01:30:00.000Z" * endTime: "1970-01-01T03:00:00.000Z" + * addressText: "서울시 동대문구 한교동" * requester: * id: 5 * nickname: "김엄마" diff --git a/src/applications/applications.repository.js b/src/applications/applications.repository.js index 8d9cb49..d010ad4 100644 --- a/src/applications/applications.repository.js +++ b/src/applications/applications.repository.js @@ -24,6 +24,10 @@ export class ApplicationsRepository { requesterId: true, helpType: true, status: true, + serviceDate: true, + startTime: true, + endTime: true, + addressText: true, }, }); } @@ -213,6 +217,7 @@ export class ApplicationsRepository { serviceDate: true, startTime: true, endTime: true, + addressText: true, requester: { select: { id: true, diff --git a/src/applications/dto/applications.response.dto.js b/src/applications/dto/applications.response.dto.js index 17fd76b..f53f8f7 100644 --- a/src/applications/dto/applications.response.dto.js +++ b/src/applications/dto/applications.response.dto.js @@ -32,6 +32,10 @@ export class ApplyListResponseDto { helpTypeText: this._helpTypeText(help.helpType), status: help.status, statusText: this._helpStatusText(help.status), + serviceDate: help.serviceDate, + startTime: help.startTime, + endTime: help.endTime, + addressText: help.addressText, }; // 전체 지원자 수 (페이지네이션 적용 전 총합) @@ -53,7 +57,7 @@ export class ApplyListResponseDto { } _helpTypeText(type) { - const map = { 1: "등하원", 2: "놀이", 3: "동행", 4: "기타" }; + const map = { 1: "등하원 돌봄", 2: "놀이 돌봄", 3: "동행 돌봄", 4: "기타 돌봄" }; return map[type] ?? "알 수 없음"; } _helpStatusText(status) { @@ -101,6 +105,7 @@ export class MyApplicationItemDto { serviceDate: app.helpRequest.serviceDate, startTime: app.helpRequest.startTime, endTime: app.helpRequest.endTime, + addressText: app.helpRequest.addressText, requester: { id: app.helpRequest.requester.id, nickname: app.helpRequest.requester.nickname, @@ -120,7 +125,7 @@ export class MyApplicationItemDto { } _helpTypeText(type) { - const map = { 1: "등하원", 2: "놀이", 3: "동행", 4: "기타" }; + const map = { 1: "등하원 돌봄", 2: "놀이 돌봄", 3: "동행 돌봄", 4: "기타 돌봄" }; return map[type] ?? "알 수 없음"; } } \ No newline at end of file From ae8a73b7c594c9660200901c5dc57e008b004df4 Mon Sep 17 00:00:00 2001 From: rimit-rim Date: Fri, 12 Sep 2025 00:43:22 +0900 Subject: [PATCH 5/7] =?UTF-8?q?:recycle:Refactor:=20help=20=EC=9D=91?= =?UTF-8?q?=EB=8B=B5=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?(2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/applications/applications.controller.js | 3 +++ src/applications/applications.repository.js | 2 ++ src/applications/dto/applications.response.dto.js | 2 ++ 3 files changed, 7 insertions(+) diff --git a/src/applications/applications.controller.js b/src/applications/applications.controller.js index f17f90c..d4b778d 100644 --- a/src/applications/applications.controller.js +++ b/src/applications/applications.controller.js @@ -209,6 +209,7 @@ export class ApplicationsController { * startTime: "1970-01-01T01:30:00.000Z" * endTime: "1970-01-01T03:00:00.000Z" * addressText: "서울시 동대문구 한교동" + * rewardTokens: 9 * totalApplicants: 0 * applicants: [] * pagination: @@ -230,6 +231,7 @@ export class ApplicationsController { * startTime: "1970-01-01T01:30:00.000Z" * endTime: "1970-01-01T03:00:00.000Z" * addressText: "서울시 동대문구 한교동" + * rewardTokens: 9 * totalApplicants: 1 * applicants: * - applicationId: 1 @@ -611,6 +613,7 @@ export class ApplicationsController { * startTime: "1970-01-01T01:30:00.000Z" * endTime: "1970-01-01T03:00:00.000Z" * addressText: "서울시 동대문구 한교동" + * rewardTokens: 9 * requester: * id: 5 * nickname: "김엄마" diff --git a/src/applications/applications.repository.js b/src/applications/applications.repository.js index d010ad4..2d7f603 100644 --- a/src/applications/applications.repository.js +++ b/src/applications/applications.repository.js @@ -28,6 +28,7 @@ export class ApplicationsRepository { startTime: true, endTime: true, addressText: true, + rewardTokens: true, }, }); } @@ -218,6 +219,7 @@ export class ApplicationsRepository { startTime: true, endTime: true, addressText: true, + rewardTokens: true, requester: { select: { id: true, diff --git a/src/applications/dto/applications.response.dto.js b/src/applications/dto/applications.response.dto.js index f53f8f7..492efaf 100644 --- a/src/applications/dto/applications.response.dto.js +++ b/src/applications/dto/applications.response.dto.js @@ -36,6 +36,7 @@ export class ApplyListResponseDto { startTime: help.startTime, endTime: help.endTime, addressText: help.addressText, + rewardTokens: help.rewardTokens, }; // 전체 지원자 수 (페이지네이션 적용 전 총합) @@ -106,6 +107,7 @@ export class MyApplicationItemDto { startTime: app.helpRequest.startTime, endTime: app.helpRequest.endTime, addressText: app.helpRequest.addressText, + rewardTokens: app.helpRequest.rewardTokens, requester: { id: app.helpRequest.requester.id, nickname: app.helpRequest.requester.nickname, From ac2229d9de679abca26923bf1dccaeeacb51b570 Mon Sep 17 00:00:00 2001 From: rimit-rim Date: Fri, 12 Sep 2025 00:56:53 +0900 Subject: [PATCH 6/7] =?UTF-8?q?:recycle:Refactor:=20=EC=8A=A4=EC=9B=A8?= =?UTF-8?q?=EA=B1=B0=20=EC=9D=BC=EB=B6=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/helps/helps.controller.js | 44 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/helps/helps.controller.js b/src/helps/helps.controller.js index 155701d..ef2fd81 100644 --- a/src/helps/helps.controller.js +++ b/src/helps/helps.controller.js @@ -55,7 +55,7 @@ export class HelpsController { * format: binary * description: "첨부 이미지 (선택사항)" * responses: - * 200: + * 201: * description: 돌봄요청 작성 성공 * content: * application/json: @@ -69,7 +69,7 @@ export class HelpsController { * type: object * nullable: true * example: null - * data: + * success: * type: object * properties: * message: @@ -95,8 +95,8 @@ export class HelpsController { * type: string * example: "서비스 날짜는 오늘 또는 이후여야 합니다." * data: - * type: object * nullable: true + * example: null * success: * nullable: true * example: null @@ -120,8 +120,8 @@ export class HelpsController { * type: string * example: "로그인이 필요합니다." * data: - * type: object * nullable: true + * example: null * success: * nullable: true * example: null @@ -145,8 +145,8 @@ export class HelpsController { * type: string * example: "돌봄요청 생성 중 오류가 발생했습니다." * data: - * type: object * nullable: true + * example: null * success: * nullable: true * example: null @@ -301,8 +301,8 @@ export class HelpsController { * type: string * example: "로그인이 필요합니다." * data: - * type: object * nullable: true + * example: null * success: * nullable: true * example: null @@ -326,8 +326,8 @@ export class HelpsController { * type: string * example: "해당 돌봄요청을 찾을 수 없습니다." * data: - * type: object * nullable: true + * example: null * success: * nullable: true * example: null @@ -451,8 +451,8 @@ export class HelpsController { * type: string * example: "서비스 날짜는 오늘 또는 이후여야 합니다." * data: - * type: object * nullable: true + * example: null * success: * nullable: true * example: null @@ -476,8 +476,8 @@ export class HelpsController { * type: string * example: "로그인이 필요합니다." * data: - * type: object * nullable: true + * example: null * success: * nullable: true * example: null @@ -501,8 +501,8 @@ export class HelpsController { * type: string * example: "자신의 돌봄요청만 수정할 수 있습니다." * data: - * type: object * nullable: true + * example: null * success: * nullable: true * example: null @@ -526,8 +526,8 @@ export class HelpsController { * type: string * example: "해당 돌봄요청을 찾을 수 없습니다." * data: - * type: object * nullable: true + * example: null * success: * nullable: true * example: null @@ -551,8 +551,8 @@ export class HelpsController { * type: string * example: "돌봄요청 수정 중 오류가 발생했습니다." * data: - * type: object * nullable: true + * example: null * success: * nullable: true * example: null @@ -644,8 +644,8 @@ export class HelpsController { * type: string * example: "완료된 돌봄요청은 삭제할 수 없습니다." * data: - * type: object * nullable: true + * example: null * success: * nullable: true * example: null @@ -669,8 +669,8 @@ export class HelpsController { * type: string * example: "로그인이 필요합니다." * data: - * type: object * nullable: true + * example: null * success: * nullable: true * example: null @@ -694,8 +694,8 @@ export class HelpsController { * type: string * example: "자신의 돌봄요청만 삭제할 수 있습니다." * data: - * type: object * nullable: true + * example: null * success: * nullable: true * example: null @@ -719,8 +719,8 @@ export class HelpsController { * type: string * example: "해당 돌봄요청을 찾을 수 없습니다." * data: - * type: object * nullable: true + * example: null * success: * nullable: true * example: null @@ -744,8 +744,8 @@ export class HelpsController { * type: string * example: "돌봄요청 삭제 중 오류가 발생했습니다." * data: - * type: object * nullable: true + * example: null * success: * nullable: true * example: null @@ -873,8 +873,8 @@ export class HelpsController { * type: string * example: "돌봄요청 조회 중 오류가 발생했습니다." * data: - * type: object - * example: {} + * nullable: true + * example: null * success: * nullable: true * example: null @@ -1047,8 +1047,8 @@ export class HelpsController { * type: string * example: "로그인이 필요합니다." * data: - * type: object * nullable: true + * example: null * success: * nullable: true * example: null @@ -1072,8 +1072,8 @@ export class HelpsController { * type: string * example: "내 돌봄요청 조회 중 오류가 발생했습니다." * data: - * type: object * nullable: true + * example: null * success: * nullable: true * example: null @@ -1215,8 +1215,8 @@ export class HelpsController { * type: string * example: "로그인이 필요합니다." * data: - * type: object * nullable: true + * example: null * success: * nullable: true * example: null From 3699a4e7a5432cc96f0dc2e13d38134bea27f4a0 Mon Sep 17 00:00:00 2001 From: rimit-rim Date: Fri, 12 Sep 2025 00:57:47 +0900 Subject: [PATCH 7/7] =?UTF-8?q?:recycle:Refactor:=20=EC=8A=A4=EC=9B=A8?= =?UTF-8?q?=EA=B1=B0=20=EC=9D=BC=EB=B6=80=20=EC=88=98=EC=A0=95=20(2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/helps/helps.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helps/helps.controller.js b/src/helps/helps.controller.js index ef2fd81..a8d8944 100644 --- a/src/helps/helps.controller.js +++ b/src/helps/helps.controller.js @@ -69,7 +69,7 @@ export class HelpsController { * type: object * nullable: true * example: null - * success: + * data: * type: object * properties: * message: