Skip to content

Commit 8757c72

Browse files
committed
일정 기반 정산 상태 리스트 조회 시 표기 오류 수정
1 parent a12a8b1 commit 8757c72

3 files changed

Lines changed: 17 additions & 77 deletions

File tree

src/controller/user_alba_schedule_controller.ts

Lines changed: 7 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
Security,
1313
Query,
1414
Path,
15-
Get
15+
Get,
1616
} from 'tsoa';
1717
import { Request as ExpressRequest } from 'express';
1818
import { TsoaSuccessResponse, TsoaFailResponse } from '../config/response_interface';
@@ -26,22 +26,10 @@ export interface CreateScheduleSuccess {
2626
user_alba_schedule_id: string;
2727
}
2828

29-
// export interface UpdateScheduleSuccess {
30-
// resultType: 'SUCCESS';
31-
// SuccessMessage: '유저 알바 스케줄 수정 성공';
32-
// user_alba_schedule_id: string;
33-
// }
34-
35-
// export interface DeleteScheduleSuccess {
36-
37-
// user_alba_schedule_id: string;
38-
// }
39-
4029
@Route('user/alba/schedule')
4130
@Tags('User Alba Schedule')
4231
export class UserAlbaScheduleController extends Controller {
43-
44-
/**
32+
/**
4533
* 내 유저 알바 스케줄 목록 조회 (커서/사이즈 없음)
4634
* 예) /user/alba/schedule?month=2026-02
4735
*/
@@ -69,50 +57,15 @@ export class UserAlbaScheduleController extends Controller {
6957
): Promise<TsoaSuccessResponse<any>> {
7058
const userUuid = (req as any).user?.id as string;
7159

72-
console.log("token userId =", userUuid);
73-
console.log("month =", month);
60+
console.log('token userId =', userUuid);
61+
console.log('month =', month);
7462

7563
const data = await userAlbaScheduleService.listMySchedules(userUuid, { month });
7664

7765
this.setStatus(200);
7866
return new TsoaSuccessResponse(data);
7967
}
8068

81-
/**
82-
* 내 유저 알바 스케줄 단건 조회(상세)
83-
*/
84-
// @Security('jwt')
85-
// @Get('{userAlbaScheduleId}')
86-
// @SuccessResponse(200, '유저 알바 스케줄 단건 조회 성공')
87-
// @Response<TsoaFailResponse<any>>(401, 'Unauthorized', {
88-
// resultType: 'FAIL' as any,
89-
// error: { errorCode: 'EC401', errorMessage: '인증이 필요합니다.', data: null },
90-
// success: null,
91-
// })
92-
// @Response<TsoaFailResponse<any>>(404, 'Not Found', {
93-
// resultType: 'FAIL' as any,
94-
// error: { errorCode: 'EC404', errorMessage: '스케줄을 찾을 수 없습니다.', data: null },
95-
// success: null,
96-
// })
97-
// @Response<TsoaFailResponse<any>>(500, 'Internal Server Error', {
98-
// resultType: 'FAIL' as any,
99-
// error: { errorCode: 'EC500', errorMessage: '서버 오류가 발생했습니다.', data: null },
100-
// success: null,
101-
// })
102-
// public async getMySchedule(
103-
// @Request() req: ExpressRequest,
104-
// @Path() userAlbaScheduleId: string,
105-
// ): Promise<TsoaSuccessResponse<any>> {
106-
// const userUuid = (req as any).user?.id as string;
107-
108-
// //const schedule = await userAlbaScheduleService.getMyScheduleById(userUuid, userAlbaScheduleId);
109-
110-
// this.setStatus(200);
111-
// // return new TsoaSuccessResponse(schedule);
112-
// }
113-
114-
115-
11669
/*
11770
* 유저 알바 스케줄 등록 API
11871
* @param request - Express 요청 객체
@@ -156,9 +109,9 @@ export class UserAlbaScheduleController extends Controller {
156109
void body;
157110

158111
this.setStatus(201);
159-
return new TsoaSuccessResponse({
160-
user_alba_schedule_id: id,
161-
});
112+
return new TsoaSuccessResponse({
113+
user_alba_schedule_id: id,
114+
});
162115
}
163116

164117
////// // 유저 알바 정보 기반 //////

src/repository/settlement_status_list_repository.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,25 @@ export class SettlementStatusListRepository {
7777
},
7878
},
7979
},
80+
// ✅ 추가: "유저 알바 일정"에서 채울 정보
81+
user_alba_schedule: {
82+
select: {
83+
workplace_name: true,
84+
hourly_wage: true,
85+
},
86+
},
8087
},
8188
});
8289

8390
const hasNext = logs.length > take;
8491
const pageLogs = hasNext ? logs.slice(0, take) : logs;
8592

8693
const items = pageLogs.map((log) => {
87-
const storeName = log.alba_posting?.store?.store_name ?? '';
94+
const storeName =
95+
log.alba_posting?.store?.store_name ?? log.user_alba_schedule?.workplace_name ?? '';
8896
const workMinutes = log.work_minutes ?? 0;
8997

90-
const hourlyRate = log.alba_posting?.hourly_rate ?? 0;
98+
const hourlyRate = log.alba_posting?.hourly_rate ?? log.user_alba_schedule?.hourly_wage ?? 0;
9199
// work_minutes*hourly_rate/60
92100
const expectedIncome = Math.floor((hourlyRate * workMinutes) / 60);
93101

src/service/user_alba_schedule_service.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ type RepeatBody = Pick<CreateManualScheduleBody, 'repeat_type' | 'repeat_days'>;
1616

1717
const YM = /^\d{4}-(0[1-9]|1[0-2])$/;
1818

19-
2019
function toDateString(d: Date): string {
2120
// DB Date -> "YYYY-MM-DD"
2221
const y = d.getFullYear();
@@ -165,26 +164,6 @@ export async function listMySchedules(userId: string, q: { month?: string }) {
165164
return { schedules };
166165
}
167166

168-
/** 단건 조회 */
169-
// export async function getMyScheduleById(userId: string, scheduleId: string) {
170-
// const s = await scheduleRepo.findDetailByIdAndUserId(userId, scheduleId);
171-
// if (!s) throw new CustomError('EC404', 404, '스케줄을 찾을 수 없습니다.', null);
172-
173-
// return {
174-
// user_alba_schedule_id: binToUuid(s.user_alba_schedule_id as unknown as Uint8Array),
175-
// workplace: s.workplace ?? null,
176-
// work_date: s.work_date ?? null,
177-
// work_time: s.work_time ?? null,
178-
// workplace_name: s.workplace_name ?? null,
179-
// workplace_color: s.workplace_color ?? null,
180-
// day_of_week: s.day_of_week ?? null,
181-
// repeat_type: s.repeat_type ?? null,
182-
// repeat_days: s.repeat_days ?? null,
183-
// hourly_wage: s.hourly_wage ?? null,
184-
// memo: s.memo ?? null,
185-
// };
186-
// }
187-
188167
// 유저 수동 입력 스케줄 생성
189168
export async function createManual(
190169
userId: string,

0 commit comments

Comments
 (0)