Skip to content

Commit

Permalink
api定義修正
Browse files Browse the repository at this point in the history
  • Loading branch information
Kubosaka committed Jan 21, 2025
1 parent dfa07a9 commit b1ae1a2
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
22 changes: 11 additions & 11 deletions api/generated/openapi_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -684,10 +684,9 @@ paths:
required:
- file
- buy_report
required: true
responses:
"200":
description: 作成されたbuyReportが返ってくる
description: 作成されたbuy_reportが返ってくる
content:
application/json:
schema:
Expand Down Expand Up @@ -745,11 +744,11 @@ paths:
application/json:
schema:
type: object
/buy_reports/list:
/buy_reports/details:
get:
tags:
- buy_report
description: 購入報告で表示するbuyReport一覧の取得、主に財務向けのページ
description: 購入報告で表示するbuy_report一覧の取得、主に財務向けのページ
parameters:
- name: year
in: query
Expand Down Expand Up @@ -2605,7 +2604,7 @@ components:
description: マイページで表示する購入報告の情報
type: object
properties:
ID:
id:
type: integer
example: 1
buyReportName:
Expand All @@ -2627,7 +2626,7 @@ components:
description: 購入報告ページで表示する詳細情報
type: object
properties:
ID:
id:
type: integer
example: 1
financialRecordName:
Expand Down
28 changes: 14 additions & 14 deletions view/next-project/src/generated/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ import type {
GetBudgetsIdDetails200,
GetBureaus200,
GetBureausId200,
GetBuyReportsListParams,
GetBuyReportsDetailsParams,
GetDepartments200,
GetDepartmentsId200,
GetExpenses200,
Expand Down Expand Up @@ -2127,15 +2127,15 @@ export const useDeleteBuyReportsId = <TError = unknown>(
}

/**
* 購入報告で表示するbuyReport一覧の取得、主に財務向けのページ
* 購入報告で表示するbuy_report一覧の取得、主に財務向けのページ
*/
export type getBuyReportsListResponse = {
export type getBuyReportsDetailsResponse = {
data: BuyReportDetail[];
status: number;
headers: Headers;
}

export const getGetBuyReportsListUrl = (params?: GetBuyReportsListParams,) => {
export const getGetBuyReportsDetailsUrl = (params?: GetBuyReportsDetailsParams,) => {
const normalizedParams = new URLSearchParams();

Object.entries(params || {}).forEach(([key, value]) => {
Expand All @@ -2145,12 +2145,12 @@ export const getGetBuyReportsListUrl = (params?: GetBuyReportsListParams,) => {
}
});

return normalizedParams.size ? `/buy_reports/list?${normalizedParams.toString()}` : `/buy_reports/list`
return normalizedParams.size ? `/buy_reports/details?${normalizedParams.toString()}` : `/buy_reports/details`
}

export const getBuyReportsList = async (params?: GetBuyReportsListParams, options?: RequestInit): Promise<getBuyReportsListResponse> => {
export const getBuyReportsDetails = async (params?: GetBuyReportsDetailsParams, options?: RequestInit): Promise<getBuyReportsDetailsResponse> => {

return customFetch<Promise<getBuyReportsListResponse>>(getGetBuyReportsListUrl(params),
return customFetch<Promise<getBuyReportsDetailsResponse>>(getGetBuyReportsDetailsUrl(params),
{
...options,
method: 'GET'
Expand All @@ -2162,19 +2162,19 @@ export const getBuyReportsList = async (params?: GetBuyReportsListParams, option



export const getGetBuyReportsListKey = (params?: GetBuyReportsListParams,) => [`/buy_reports/list`, ...(params ? [params]: [])] as const;
export const getGetBuyReportsDetailsKey = (params?: GetBuyReportsDetailsParams,) => [`/buy_reports/details`, ...(params ? [params]: [])] as const;

export type GetBuyReportsListQueryResult = NonNullable<Awaited<ReturnType<typeof getBuyReportsList>>>
export type GetBuyReportsListQueryError = unknown
export type GetBuyReportsDetailsQueryResult = NonNullable<Awaited<ReturnType<typeof getBuyReportsDetails>>>
export type GetBuyReportsDetailsQueryError = unknown

export const useGetBuyReportsList = <TError = unknown>(
params?: GetBuyReportsListParams, options?: { swr?:SWRConfiguration<Awaited<ReturnType<typeof getBuyReportsList>>, TError> & { swrKey?: Key, enabled?: boolean }, request?: SecondParameter<typeof customFetch> }
export const useGetBuyReportsDetails = <TError = unknown>(
params?: GetBuyReportsDetailsParams, options?: { swr?:SWRConfiguration<Awaited<ReturnType<typeof getBuyReportsDetails>>, TError> & { swrKey?: Key, enabled?: boolean }, request?: SecondParameter<typeof customFetch> }
) => {
const {swr: swrOptions, request: requestOptions} = options ?? {}

const isEnabled = swrOptions?.enabled !== false
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getGetBuyReportsListKey(params) : null);
const swrFn = () => getBuyReportsList(params, requestOptions)
const swrKey = swrOptions?.swrKey ?? (() => isEnabled ? getGetBuyReportsDetailsKey(params) : null);
const swrFn = () => getBuyReportsDetails(params, requestOptions)

const query = useSwr<Awaited<ReturnType<typeof swrFn>>, TError>(swrKey, swrFn, swrOptions)

Expand Down
1 change: 1 addition & 0 deletions view/next-project/src/generated/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export * from './getBudgetsId200';
export * from './getBudgetsIdDetails200';
export * from './getBureaus200';
export * from './getBureausId200';
export * from './getBuyReportsDetailsParams';
export * from './getBuyReportsListParams';
export * from './getDepartments200';
export * from './getDepartmentsId200';
Expand Down

0 comments on commit b1ae1a2

Please sign in to comment.