Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VCCI-News
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Văn Hoàng
VCCI-News
Commits
1334e92b
Commit
1334e92b
authored
May 20, 2026
by
Lê Bảo Hồng Đức
☄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
d9a52db6
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1018 additions
and
1 deletion
+1018
-1
orval.config.ts
orval.config.ts
+1
-0
banner.ts
src/api/endpoints/banner.ts
+759
-0
deleteBannerId200.ts
src/api/models/deleteBannerId200.ts
+11
-0
deleteBannerId200AllOf.ts
src/api/models/deleteBannerId200AllOf.ts
+11
-0
getBannerId200.ts
src/api/models/getBannerId200.ts
+11
-0
getBannerId200AllOf.ts
src/api/models/getBannerId200AllOf.ts
+12
-0
getBannerParams.ts
src/api/models/getBannerParams.ts
+37
-0
index.ts
src/api/models/index.ts
+9
-0
postBanner200.ts
src/api/models/postBanner200.ts
+11
-0
postBanner200AllOf.ts
src/api/models/postBanner200AllOf.ts
+12
-0
putBannerId200.ts
src/api/models/putBannerId200.ts
+11
-0
putBannerId200AllOf.ts
src/api/models/putBannerId200AllOf.ts
+12
-0
page.tsx
src/app/admin/base-config/page.tsx
+121
-1
No files found.
orval.config.ts
View file @
1334e92b
...
@@ -127,6 +127,7 @@ const orvalConfig = async () => {
...
@@ -127,6 +127,7 @@ const orvalConfig = async () => {
'NewsletterSubscription'
,
'NewsletterSubscription'
,
'SiteInformation'
,
'SiteInformation'
,
'Logo'
,
'Logo'
,
'Banner'
,
],
],
},
},
},
},
...
...
src/api/endpoints/banner.ts
0 → 100644
View file @
1334e92b
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import
{
useInfiniteQuery
,
useMutation
,
useQuery
}
from
'@tanstack/react-query'
;
import
type
{
DataTag
,
DefinedInitialDataOptions
,
DefinedUseInfiniteQueryResult
,
DefinedUseQueryResult
,
InfiniteData
,
MutationFunction
,
QueryClient
,
QueryFunction
,
QueryKey
,
UndefinedInitialDataOptions
,
UseInfiniteQueryOptions
,
UseInfiniteQueryResult
,
UseMutationOptions
,
UseMutationResult
,
UseQueryOptions
,
UseQueryResult
}
from
'@tanstack/react-query'
;
import
type
{
BannerMutate
,
DeleteBannerId200
,
GetBannerId200
,
GetBannerParams
,
PostBanner200
,
PutBannerId200
,
ResponseGetAllData
}
from
'../models'
;
import
{
useCustomClient
}
from
'../mutator/custom-client'
;
import
type
{
ErrorType
,
BodyType
}
from
'../mutator/custom-client'
;
type
SecondParameter
<
T
extends
(...
args
:
never
)
=>
unknown
>
=
Parameters
<
T
>
[
1
];
/**
* Retrieve a single banner record by its ID
* @summary Get banner by ID
*/
export
type
getBannerIdResponse200
=
{
data
:
GetBannerId200
status
:
200
}
export
type
getBannerIdResponse404
=
{
data
:
void
status
:
404
}
export
type
getBannerIdResponseSuccess
=
(
getBannerIdResponse200
)
&
{
headers
:
Headers
;
};
export
type
getBannerIdResponseError
=
(
getBannerIdResponse404
)
&
{
headers
:
Headers
;
};
export
type
getBannerIdResponse
=
(
getBannerIdResponseSuccess
|
getBannerIdResponseError
)
export
const
getGetBannerIdUrl
=
(
id
:
string
,)
=>
{
return
`/banner/
${
id
}
`
}
export
const
getBannerId
=
async
(
id
:
string
,
options
?:
RequestInit
):
Promise
<
getBannerIdResponse
>
=>
{
return
useCustomClient
<
getBannerIdResponse
>
(
getGetBannerIdUrl
(
id
),
{
...
options
,
method
:
'GET'
}
);}
export
const
getGetBannerIdInfiniteQueryKey
=
(
id
?:
string
,)
=>
{
return
[
'infinite'
,
`/banner/
${
id
}
`
]
as
const
;
}
export
const
getGetBannerIdQueryKey
=
(
id
?:
string
,)
=>
{
return
[
`/banner/
${
id
}
`
]
as
const
;
}
export
const
getGetBannerIdInfiniteQueryOptions
=
<
TData
=
InfiniteData
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>>
,
TError
=
ErrorType
<
void
>>
(
id
:
string
,
options
?:
{
query
?:
Partial
<
UseInfiniteQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
,
TData
>>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
)
=>
{
const
{
query
:
queryOptions
,
request
:
requestOptions
}
=
options
??
{};
const
queryKey
=
queryOptions
?.
queryKey
??
getGetBannerIdInfiniteQueryKey
(
id
);
const
queryFn
:
QueryFunction
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>>
=
({
signal
})
=>
getBannerId
(
id
,
{
signal
,
...
requestOptions
});
return
{
queryKey
,
queryFn
,
enabled
:
!!
(
id
),
retry
:
3
,
retryDelay
:
1000
,
...
queryOptions
}
as
UseInfiniteQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
,
TData
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
}
export
type
GetBannerIdInfiniteQueryResult
=
NonNullable
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>>
export
type
GetBannerIdInfiniteQueryError
=
ErrorType
<
void
>
export
function
useGetBannerIdInfinite
<
TData
=
InfiniteData
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>>
,
TError
=
ErrorType
<
void
>>
(
id
:
string
,
options
:
{
query
:
Partial
<
UseInfiniteQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
,
TData
>>
&
Pick
<
DefinedInitialDataOptions
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
,
Awaited
<
ReturnType
<
typeof
getBannerId
>>
>
,
'initialData'
>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
DefinedUseInfiniteQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
export
function
useGetBannerIdInfinite
<
TData
=
InfiniteData
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>>
,
TError
=
ErrorType
<
void
>>
(
id
:
string
,
options
?:
{
query
?:
Partial
<
UseInfiniteQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
,
TData
>>
&
Pick
<
UndefinedInitialDataOptions
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
,
Awaited
<
ReturnType
<
typeof
getBannerId
>>
>
,
'initialData'
>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
UseInfiniteQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
export
function
useGetBannerIdInfinite
<
TData
=
InfiniteData
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>>
,
TError
=
ErrorType
<
void
>>
(
id
:
string
,
options
?:
{
query
?:
Partial
<
UseInfiniteQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
,
TData
>>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
UseInfiniteQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
/**
* @summary Get banner by ID
*/
export
function
useGetBannerIdInfinite
<
TData
=
InfiniteData
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>>
,
TError
=
ErrorType
<
void
>>
(
id
:
string
,
options
?:
{
query
?:
Partial
<
UseInfiniteQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
,
TData
>>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
UseInfiniteQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
{
const
queryOptions
=
getGetBannerIdInfiniteQueryOptions
(
id
,
options
)
const
query
=
useInfiniteQuery
(
queryOptions
,
queryClient
)
as
UseInfiniteQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
};
query
.
queryKey
=
queryOptions
.
queryKey
;
return
query
;
}
/**
* @summary Get banner by ID
*/
export
const
prefetchGetBannerIdInfiniteQuery
=
async
<
TData
=
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
=
ErrorType
<
void
>>
(
queryClient
:
QueryClient
,
id
:
string
,
options
?:
{
query
?:
Partial
<
UseInfiniteQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
,
TData
>>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
):
Promise
<
QueryClient
>
=>
{
const
queryOptions
=
getGetBannerIdInfiniteQueryOptions
(
id
,
options
)
await
queryClient
.
prefetchInfiniteQuery
(
queryOptions
);
return
queryClient
;
}
export
const
getGetBannerIdQueryOptions
=
<
TData
=
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
=
ErrorType
<
void
>>
(
id
:
string
,
options
?:
{
query
?:
Partial
<
UseQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
,
TData
>>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
)
=>
{
const
{
query
:
queryOptions
,
request
:
requestOptions
}
=
options
??
{};
const
queryKey
=
queryOptions
?.
queryKey
??
getGetBannerIdQueryKey
(
id
);
const
queryFn
:
QueryFunction
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>>
=
({
signal
})
=>
getBannerId
(
id
,
{
signal
,
...
requestOptions
});
return
{
queryKey
,
queryFn
,
enabled
:
!!
(
id
),
retry
:
3
,
retryDelay
:
1000
,
...
queryOptions
}
as
UseQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
,
TData
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
}
export
type
GetBannerIdQueryResult
=
NonNullable
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>>
export
type
GetBannerIdQueryError
=
ErrorType
<
void
>
export
function
useGetBannerId
<
TData
=
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
=
ErrorType
<
void
>>
(
id
:
string
,
options
:
{
query
:
Partial
<
UseQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
,
TData
>>
&
Pick
<
DefinedInitialDataOptions
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
,
Awaited
<
ReturnType
<
typeof
getBannerId
>>
>
,
'initialData'
>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
DefinedUseQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
export
function
useGetBannerId
<
TData
=
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
=
ErrorType
<
void
>>
(
id
:
string
,
options
?:
{
query
?:
Partial
<
UseQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
,
TData
>>
&
Pick
<
UndefinedInitialDataOptions
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
,
Awaited
<
ReturnType
<
typeof
getBannerId
>>
>
,
'initialData'
>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
UseQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
export
function
useGetBannerId
<
TData
=
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
=
ErrorType
<
void
>>
(
id
:
string
,
options
?:
{
query
?:
Partial
<
UseQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
,
TData
>>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
UseQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
/**
* @summary Get banner by ID
*/
export
function
useGetBannerId
<
TData
=
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
=
ErrorType
<
void
>>
(
id
:
string
,
options
?:
{
query
?:
Partial
<
UseQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
,
TData
>>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
UseQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
{
const
queryOptions
=
getGetBannerIdQueryOptions
(
id
,
options
)
const
query
=
useQuery
(
queryOptions
,
queryClient
)
as
UseQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
};
query
.
queryKey
=
queryOptions
.
queryKey
;
return
query
;
}
/**
* @summary Get banner by ID
*/
export
const
prefetchGetBannerIdQuery
=
async
<
TData
=
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
=
ErrorType
<
void
>>
(
queryClient
:
QueryClient
,
id
:
string
,
options
?:
{
query
?:
Partial
<
UseQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBannerId
>>
,
TError
,
TData
>>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
):
Promise
<
QueryClient
>
=>
{
const
queryOptions
=
getGetBannerIdQueryOptions
(
id
,
options
)
await
queryClient
.
prefetchQuery
(
queryOptions
);
return
queryClient
;
}
/**
* Update a single banner record by its ID
* @summary Update banner by ID
*/
export
type
putBannerIdResponse200
=
{
data
:
PutBannerId200
status
:
200
}
export
type
putBannerIdResponse404
=
{
data
:
void
status
:
404
}
export
type
putBannerIdResponseSuccess
=
(
putBannerIdResponse200
)
&
{
headers
:
Headers
;
};
export
type
putBannerIdResponseError
=
(
putBannerIdResponse404
)
&
{
headers
:
Headers
;
};
export
type
putBannerIdResponse
=
(
putBannerIdResponseSuccess
|
putBannerIdResponseError
)
export
const
getPutBannerIdUrl
=
(
id
:
string
,)
=>
{
return
`/banner/
${
id
}
`
}
export
const
putBannerId
=
async
(
id
:
string
,
bannerMutate
:
BannerMutate
,
options
?:
RequestInit
):
Promise
<
putBannerIdResponse
>
=>
{
return
useCustomClient
<
putBannerIdResponse
>
(
getPutBannerIdUrl
(
id
),
{
...
options
,
method
:
'PUT'
,
headers
:
{
'Content-Type'
:
'application/json'
,
...
options
?.
headers
},
body
:
JSON
.
stringify
(
bannerMutate
,)
}
);}
export
const
getPutBannerIdMutationOptions
=
<
TError
=
ErrorType
<
void
>
,
TContext
=
unknown
>
(
options
?:
{
mutation
?:
UseMutationOptions
<
Awaited
<
ReturnType
<
typeof
putBannerId
>>
,
TError
,{
id
:
string
;
data
:
BodyType
<
BannerMutate
>
},
TContext
>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
):
UseMutationOptions
<
Awaited
<
ReturnType
<
typeof
putBannerId
>>
,
TError
,{
id
:
string
;
data
:
BodyType
<
BannerMutate
>
},
TContext
>
=>
{
const
mutationKey
=
[
'putBannerId'
];
const
{
mutation
:
mutationOptions
,
request
:
requestOptions
}
=
options
?
options
.
mutation
&&
'mutationKey'
in
options
.
mutation
&&
options
.
mutation
.
mutationKey
?
options
:
{...
options
,
mutation
:
{...
options
.
mutation
,
mutationKey
}}
:
{
mutation
:
{
mutationKey
,
},
request
:
undefined
};
const
mutationFn
:
MutationFunction
<
Awaited
<
ReturnType
<
typeof
putBannerId
>>
,
{
id
:
string
;
data
:
BodyType
<
BannerMutate
>
}
>
=
(
props
)
=>
{
const
{
id
,
data
}
=
props
??
{};
return
putBannerId
(
id
,
data
,
requestOptions
)
}
return
{
mutationFn
,
...
mutationOptions
}}
export
type
PutBannerIdMutationResult
=
NonNullable
<
Awaited
<
ReturnType
<
typeof
putBannerId
>>>
export
type
PutBannerIdMutationBody
=
BodyType
<
BannerMutate
>
export
type
PutBannerIdMutationError
=
ErrorType
<
void
>
/**
* @summary Update banner by ID
*/
export
const
usePutBannerId
=
<
TError
=
ErrorType
<
void
>
,
TContext
=
unknown
>
(
options
?:
{
mutation
?:
UseMutationOptions
<
Awaited
<
ReturnType
<
typeof
putBannerId
>>
,
TError
,{
id
:
string
;
data
:
BodyType
<
BannerMutate
>
},
TContext
>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
UseMutationResult
<
Awaited
<
ReturnType
<
typeof
putBannerId
>>
,
TError
,
{
id
:
string
;
data
:
BodyType
<
BannerMutate
>
},
TContext
>
=>
{
const
mutationOptions
=
getPutBannerIdMutationOptions
(
options
);
return
useMutation
(
mutationOptions
,
queryClient
);
}
/**
* Delete a single banner record by its ID
* @summary Delete banner by ID
*/
export
type
deleteBannerIdResponse200
=
{
data
:
DeleteBannerId200
status
:
200
}
export
type
deleteBannerIdResponse404
=
{
data
:
void
status
:
404
}
export
type
deleteBannerIdResponseSuccess
=
(
deleteBannerIdResponse200
)
&
{
headers
:
Headers
;
};
export
type
deleteBannerIdResponseError
=
(
deleteBannerIdResponse404
)
&
{
headers
:
Headers
;
};
export
type
deleteBannerIdResponse
=
(
deleteBannerIdResponseSuccess
|
deleteBannerIdResponseError
)
export
const
getDeleteBannerIdUrl
=
(
id
:
string
,)
=>
{
return
`/banner/
${
id
}
`
}
export
const
deleteBannerId
=
async
(
id
:
string
,
options
?:
RequestInit
):
Promise
<
deleteBannerIdResponse
>
=>
{
return
useCustomClient
<
deleteBannerIdResponse
>
(
getDeleteBannerIdUrl
(
id
),
{
...
options
,
method
:
'DELETE'
}
);}
export
const
getDeleteBannerIdMutationOptions
=
<
TError
=
ErrorType
<
void
>
,
TContext
=
unknown
>
(
options
?:
{
mutation
?:
UseMutationOptions
<
Awaited
<
ReturnType
<
typeof
deleteBannerId
>>
,
TError
,{
id
:
string
},
TContext
>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
):
UseMutationOptions
<
Awaited
<
ReturnType
<
typeof
deleteBannerId
>>
,
TError
,{
id
:
string
},
TContext
>
=>
{
const
mutationKey
=
[
'deleteBannerId'
];
const
{
mutation
:
mutationOptions
,
request
:
requestOptions
}
=
options
?
options
.
mutation
&&
'mutationKey'
in
options
.
mutation
&&
options
.
mutation
.
mutationKey
?
options
:
{...
options
,
mutation
:
{...
options
.
mutation
,
mutationKey
}}
:
{
mutation
:
{
mutationKey
,
},
request
:
undefined
};
const
mutationFn
:
MutationFunction
<
Awaited
<
ReturnType
<
typeof
deleteBannerId
>>
,
{
id
:
string
}
>
=
(
props
)
=>
{
const
{
id
}
=
props
??
{};
return
deleteBannerId
(
id
,
requestOptions
)
}
return
{
mutationFn
,
...
mutationOptions
}}
export
type
DeleteBannerIdMutationResult
=
NonNullable
<
Awaited
<
ReturnType
<
typeof
deleteBannerId
>>>
export
type
DeleteBannerIdMutationError
=
ErrorType
<
void
>
/**
* @summary Delete banner by ID
*/
export
const
useDeleteBannerId
=
<
TError
=
ErrorType
<
void
>
,
TContext
=
unknown
>
(
options
?:
{
mutation
?:
UseMutationOptions
<
Awaited
<
ReturnType
<
typeof
deleteBannerId
>>
,
TError
,{
id
:
string
},
TContext
>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
UseMutationResult
<
Awaited
<
ReturnType
<
typeof
deleteBannerId
>>
,
TError
,
{
id
:
string
},
TContext
>
=>
{
const
mutationOptions
=
getDeleteBannerIdMutationOptions
(
options
);
return
useMutation
(
mutationOptions
,
queryClient
);
}
/**
* Retrieve a list of banner with pagination, filtering and sorting
* @summary Get all banner
*/
export
type
getBannerResponse200
=
{
data
:
ResponseGetAllData
status
:
200
}
export
type
getBannerResponseSuccess
=
(
getBannerResponse200
)
&
{
headers
:
Headers
;
};
;
export
type
getBannerResponse
=
(
getBannerResponseSuccess
)
export
const
getGetBannerUrl
=
(
params
?:
GetBannerParams
,)
=>
{
const
normalizedParams
=
new
URLSearchParams
();
Object
.
entries
(
params
||
{}).
forEach
(([
key
,
value
])
=>
{
if
(
value
!==
undefined
)
{
normalizedParams
.
append
(
key
,
value
===
null
?
'null'
:
value
.
toString
())
}
});
const
stringifiedParams
=
normalizedParams
.
toString
();
return
stringifiedParams
.
length
>
0
?
`/banner?
${
stringifiedParams
}
`
:
`/banner`
}
export
const
getBanner
=
async
(
params
?:
GetBannerParams
,
options
?:
RequestInit
):
Promise
<
getBannerResponse
>
=>
{
return
useCustomClient
<
getBannerResponse
>
(
getGetBannerUrl
(
params
),
{
...
options
,
method
:
'GET'
}
);}
export
const
getGetBannerInfiniteQueryKey
=
(
params
?:
GetBannerParams
,)
=>
{
return
[
'infinite'
,
`/banner`
,
...(
params
?
[
params
]:
[])
]
as
const
;
}
export
const
getGetBannerQueryKey
=
(
params
?:
GetBannerParams
,)
=>
{
return
[
`/banner`
,
...(
params
?
[
params
]:
[])
]
as
const
;
}
export
const
getGetBannerInfiniteQueryOptions
=
<
TData
=
InfiniteData
<
Awaited
<
ReturnType
<
typeof
getBanner
>>>
,
TError
=
ErrorType
<
unknown
>>
(
params
?:
GetBannerParams
,
options
?:
{
query
?:
Partial
<
UseInfiniteQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
,
TData
>>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
)
=>
{
const
{
query
:
queryOptions
,
request
:
requestOptions
}
=
options
??
{};
const
queryKey
=
queryOptions
?.
queryKey
??
getGetBannerInfiniteQueryKey
(
params
);
const
queryFn
:
QueryFunction
<
Awaited
<
ReturnType
<
typeof
getBanner
>>>
=
({
signal
})
=>
getBanner
(
params
,
{
signal
,
...
requestOptions
});
return
{
queryKey
,
queryFn
,
retry
:
3
,
retryDelay
:
1000
,
...
queryOptions
}
as
UseInfiniteQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
,
TData
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
}
export
type
GetBannerInfiniteQueryResult
=
NonNullable
<
Awaited
<
ReturnType
<
typeof
getBanner
>>>
export
type
GetBannerInfiniteQueryError
=
ErrorType
<
unknown
>
export
function
useGetBannerInfinite
<
TData
=
InfiniteData
<
Awaited
<
ReturnType
<
typeof
getBanner
>>>
,
TError
=
ErrorType
<
unknown
>>
(
params
:
undefined
|
GetBannerParams
,
options
:
{
query
:
Partial
<
UseInfiniteQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
,
TData
>>
&
Pick
<
DefinedInitialDataOptions
<
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
,
Awaited
<
ReturnType
<
typeof
getBanner
>>
>
,
'initialData'
>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
DefinedUseInfiniteQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
export
function
useGetBannerInfinite
<
TData
=
InfiniteData
<
Awaited
<
ReturnType
<
typeof
getBanner
>>>
,
TError
=
ErrorType
<
unknown
>>
(
params
?:
GetBannerParams
,
options
?:
{
query
?:
Partial
<
UseInfiniteQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
,
TData
>>
&
Pick
<
UndefinedInitialDataOptions
<
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
,
Awaited
<
ReturnType
<
typeof
getBanner
>>
>
,
'initialData'
>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
UseInfiniteQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
export
function
useGetBannerInfinite
<
TData
=
InfiniteData
<
Awaited
<
ReturnType
<
typeof
getBanner
>>>
,
TError
=
ErrorType
<
unknown
>>
(
params
?:
GetBannerParams
,
options
?:
{
query
?:
Partial
<
UseInfiniteQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
,
TData
>>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
UseInfiniteQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
/**
* @summary Get all banner
*/
export
function
useGetBannerInfinite
<
TData
=
InfiniteData
<
Awaited
<
ReturnType
<
typeof
getBanner
>>>
,
TError
=
ErrorType
<
unknown
>>
(
params
?:
GetBannerParams
,
options
?:
{
query
?:
Partial
<
UseInfiniteQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
,
TData
>>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
UseInfiniteQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
{
const
queryOptions
=
getGetBannerInfiniteQueryOptions
(
params
,
options
)
const
query
=
useInfiniteQuery
(
queryOptions
,
queryClient
)
as
UseInfiniteQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
};
query
.
queryKey
=
queryOptions
.
queryKey
;
return
query
;
}
/**
* @summary Get all banner
*/
export
const
prefetchGetBannerInfiniteQuery
=
async
<
TData
=
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
=
ErrorType
<
unknown
>>
(
queryClient
:
QueryClient
,
params
?:
GetBannerParams
,
options
?:
{
query
?:
Partial
<
UseInfiniteQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
,
TData
>>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
):
Promise
<
QueryClient
>
=>
{
const
queryOptions
=
getGetBannerInfiniteQueryOptions
(
params
,
options
)
await
queryClient
.
prefetchInfiniteQuery
(
queryOptions
);
return
queryClient
;
}
export
const
getGetBannerQueryOptions
=
<
TData
=
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
=
ErrorType
<
unknown
>>
(
params
?:
GetBannerParams
,
options
?:
{
query
?:
Partial
<
UseQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
,
TData
>>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
)
=>
{
const
{
query
:
queryOptions
,
request
:
requestOptions
}
=
options
??
{};
const
queryKey
=
queryOptions
?.
queryKey
??
getGetBannerQueryKey
(
params
);
const
queryFn
:
QueryFunction
<
Awaited
<
ReturnType
<
typeof
getBanner
>>>
=
({
signal
})
=>
getBanner
(
params
,
{
signal
,
...
requestOptions
});
return
{
queryKey
,
queryFn
,
retry
:
3
,
retryDelay
:
1000
,
...
queryOptions
}
as
UseQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
,
TData
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
}
export
type
GetBannerQueryResult
=
NonNullable
<
Awaited
<
ReturnType
<
typeof
getBanner
>>>
export
type
GetBannerQueryError
=
ErrorType
<
unknown
>
export
function
useGetBanner
<
TData
=
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
=
ErrorType
<
unknown
>>
(
params
:
undefined
|
GetBannerParams
,
options
:
{
query
:
Partial
<
UseQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
,
TData
>>
&
Pick
<
DefinedInitialDataOptions
<
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
,
Awaited
<
ReturnType
<
typeof
getBanner
>>
>
,
'initialData'
>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
DefinedUseQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
export
function
useGetBanner
<
TData
=
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
=
ErrorType
<
unknown
>>
(
params
?:
GetBannerParams
,
options
?:
{
query
?:
Partial
<
UseQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
,
TData
>>
&
Pick
<
UndefinedInitialDataOptions
<
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
,
Awaited
<
ReturnType
<
typeof
getBanner
>>
>
,
'initialData'
>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
UseQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
export
function
useGetBanner
<
TData
=
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
=
ErrorType
<
unknown
>>
(
params
?:
GetBannerParams
,
options
?:
{
query
?:
Partial
<
UseQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
,
TData
>>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
UseQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
/**
* @summary Get all banner
*/
export
function
useGetBanner
<
TData
=
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
=
ErrorType
<
unknown
>>
(
params
?:
GetBannerParams
,
options
?:
{
query
?:
Partial
<
UseQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
,
TData
>>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
UseQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
}
{
const
queryOptions
=
getGetBannerQueryOptions
(
params
,
options
)
const
query
=
useQuery
(
queryOptions
,
queryClient
)
as
UseQueryResult
<
TData
,
TError
>
&
{
queryKey
:
DataTag
<
QueryKey
,
TData
,
TError
>
};
query
.
queryKey
=
queryOptions
.
queryKey
;
return
query
;
}
/**
* @summary Get all banner
*/
export
const
prefetchGetBannerQuery
=
async
<
TData
=
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
=
ErrorType
<
unknown
>>
(
queryClient
:
QueryClient
,
params
?:
GetBannerParams
,
options
?:
{
query
?:
Partial
<
UseQueryOptions
<
Awaited
<
ReturnType
<
typeof
getBanner
>>
,
TError
,
TData
>>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
):
Promise
<
QueryClient
>
=>
{
const
queryOptions
=
getGetBannerQueryOptions
(
params
,
options
)
await
queryClient
.
prefetchQuery
(
queryOptions
);
return
queryClient
;
}
/**
* Create a new banner record
* @summary Create a banner
*/
export
type
postBannerResponse200
=
{
data
:
PostBanner200
status
:
200
}
export
type
postBannerResponseSuccess
=
(
postBannerResponse200
)
&
{
headers
:
Headers
;
};
;
export
type
postBannerResponse
=
(
postBannerResponseSuccess
)
export
const
getPostBannerUrl
=
()
=>
{
return
`/banner`
}
export
const
postBanner
=
async
(
bannerMutate
:
BannerMutate
,
options
?:
RequestInit
):
Promise
<
postBannerResponse
>
=>
{
return
useCustomClient
<
postBannerResponse
>
(
getPostBannerUrl
(),
{
...
options
,
method
:
'POST'
,
headers
:
{
'Content-Type'
:
'application/json'
,
...
options
?.
headers
},
body
:
JSON
.
stringify
(
bannerMutate
,)
}
);}
export
const
getPostBannerMutationOptions
=
<
TError
=
ErrorType
<
unknown
>
,
TContext
=
unknown
>
(
options
?:
{
mutation
?:
UseMutationOptions
<
Awaited
<
ReturnType
<
typeof
postBanner
>>
,
TError
,{
data
:
BodyType
<
BannerMutate
>
},
TContext
>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
):
UseMutationOptions
<
Awaited
<
ReturnType
<
typeof
postBanner
>>
,
TError
,{
data
:
BodyType
<
BannerMutate
>
},
TContext
>
=>
{
const
mutationKey
=
[
'postBanner'
];
const
{
mutation
:
mutationOptions
,
request
:
requestOptions
}
=
options
?
options
.
mutation
&&
'mutationKey'
in
options
.
mutation
&&
options
.
mutation
.
mutationKey
?
options
:
{...
options
,
mutation
:
{...
options
.
mutation
,
mutationKey
}}
:
{
mutation
:
{
mutationKey
,
},
request
:
undefined
};
const
mutationFn
:
MutationFunction
<
Awaited
<
ReturnType
<
typeof
postBanner
>>
,
{
data
:
BodyType
<
BannerMutate
>
}
>
=
(
props
)
=>
{
const
{
data
}
=
props
??
{};
return
postBanner
(
data
,
requestOptions
)
}
return
{
mutationFn
,
...
mutationOptions
}}
export
type
PostBannerMutationResult
=
NonNullable
<
Awaited
<
ReturnType
<
typeof
postBanner
>>>
export
type
PostBannerMutationBody
=
BodyType
<
BannerMutate
>
export
type
PostBannerMutationError
=
ErrorType
<
unknown
>
/**
* @summary Create a banner
*/
export
const
usePostBanner
=
<
TError
=
ErrorType
<
unknown
>
,
TContext
=
unknown
>
(
options
?:
{
mutation
?:
UseMutationOptions
<
Awaited
<
ReturnType
<
typeof
postBanner
>>
,
TError
,{
data
:
BodyType
<
BannerMutate
>
},
TContext
>
,
request
?:
SecondParameter
<
typeof
useCustomClient
>
}
,
queryClient
?:
QueryClient
):
UseMutationResult
<
Awaited
<
ReturnType
<
typeof
postBanner
>>
,
TError
,
{
data
:
BodyType
<
BannerMutate
>
},
TContext
>
=>
{
const
mutationOptions
=
getPostBannerMutationOptions
(
options
);
return
useMutation
(
mutationOptions
,
queryClient
);
}
\ No newline at end of file
src/api/models/deleteBannerId200.ts
0 → 100644
View file @
1334e92b
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import
type
{
ApiResponse
}
from
'./apiResponse'
;
import
type
{
DeleteBannerId200AllOf
}
from
'./deleteBannerId200AllOf'
;
export
type
DeleteBannerId200
=
ApiResponse
&
DeleteBannerId200AllOf
;
src/api/models/deleteBannerId200AllOf.ts
0 → 100644
View file @
1334e92b
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
export
type
DeleteBannerId200AllOf
=
{
responseData
?:
boolean
;
};
src/api/models/getBannerId200.ts
0 → 100644
View file @
1334e92b
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import
type
{
ApiResponse
}
from
'./apiResponse'
;
import
type
{
GetBannerId200AllOf
}
from
'./getBannerId200AllOf'
;
export
type
GetBannerId200
=
ApiResponse
&
GetBannerId200AllOf
;
src/api/models/getBannerId200AllOf.ts
0 → 100644
View file @
1334e92b
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import
type
{
Banner
}
from
'./banner'
;
export
type
GetBannerId200AllOf
=
{
responseData
?:
Banner
;
};
src/api/models/getBannerParams.ts
0 → 100644
View file @
1334e92b
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import
type
{
FiltersParameter
}
from
'./filtersParameter'
;
import
type
{
SortFieldParameter
}
from
'./sortFieldParameter'
;
import
type
{
SortOrderParameter
}
from
'./sortOrderParameter'
;
import
type
{
PageParameter
}
from
'./pageParameter'
;
import
type
{
PageSizeParameter
}
from
'./pageSizeParameter'
;
export
type
GetBannerParams
=
{
/**
* filter, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
*/
filters
?:
FiltersParameter
;
/**
* sortField, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
*/
sortField
?:
SortFieldParameter
;
/**
* sort order, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
*/
sortOrder
?:
SortOrderParameter
;
/**
* page, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
* @minimum 1
*/
page
?:
PageParameter
;
/**
* pageSize, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
* @minimum 1
*/
pageSize
?:
PageSizeParameter
;
};
src/api/models/index.ts
View file @
1334e92b
...
@@ -45,6 +45,8 @@ export * from './deleteApiV10CategoryId200AllOf';
...
@@ -45,6 +45,8 @@ export * from './deleteApiV10CategoryId200AllOf';
export
*
from
'./deleteApiV10ContactId200'
;
export
*
from
'./deleteApiV10ContactId200'
;
export
*
from
'./deleteApiV10ContactId200AllOf'
;
export
*
from
'./deleteApiV10ContactId200AllOf'
;
export
*
from
'./deleteApprovalParams'
;
export
*
from
'./deleteApprovalParams'
;
export
*
from
'./deleteBannerId200'
;
export
*
from
'./deleteBannerId200AllOf'
;
export
*
from
'./deleteCategoryId200'
;
export
*
from
'./deleteCategoryId200'
;
export
*
from
'./deleteCategoryId200AllOf'
;
export
*
from
'./deleteCategoryId200AllOf'
;
export
*
from
'./deleteConfigParams'
;
export
*
from
'./deleteConfigParams'
;
...
@@ -106,6 +108,9 @@ export * from './getApiV10VideoId200';
...
@@ -106,6 +108,9 @@ export * from './getApiV10VideoId200';
export
*
from
'./getApiV10VideoId200AllOf'
;
export
*
from
'./getApiV10VideoId200AllOf'
;
export
*
from
'./getApiV10VideoParams'
;
export
*
from
'./getApiV10VideoParams'
;
export
*
from
'./getApprovalParams'
;
export
*
from
'./getApprovalParams'
;
export
*
from
'./getBannerId200'
;
export
*
from
'./getBannerId200AllOf'
;
export
*
from
'./getBannerParams'
;
export
*
from
'./getCategoryId200'
;
export
*
from
'./getCategoryId200'
;
export
*
from
'./getCategoryId200AllOf'
;
export
*
from
'./getCategoryId200AllOf'
;
export
*
from
'./getCategoryParams'
;
export
*
from
'./getCategoryParams'
;
...
@@ -266,6 +271,8 @@ export * from './postApiV10PageConfigBody';
...
@@ -266,6 +271,8 @@ export * from './postApiV10PageConfigBody';
export
*
from
'./postApiV10Video200'
;
export
*
from
'./postApiV10Video200'
;
export
*
from
'./postApiV10Video200AllOf'
;
export
*
from
'./postApiV10Video200AllOf'
;
export
*
from
'./postAuthForgotPasswordBody'
;
export
*
from
'./postAuthForgotPasswordBody'
;
export
*
from
'./postBanner200'
;
export
*
from
'./postBanner200AllOf'
;
export
*
from
'./postCategory'
;
export
*
from
'./postCategory'
;
export
*
from
'./postCategory200'
;
export
*
from
'./postCategory200'
;
export
*
from
'./postCategory200AllOf'
;
export
*
from
'./postCategory200AllOf'
;
...
@@ -314,6 +321,8 @@ export * from './putApiV10SiteInformation200';
...
@@ -314,6 +321,8 @@ export * from './putApiV10SiteInformation200';
export
*
from
'./putApiV10SiteInformation200AllOf'
;
export
*
from
'./putApiV10SiteInformation200AllOf'
;
export
*
from
'./putAuthAssignBusinessInterestBody'
;
export
*
from
'./putAuthAssignBusinessInterestBody'
;
export
*
from
'./putAuthUpdatePasswordBody'
;
export
*
from
'./putAuthUpdatePasswordBody'
;
export
*
from
'./putBannerId200'
;
export
*
from
'./putBannerId200AllOf'
;
export
*
from
'./putCategoryId200'
;
export
*
from
'./putCategoryId200'
;
export
*
from
'./putCategoryId200AllOf'
;
export
*
from
'./putCategoryId200AllOf'
;
export
*
from
'./putConfigParams'
;
export
*
from
'./putConfigParams'
;
...
...
src/api/models/postBanner200.ts
0 → 100644
View file @
1334e92b
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import
type
{
ApiResponse
}
from
'./apiResponse'
;
import
type
{
PostBanner200AllOf
}
from
'./postBanner200AllOf'
;
export
type
PostBanner200
=
ApiResponse
&
PostBanner200AllOf
;
src/api/models/postBanner200AllOf.ts
0 → 100644
View file @
1334e92b
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import
type
{
Banner
}
from
'./banner'
;
export
type
PostBanner200AllOf
=
{
responseData
?:
Banner
;
};
src/api/models/putBannerId200.ts
0 → 100644
View file @
1334e92b
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import
type
{
ApiResponse
}
from
'./apiResponse'
;
import
type
{
PutBannerId200AllOf
}
from
'./putBannerId200AllOf'
;
export
type
PutBannerId200
=
ApiResponse
&
PutBannerId200AllOf
;
src/api/models/putBannerId200AllOf.ts
0 → 100644
View file @
1334e92b
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import
type
{
Banner
}
from
'./banner'
;
export
type
PutBannerId200AllOf
=
{
responseData
?:
Banner
;
};
src/app/admin/base-config/page.tsx
View file @
1334e92b
...
@@ -44,7 +44,10 @@ import {
...
@@ -44,7 +44,10 @@ import {
putSiteInformation
,
putSiteInformation
,
}
from
"@/api/endpoints/site-information"
;
}
from
"@/api/endpoints/site-information"
;
import
{
deleteLogoId
,
postLogo
,
putLogoId
}
from
"@/api/endpoints/logo"
;
import
{
deleteLogoId
,
postLogo
,
putLogoId
}
from
"@/api/endpoints/logo"
;
import
{
deleteBannerId
,
getBanner
,
postBanner
,
putBannerId
}
from
"@/api/endpoints/banner"
;
import
type
{
import
type
{
Banner
,
BannerMutate
,
SiteInformationBranch
,
SiteInformationBranch
,
SiteInformationBranchMutate
,
SiteInformationBranchMutate
,
SiteInformationData
,
SiteInformationData
,
...
@@ -52,6 +55,7 @@ import type {
...
@@ -52,6 +55,7 @@ import type {
SiteInformationSocialMutate
,
SiteInformationSocialMutate
,
}
from
"@/api/models"
;
}
from
"@/api/models"
;
import
type
{
AdminMediaItem
}
from
"@/mockdata/admin-news"
;
import
type
{
AdminMediaItem
}
from
"@/mockdata/admin-news"
;
import
{
fetchCmsFileById
,
toAdminMediaItem
}
from
"@/lib/api/files"
;
import
{
import
{
type
BaseConfigBannerItem
,
type
BaseConfigBannerItem
,
type
BaseConfigBranchItem
,
type
BaseConfigBranchItem
,
...
@@ -83,6 +87,13 @@ type LogoMediaItem = AdminMediaItem & {
...
@@ -83,6 +87,13 @@ type LogoMediaItem = AdminMediaItem & {
logoId
?:
string
;
logoId
?:
string
;
};
};
type
PageEnvelope
<
T
>
=
{
rows
?:
T
[];
count
?:
number
;
page
?:
number
;
pageSize
?:
number
;
};
type
ConfigItemForm
=
{
type
ConfigItemForm
=
{
name
:
string
;
name
:
string
;
imageId
:
string
;
imageId
:
string
;
...
@@ -158,6 +169,27 @@ function mapConfigSocialToApi(social: BaseConfigSocialItem): SiteInformationSoci
...
@@ -158,6 +169,27 @@ function mapConfigSocialToApi(social: BaseConfigSocialItem): SiteInformationSoci
};
};
}
}
function
mapApiBannerToConfig
(
banner
:
Banner
):
BaseConfigBannerItem
{
return
{
id
:
banner
.
id
??
createBaseConfigItemId
(
"banner"
),
name
:
banner
.
banner_name
??
""
,
imageId
:
banner
.
file_id
??
""
,
isActive
:
banner
.
status
!==
"INACTIVE"
,
displayTimeSeconds
:
banner
.
display_time
??
5
,
sortOrder
:
banner
.
display_order
??
1
,
};
}
function
mapConfigBannerToApi
(
banner
:
BaseConfigBannerItem
):
BannerMutate
{
return
{
banner_name
:
banner
.
name
.
trim
(),
file_id
:
banner
.
imageId
,
display_order
:
banner
.
sortOrder
,
display_time
:
Math
.
max
(
1
,
banner
.
displayTimeSeconds
||
1
),
status
:
banner
.
isActive
?
"ACTIVE"
:
"INACTIVE"
,
};
}
function
mapSiteLogoToConfig
(
siteInformation
:
SiteInformationData
):
{
function
mapSiteLogoToConfig
(
siteInformation
:
SiteInformationData
):
{
logo
:
BaseConfigLogoItem
|
null
;
logo
:
BaseConfigLogoItem
|
null
;
media
:
LogoMediaItem
|
null
;
media
:
LogoMediaItem
|
null
;
...
@@ -493,6 +525,56 @@ export default function AdminBaseConfigPage() {
...
@@ -493,6 +525,56 @@ export default function AdminBaseConfigPage() {
void
loadSiteInformation
();
void
loadSiteInformation
();
const
loadBanners
=
async
()
=>
{
try
{
const
response
=
await
getBanner
({
page
:
1
,
pageSize
:
100
,
sortField
:
"display_order"
,
sortOrder
:
"asc"
,
});
const
pageData
=
getEnvelopeData
<
PageEnvelope
<
Banner
>>
(
response
);
const
bannerRows
=
pageData
?.
rows
??
[];
const
mediaRows
=
await
Promise
.
all
(
bannerRows
.
map
((
banner
)
=>
banner
.
file_id
)
.
filter
((
fileId
):
fileId
is
string
=>
Boolean
(
fileId
))
.
map
(
async
(
fileId
)
=>
{
const
file
=
await
fetchCmsFileById
(
fileId
).
catch
(()
=>
null
);
return
file
?
toAdminMediaItem
(
file
)
:
null
;
}),
);
if
(
!
mounted
)
return
;
const
nextBanners
=
bannerRows
.
map
(
mapApiBannerToConfig
);
setMediaItems
((
previous
)
=>
{
const
nextMap
=
new
Map
(
previous
.
map
((
entry
)
=>
[
entry
.
id
,
entry
]));
mediaRows
.
forEach
((
item
)
=>
{
if
(
item
)
nextMap
.
set
(
item
.
id
,
item
);
});
return
Array
.
from
(
nextMap
.
values
());
});
setConfig
((
previous
)
=>
previous
?
{
...
previous
,
banners
:
nextBanners
,
}
:
previous
,
);
setCurrentBannerIndex
(
0
);
}
catch
(
error
)
{
console
.
error
(
error
);
if
(
mounted
)
{
toast
.
error
(
"Không thể tải danh sách banner"
);
}
}
};
void
loadBanners
();
return
()
=>
{
return
()
=>
{
mounted
=
false
;
mounted
=
false
;
};
};
...
@@ -609,8 +691,45 @@ export default function AdminBaseConfigPage() {
...
@@ -609,8 +691,45 @@ export default function AdminBaseConfigPage() {
return
;
return
;
}
}
const
bannerDraft
:
BaseConfigBannerItem
=
{
id
:
editingItemId
||
createBaseConfigItemId
(
"banner"
),
name
:
trimmedName
,
imageId
:
itemForm
.
imageId
,
isActive
:
itemForm
.
isActive
,
displayTimeSeconds
:
itemForm
.
displayTimeSeconds
,
sortOrder
:
itemForm
.
sortOrder
,
};
try
{
const
response
=
editingItemId
?
await
putBannerId
(
editingItemId
,
mapConfigBannerToApi
(
bannerDraft
))
:
await
postBanner
(
mapConfigBannerToApi
(
bannerDraft
));
const
savedBanner
=
getEnvelopeData
<
Banner
>
(
response
);
const
nextBanner
=
savedBanner
?
mapApiBannerToConfig
(
savedBanner
)
:
bannerDraft
;
const
nextConfig
=
cloneBaseConfigData
(
config
);
const
nextConfig
=
cloneBaseConfigData
(
config
);
if
(
editingItemId
)
{
nextConfig
.
banners
=
nextConfig
.
banners
.
map
((
item
)
=>
item
.
id
===
editingItemId
?
nextBanner
:
item
,
);
}
else
{
nextConfig
.
banners
.
push
(
nextBanner
);
setCurrentBannerIndex
(
Math
.
max
(
nextConfig
.
banners
.
length
-
1
,
0
));
}
setConfig
(
nextConfig
);
setSavingItem
(
false
);
setItemDialogOpen
(
false
);
toast
.
success
(
"Đã lưu cấu hình banner"
);
}
catch
(
error
)
{
console
.
error
(
error
);
setSavingItem
(
false
);
toast
.
error
(
"Không thể lưu cấu hình banner"
);
}
return
;
const
nextConfig
=
cloneBaseConfigData
(
config
!
);
if
(
editingItemId
)
{
if
(
editingItemId
)
{
nextConfig
.
banners
=
nextConfig
.
banners
.
map
((
item
)
=>
nextConfig
.
banners
=
nextConfig
.
banners
.
map
((
item
)
=>
item
.
id
===
editingItemId
item
.
id
===
editingItemId
...
@@ -663,6 +782,7 @@ export default function AdminBaseConfigPage() {
...
@@ -663,6 +782,7 @@ export default function AdminBaseConfigPage() {
return
;
return
;
}
}
}
else
{
}
else
{
await
deleteBannerId
(
deleteTarget
.
id
);
nextConfig
.
banners
=
nextConfig
.
banners
.
filter
((
item
)
=>
item
.
id
!==
deleteTarget
.
id
);
nextConfig
.
banners
=
nextConfig
.
banners
.
filter
((
item
)
=>
item
.
id
!==
deleteTarget
.
id
);
setCurrentBannerIndex
((
previous
)
=>
setCurrentBannerIndex
((
previous
)
=>
Math
.
max
(
0
,
Math
.
min
(
previous
,
nextConfig
.
banners
.
length
-
1
)),
Math
.
max
(
0
,
Math
.
min
(
previous
,
nextConfig
.
banners
.
length
-
1
)),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment