Skip to content

Commit 41046ef

Browse files
committed
feat: 개강 전 QA 결과 반영
1 parent bc11080 commit 41046ef

12 files changed

Lines changed: 469 additions & 8 deletions

‎src/api-client/index.ts‎

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import type {
5757
GetItemsParams,
5858
GetMemberRentalHistoryParams,
5959
GetSchedulesParams,
60+
ItemCodeUpdateRequest,
6061
ItemDetail,
6162
ItemFindAllResponse,
6263
MemberFCMTokenRequest,
@@ -69,6 +70,7 @@ import type {
6970
RentalHistoryFindAllResponse,
7071
RentalHistoryRequest,
7172
RentalStatusUpdateRequest,
73+
RentalStatusWorkerLogFindAllResponse,
7274
ReturnRequiredItemFindAllResponse,
7375
SearchItemsParams,
7476
SignUpRequest,
@@ -2801,6 +2803,72 @@ export const useUpdateRentalStatus = <TError = unknown,
28012803
return useMutation(mutationOptions , queryClient);
28022804
}
28032805

2806+
/**
2807+
* 대여 기록의 물품 코드를 수정하는 관리자용 API
2808+
* @summary 물품 코드 수정
2809+
*/
2810+
export const updateItemCode = (
2811+
rentalHistoryId: number,
2812+
itemCodeUpdateRequest: ItemCodeUpdateRequest,
2813+
) => {
2814+
2815+
2816+
return customMutator<void>(
2817+
{url: `/admin/rentals/${rentalHistoryId}/item-code`, method: 'PATCH',
2818+
headers: {'Content-Type': 'application/json', },
2819+
data: itemCodeUpdateRequest
2820+
},
2821+
);
2822+
}
2823+
2824+
2825+
2826+
export const getUpdateItemCodeMutationOptions = <TError = unknown,
2827+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateItemCode>>, TError,{rentalHistoryId: number;data: ItemCodeUpdateRequest}, TContext>, }
2828+
): UseMutationOptions<Awaited<ReturnType<typeof updateItemCode>>, TError,{rentalHistoryId: number;data: ItemCodeUpdateRequest}, TContext> => {
2829+
2830+
const mutationKey = ['updateItemCode'];
2831+
const {mutation: mutationOptions} = options ?
2832+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
2833+
options
2834+
: {...options, mutation: {...options.mutation, mutationKey}}
2835+
: {mutation: { mutationKey, }};
2836+
2837+
2838+
2839+
2840+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof updateItemCode>>, {rentalHistoryId: number;data: ItemCodeUpdateRequest}> = (props) => {
2841+
const {rentalHistoryId,data} = props ?? {};
2842+
2843+
return updateItemCode(rentalHistoryId,data,)
2844+
}
2845+
2846+
2847+
2848+
2849+
return { mutationFn, ...mutationOptions }}
2850+
2851+
export type UpdateItemCodeMutationResult = NonNullable<Awaited<ReturnType<typeof updateItemCode>>>
2852+
export type UpdateItemCodeMutationBody = ItemCodeUpdateRequest
2853+
export type UpdateItemCodeMutationError = unknown
2854+
2855+
/**
2856+
* @summary 물품 코드 수정
2857+
*/
2858+
export const useUpdateItemCode = <TError = unknown,
2859+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateItemCode>>, TError,{rentalHistoryId: number;data: ItemCodeUpdateRequest}, TContext>, }
2860+
, queryClient?: QueryClient): UseMutationResult<
2861+
Awaited<ReturnType<typeof updateItemCode>>,
2862+
TError,
2863+
{rentalHistoryId: number;data: ItemCodeUpdateRequest},
2864+
TContext
2865+
> => {
2866+
2867+
const mutationOptions = getUpdateItemCodeMutationOptions(options);
2868+
2869+
return useMutation(mutationOptions , queryClient);
2870+
}
2871+
28042872
/**
28052873
* 관리자의 역할을 변경하는 API
28062874
* @summary 관리자 역할 변경
@@ -3378,6 +3446,95 @@ export function useGetDisplay<TData = Awaited<ReturnType<typeof getDisplay>>, TE
33783446

33793447

33803448

3449+
/**
3450+
* 대여 기록의 상태별 처리자 로그를 조회하는 관리자용 API
3451+
* @summary 대여 상태 변경 처리자 로그 조회
3452+
*/
3453+
export const getWorkerLogs = (
3454+
rentalHistoryId: number,
3455+
signal?: AbortSignal
3456+
) => {
3457+
3458+
3459+
return customMutator<RentalStatusWorkerLogFindAllResponse>(
3460+
{url: `/admin/rentals/${rentalHistoryId}/workers`, method: 'GET', signal
3461+
},
3462+
);
3463+
}
3464+
3465+
3466+
export const getGetWorkerLogsQueryKey = (rentalHistoryId: number,) => {
3467+
return [`/admin/rentals/${rentalHistoryId}/workers`] as const;
3468+
}
3469+
3470+
3471+
export const getGetWorkerLogsQueryOptions = <TData = Awaited<ReturnType<typeof getWorkerLogs>>, TError = unknown>(rentalHistoryId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getWorkerLogs>>, TError, TData>>, }
3472+
) => {
3473+
3474+
const {query: queryOptions} = options ?? {};
3475+
3476+
const queryKey = queryOptions?.queryKey ?? getGetWorkerLogsQueryKey(rentalHistoryId);
3477+
3478+
3479+
3480+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getWorkerLogs>>> = ({ signal }) => getWorkerLogs(rentalHistoryId, signal);
3481+
3482+
3483+
3484+
3485+
3486+
return { queryKey, queryFn, enabled: !!(rentalHistoryId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getWorkerLogs>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
3487+
}
3488+
3489+
export type GetWorkerLogsQueryResult = NonNullable<Awaited<ReturnType<typeof getWorkerLogs>>>
3490+
export type GetWorkerLogsQueryError = unknown
3491+
3492+
3493+
export function useGetWorkerLogs<TData = Awaited<ReturnType<typeof getWorkerLogs>>, TError = unknown>(
3494+
rentalHistoryId: number, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getWorkerLogs>>, TError, TData>> & Pick<
3495+
DefinedInitialDataOptions<
3496+
Awaited<ReturnType<typeof getWorkerLogs>>,
3497+
TError,
3498+
Awaited<ReturnType<typeof getWorkerLogs>>
3499+
> , 'initialData'
3500+
>, }
3501+
, queryClient?: QueryClient
3502+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
3503+
export function useGetWorkerLogs<TData = Awaited<ReturnType<typeof getWorkerLogs>>, TError = unknown>(
3504+
rentalHistoryId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getWorkerLogs>>, TError, TData>> & Pick<
3505+
UndefinedInitialDataOptions<
3506+
Awaited<ReturnType<typeof getWorkerLogs>>,
3507+
TError,
3508+
Awaited<ReturnType<typeof getWorkerLogs>>
3509+
> , 'initialData'
3510+
>, }
3511+
, queryClient?: QueryClient
3512+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
3513+
export function useGetWorkerLogs<TData = Awaited<ReturnType<typeof getWorkerLogs>>, TError = unknown>(
3514+
rentalHistoryId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getWorkerLogs>>, TError, TData>>, }
3515+
, queryClient?: QueryClient
3516+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
3517+
/**
3518+
* @summary 대여 상태 변경 처리자 로그 조회
3519+
*/
3520+
3521+
export function useGetWorkerLogs<TData = Awaited<ReturnType<typeof getWorkerLogs>>, TError = unknown>(
3522+
rentalHistoryId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getWorkerLogs>>, TError, TData>>, }
3523+
, queryClient?: QueryClient
3524+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
3525+
3526+
const queryOptions = getGetWorkerLogsQueryOptions(rentalHistoryId,options)
3527+
3528+
const query = useQuery(queryOptions , queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
3529+
3530+
query.queryKey = queryOptions.queryKey ;
3531+
3532+
return query;
3533+
}
3534+
3535+
3536+
3537+
33813538
/**
33823539
* 관리자 대시보드 페이지 조회를 위한 API
33833540
* @summary 관리자 대시보드 목록 조회

‎src/api-client/model/adminRentalHistoryDetail.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ export interface AdminRentalHistoryDetail {
1515
rentAt: string;
1616
returnedAt?: string;
1717
rentalStatus: AdminRentalHistoryDetailRentalStatus;
18+
itemCode?: string;
1819
}

‎src/api-client/model/adminRentalHistoryRequest.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ export interface AdminRentalHistoryRequest {
1919
count: number;
2020
/** 대여 시작 시간 정보 */
2121
rentalTime: RentalTime;
22+
/** 근무자 ID */
23+
workerId: number;
2224
}

‎src/api-client/model/index.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export * from './getItemsParams';
5353
export * from './getMemberRentalHistoryParams';
5454
export * from './getMemberRentalHistoryRentalStatus';
5555
export * from './getSchedulesParams';
56+
export * from './itemCodeUpdateRequest';
5657
export * from './itemDetail';
5758
export * from './itemDetailItemType';
5859
export * from './itemFindAllResponse';
@@ -82,6 +83,9 @@ export * from './rentalHistoryFindAllResponse';
8283
export * from './rentalHistoryRequest';
8384
export * from './rentalStatusUpdateRequest';
8485
export * from './rentalStatusUpdateRequestRentalStatus';
86+
export * from './rentalStatusWorkerLogDetail';
87+
export * from './rentalStatusWorkerLogDetailRentalStatus';
88+
export * from './rentalStatusWorkerLogFindAllResponse';
8589
export * from './rentalTime';
8690
export * from './returnRequiredItemDetail';
8791
export * from './returnRequiredItemFindAllResponse';
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Generated by orval v7.9.0 🍺
3+
* Do not edit manually.
4+
* 빌릴게(Billilge) API
5+
* 국민대학교 소프트웨어융합대학 복지물품 대여 서비스
6+
* OpenAPI spec version: v1
7+
*/
8+
9+
export interface ItemCodeUpdateRequest {
10+
/** 물품 코드 */
11+
itemCode: string;
12+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Generated by orval v7.9.0 🍺
3+
* Do not edit manually.
4+
* 빌릴게(Billilge) API
5+
* 국민대학교 소프트웨어융합대학 복지물품 대여 서비스
6+
* OpenAPI spec version: v1
7+
*/
8+
import type { RentalStatusWorkerLogDetailRentalStatus } from './rentalStatusWorkerLogDetailRentalStatus';
9+
import type { MemberSummary } from './memberSummary';
10+
11+
export interface RentalStatusWorkerLogDetail {
12+
/** 대여 상태 */
13+
rentalStatus: RentalStatusWorkerLogDetailRentalStatus;
14+
/** 처리자 정보 */
15+
worker?: MemberSummary;
16+
/** 상태 변경 시각 */
17+
createdAt: string;
18+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Generated by orval v7.9.0 🍺
3+
* Do not edit manually.
4+
* 빌릴게(Billilge) API
5+
* 국민대학교 소프트웨어융합대학 복지물품 대여 서비스
6+
* OpenAPI spec version: v1
7+
*/
8+
9+
/**
10+
* 대여 상태
11+
*/
12+
export type RentalStatusWorkerLogDetailRentalStatus = typeof RentalStatusWorkerLogDetailRentalStatus[keyof typeof RentalStatusWorkerLogDetailRentalStatus];
13+
14+
15+
// eslint-disable-next-line @typescript-eslint/no-redeclare
16+
export const RentalStatusWorkerLogDetailRentalStatus = {
17+
PENDING: 'PENDING',
18+
CANCEL: 'CANCEL',
19+
CONFIRMED: 'CONFIRMED',
20+
REJECTED: 'REJECTED',
21+
RENTAL: 'RENTAL',
22+
RETURN_PENDING: 'RETURN_PENDING',
23+
RETURN_CONFIRMED: 'RETURN_CONFIRMED',
24+
RETURNED: 'RETURNED',
25+
} as const;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Generated by orval v7.9.0 🍺
3+
* Do not edit manually.
4+
* 빌릴게(Billilge) API
5+
* 국민대학교 소프트웨어융합대학 복지물품 대여 서비스
6+
* OpenAPI spec version: v1
7+
*/
8+
import type { RentalStatusWorkerLogDetail } from './rentalStatusWorkerLogDetail';
9+
10+
export interface RentalStatusWorkerLogFindAllResponse {
11+
workers: RentalStatusWorkerLogDetail[];
12+
}

0 commit comments

Comments
 (0)