이름: solution/front → solution/frontend
`backend` 옆에 `front` 가 있을 이유가 없었다. negosium 의 negodata/front 를 그대로 베꼈고 그게 왜 front 인지는 따져보지 않았다 — 근거 없이 들여온 이름이라 바로잡는다. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019uYhHQdssRubirPirrdJJC
This commit is contained in:
1 parent
06f6438d9b
commit
c85c577349
480 files changed
+22
-22
No files matched your search
@@ -0,0 +1,852 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Web4Ai API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import {
|
||||
useMutation,
|
||||
useQuery
|
||||
} from '@tanstack/react-query';
|
||||
import type {
|
||||
DataTag,
|
||||
DefinedInitialDataOptions,
|
||||
DefinedUseQueryResult,
|
||||
MutationFunction,
|
||||
QueryClient,
|
||||
QueryFunction,
|
||||
QueryKey,
|
||||
UndefinedInitialDataOptions,
|
||||
UseMutationOptions,
|
||||
UseMutationResult,
|
||||
UseQueryOptions,
|
||||
UseQueryResult
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
import type {
|
||||
CheckSlugParams,
|
||||
HTTPValidationError,
|
||||
ReqSiteSlug,
|
||||
ReqSiteStatus,
|
||||
ReqSiteTemplate,
|
||||
ReqSiteTheme,
|
||||
ReqStartBuild,
|
||||
ResPublishLogs,
|
||||
ResSeoAudit,
|
||||
ResSite,
|
||||
ResSiteSlug,
|
||||
ResSiteVersions,
|
||||
ResSlugCheck,
|
||||
ResStartBuild
|
||||
} from '.././model';
|
||||
|
||||
import { customFetch } from '../../mutator/custom-fetch';
|
||||
|
||||
|
||||
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 현재 발행 버전과 재빌드 필요 여부(needs_rebuild). 노출값이 바뀐 뒤 다시 빌드하지 않았으면 true — 이 사업장만 재빌드하면 된다.
|
||||
* @summary 사이트 상태
|
||||
*/
|
||||
export const getSite = (
|
||||
placeId: string,
|
||||
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
||||
) => {
|
||||
|
||||
|
||||
return customFetch<ResSite>(
|
||||
{url: `/v1/place/${placeId}/site`, method: 'GET', signal
|
||||
},
|
||||
options);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export const getGetSiteQueryKey = (placeId?: string,) => {
|
||||
return [
|
||||
`/v1/place/${placeId}/site`
|
||||
] as const;
|
||||
}
|
||||
|
||||
|
||||
export const getGetSiteQueryOptions = <TData = Awaited<ReturnType<typeof getSite>>, TError = void | HTTPValidationError>(placeId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSite>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
) => {
|
||||
|
||||
const {query: queryOptions, request: requestOptions} = options ?? {};
|
||||
|
||||
const queryKey = queryOptions?.queryKey ?? getGetSiteQueryKey(placeId);
|
||||
|
||||
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof getSite>>> = ({ signal }) => getSite(placeId, requestOptions, signal);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return { queryKey, queryFn, enabled: !!(placeId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getSite>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
}
|
||||
|
||||
export type GetSiteQueryResult = NonNullable<Awaited<ReturnType<typeof getSite>>>
|
||||
export type GetSiteQueryError = void | HTTPValidationError
|
||||
|
||||
|
||||
export function useGetSite<TData = Awaited<ReturnType<typeof getSite>>, TError = void | HTTPValidationError>(
|
||||
placeId: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSite>>, TError, TData>> & Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof getSite>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof getSite>>
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useGetSite<TData = Awaited<ReturnType<typeof getSite>>, TError = void | HTTPValidationError>(
|
||||
placeId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSite>>, TError, TData>> & Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof getSite>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof getSite>>
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useGetSite<TData = Awaited<ReturnType<typeof getSite>>, TError = void | HTTPValidationError>(
|
||||
placeId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSite>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
/**
|
||||
* @summary 사이트 상태
|
||||
*/
|
||||
|
||||
export function useGetSite<TData = Awaited<ReturnType<typeof getSite>>, TError = void | HTTPValidationError>(
|
||||
placeId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSite>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
||||
|
||||
const queryOptions = getGetSiteQueryOptions(placeId,options)
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
query.queryKey = queryOptions.queryKey ;
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 현재 확인된 콘텐츠와 최신 빌드를 SEO·AEO 각각 100점으로 채점하고 개선 항목을 반환한다. 준비도 점수이며 실제 검색 순위나 AI 인용을 보장하지 않는다.
|
||||
* @summary SEO/AEO 준비도 진단
|
||||
*/
|
||||
export const getSeoAudit = (
|
||||
placeId: string,
|
||||
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
||||
) => {
|
||||
|
||||
|
||||
return customFetch<ResSeoAudit>(
|
||||
{url: `/v1/place/${placeId}/site/audit`, method: 'GET', signal
|
||||
},
|
||||
options);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export const getGetSeoAuditQueryKey = (placeId?: string,) => {
|
||||
return [
|
||||
`/v1/place/${placeId}/site/audit`
|
||||
] as const;
|
||||
}
|
||||
|
||||
|
||||
export const getGetSeoAuditQueryOptions = <TData = Awaited<ReturnType<typeof getSeoAudit>>, TError = void | HTTPValidationError>(placeId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSeoAudit>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
) => {
|
||||
|
||||
const {query: queryOptions, request: requestOptions} = options ?? {};
|
||||
|
||||
const queryKey = queryOptions?.queryKey ?? getGetSeoAuditQueryKey(placeId);
|
||||
|
||||
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof getSeoAudit>>> = ({ signal }) => getSeoAudit(placeId, requestOptions, signal);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return { queryKey, queryFn, enabled: !!(placeId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getSeoAudit>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
}
|
||||
|
||||
export type GetSeoAuditQueryResult = NonNullable<Awaited<ReturnType<typeof getSeoAudit>>>
|
||||
export type GetSeoAuditQueryError = void | HTTPValidationError
|
||||
|
||||
|
||||
export function useGetSeoAudit<TData = Awaited<ReturnType<typeof getSeoAudit>>, TError = void | HTTPValidationError>(
|
||||
placeId: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSeoAudit>>, TError, TData>> & Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof getSeoAudit>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof getSeoAudit>>
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useGetSeoAudit<TData = Awaited<ReturnType<typeof getSeoAudit>>, TError = void | HTTPValidationError>(
|
||||
placeId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSeoAudit>>, TError, TData>> & Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof getSeoAudit>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof getSeoAudit>>
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useGetSeoAudit<TData = Awaited<ReturnType<typeof getSeoAudit>>, TError = void | HTTPValidationError>(
|
||||
placeId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSeoAudit>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
/**
|
||||
* @summary SEO/AEO 준비도 진단
|
||||
*/
|
||||
|
||||
export function useGetSeoAudit<TData = Awaited<ReturnType<typeof getSeoAudit>>, TError = void | HTTPValidationError>(
|
||||
placeId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSeoAudit>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
||||
|
||||
const queryOptions = getGetSeoAuditQueryOptions(placeId,options)
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
query.queryKey = queryOptions.queryKey ;
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 쓰고 싶은 주소를 미리 본다. 소문자 영문·숫자·하이픈 3~50자만 되고, 예약어와 남이 쓰는 주소는 막힌다. ★ 서버가 상호명으로 자동 확정하지 않는다 — 사람이 고른다. 못 쓰면 reason(INVALID_LENGTH·INVALID_FORMAT·RESERVED·TAKEN)과 대안 하나(suggestion)를 준다. 지금 자기가 쓰는 주소면 available=true 다.
|
||||
* @summary 사이트 주소 사용 가능 확인
|
||||
*/
|
||||
export const checkSlug = (
|
||||
placeId: string,
|
||||
params: CheckSlugParams,
|
||||
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
||||
) => {
|
||||
|
||||
|
||||
return customFetch<ResSlugCheck>(
|
||||
{url: `/v1/place/${placeId}/site/slug/check`, method: 'GET',
|
||||
params, signal
|
||||
},
|
||||
options);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export const getCheckSlugQueryKey = (placeId?: string,
|
||||
params?: CheckSlugParams,) => {
|
||||
return [
|
||||
`/v1/place/${placeId}/site/slug/check`, ...(params ? [params]: [])
|
||||
] as const;
|
||||
}
|
||||
|
||||
|
||||
export const getCheckSlugQueryOptions = <TData = Awaited<ReturnType<typeof checkSlug>>, TError = void | HTTPValidationError>(placeId: string,
|
||||
params: CheckSlugParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof checkSlug>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
) => {
|
||||
|
||||
const {query: queryOptions, request: requestOptions} = options ?? {};
|
||||
|
||||
const queryKey = queryOptions?.queryKey ?? getCheckSlugQueryKey(placeId,params);
|
||||
|
||||
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof checkSlug>>> = ({ signal }) => checkSlug(placeId,params, requestOptions, signal);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return { queryKey, queryFn, enabled: !!(placeId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof checkSlug>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
}
|
||||
|
||||
export type CheckSlugQueryResult = NonNullable<Awaited<ReturnType<typeof checkSlug>>>
|
||||
export type CheckSlugQueryError = void | HTTPValidationError
|
||||
|
||||
|
||||
export function useCheckSlug<TData = Awaited<ReturnType<typeof checkSlug>>, TError = void | HTTPValidationError>(
|
||||
placeId: string,
|
||||
params: CheckSlugParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof checkSlug>>, TError, TData>> & Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof checkSlug>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof checkSlug>>
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useCheckSlug<TData = Awaited<ReturnType<typeof checkSlug>>, TError = void | HTTPValidationError>(
|
||||
placeId: string,
|
||||
params: CheckSlugParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof checkSlug>>, TError, TData>> & Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof checkSlug>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof checkSlug>>
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useCheckSlug<TData = Awaited<ReturnType<typeof checkSlug>>, TError = void | HTTPValidationError>(
|
||||
placeId: string,
|
||||
params: CheckSlugParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof checkSlug>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
/**
|
||||
* @summary 사이트 주소 사용 가능 확인
|
||||
*/
|
||||
|
||||
export function useCheckSlug<TData = Awaited<ReturnType<typeof checkSlug>>, TError = void | HTTPValidationError>(
|
||||
placeId: string,
|
||||
params: CheckSlugParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof checkSlug>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
||||
|
||||
const queryOptions = getCheckSlugQueryOptions(placeId,params,options)
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
query.queryKey = queryOptions.queryKey ;
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 주소를 sites.domain 에 저장한다(사이트 행이 없으면 만든다). 검증은 check 와 같은 규칙으로 서버가 다시 한다 — 클라이언트 검증을 믿지 않는다. ★ 이미 발행된 사이트의 주소는 바꿀 수 없다(SITE_SLUG_LOCKED) — 색인된 주소가 바뀌면 AI 검색이 잡아 둔 페이지가 404 가 된다.
|
||||
* @summary 사이트 주소 확정
|
||||
*/
|
||||
export const setSlug = (
|
||||
placeId: string,
|
||||
reqSiteSlug: ReqSiteSlug,
|
||||
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
||||
) => {
|
||||
|
||||
|
||||
return customFetch<ResSiteSlug>(
|
||||
{url: `/v1/place/${placeId}/site/slug`, method: 'POST',
|
||||
headers: {'Content-Type': 'application/json', },
|
||||
data: reqSiteSlug, signal
|
||||
},
|
||||
options);
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const getSetSlugMutationOptions = <TError = void | HTTPValidationError,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof setSlug>>, TError,{placeId: string;data: ReqSiteSlug}, TContext>, request?: SecondParameter<typeof customFetch>}
|
||||
): UseMutationOptions<Awaited<ReturnType<typeof setSlug>>, TError,{placeId: string;data: ReqSiteSlug}, TContext> => {
|
||||
|
||||
const mutationKey = ['setSlug'];
|
||||
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 setSlug>>, {placeId: string;data: ReqSiteSlug}> = (props) => {
|
||||
const {placeId,data} = props ?? {};
|
||||
|
||||
return setSlug(placeId,data,requestOptions)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return { mutationFn, ...mutationOptions }}
|
||||
|
||||
export type SetSlugMutationResult = NonNullable<Awaited<ReturnType<typeof setSlug>>>
|
||||
export type SetSlugMutationBody = ReqSiteSlug
|
||||
export type SetSlugMutationError = void | HTTPValidationError
|
||||
|
||||
/**
|
||||
* @summary 사이트 주소 확정
|
||||
*/
|
||||
export const useSetSlug = <TError = void | HTTPValidationError,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof setSlug>>, TError,{placeId: string;data: ReqSiteSlug}, TContext>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient): UseMutationResult<
|
||||
Awaited<ReturnType<typeof setSlug>>,
|
||||
TError,
|
||||
{placeId: string;data: ReqSiteSlug},
|
||||
TContext
|
||||
> => {
|
||||
|
||||
const mutationOptions = getSetSlugMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions, queryClient);
|
||||
}
|
||||
/**
|
||||
* 위저드에서 고른 템플릿을 sites.template_id 에 저장한다(사이트 행이 없으면 만든다). ★ 서버는 값을 검증하지 않는다 — 템플릿 목록은 프론트가 소유한다. 길이(100자)만 막는다. ★ 주소와 달리 발행 뒤에도 바꿀 수 있다: 디자인이 바뀌어도 URL 은 그대로라 색인이 깨지지 않는다. 이미 발행된 사이트면 재빌드가 필요하다는 표시로 content_updated_at 을 찍는다(needs_rebuild=true).
|
||||
* @summary 템플릿(디자인) 선택 저장
|
||||
*/
|
||||
export const setTemplate = (
|
||||
placeId: string,
|
||||
reqSiteTemplate: ReqSiteTemplate,
|
||||
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
||||
) => {
|
||||
|
||||
|
||||
return customFetch<ResSite>(
|
||||
{url: `/v1/place/${placeId}/site/template`, method: 'POST',
|
||||
headers: {'Content-Type': 'application/json', },
|
||||
data: reqSiteTemplate, signal
|
||||
},
|
||||
options);
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const getSetTemplateMutationOptions = <TError = void | HTTPValidationError,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof setTemplate>>, TError,{placeId: string;data: ReqSiteTemplate}, TContext>, request?: SecondParameter<typeof customFetch>}
|
||||
): UseMutationOptions<Awaited<ReturnType<typeof setTemplate>>, TError,{placeId: string;data: ReqSiteTemplate}, TContext> => {
|
||||
|
||||
const mutationKey = ['setTemplate'];
|
||||
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 setTemplate>>, {placeId: string;data: ReqSiteTemplate}> = (props) => {
|
||||
const {placeId,data} = props ?? {};
|
||||
|
||||
return setTemplate(placeId,data,requestOptions)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return { mutationFn, ...mutationOptions }}
|
||||
|
||||
export type SetTemplateMutationResult = NonNullable<Awaited<ReturnType<typeof setTemplate>>>
|
||||
export type SetTemplateMutationBody = ReqSiteTemplate
|
||||
export type SetTemplateMutationError = void | HTTPValidationError
|
||||
|
||||
/**
|
||||
* @summary 템플릿(디자인) 선택 저장
|
||||
*/
|
||||
export const useSetTemplate = <TError = void | HTTPValidationError,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof setTemplate>>, TError,{placeId: string;data: ReqSiteTemplate}, TContext>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient): UseMutationResult<
|
||||
Awaited<ReturnType<typeof setTemplate>>,
|
||||
TError,
|
||||
{placeId: string;data: ReqSiteTemplate},
|
||||
TContext
|
||||
> => {
|
||||
|
||||
const mutationOptions = getSetTemplateMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions, queryClient);
|
||||
}
|
||||
/**
|
||||
* 에디터가 정한 색·서체·섹션(순서·on/off·배리에이션)을 sites.theme 에 저장한다(사이트 행이 없으면 만든다). body 최상위 키는 theme 하나다: {"theme":{"colors":{...},"fontStyle":"...","colorPaletteId":"...","sections":[{"id","name","enabled","locked","variantId"}]}}. ★ sections 의 배열 순서가 곧 섹션 순서다(별도 order 필드 없음). ★ 서버는 값을 해석하지 않는다 — 섹션 목록·배리에이션 키·색 토큰은 프론트가 소유한다. 직렬화 크기(64KB)만 막는다. ★ templateId 는 여기 담지 않는다 — sites.template_id 와 POST /template 이 담당한다. ★ colorPaletteId 는 에디터 복원 전용이라 저장·반환만 하고 발행 payload 에는 싣지 않는다. ★ 빈 값({})을 보내면 NULL 로 되돌아가 업종 기본 색·서체·섹션으로 떨어진다. ★ 템플릿과 같이 발행 뒤에도 바꿀 수 있다(디자인이 바뀌어도 URL 은 그대로다). 이미 발행된 사이트면 재빌드가 필요하다는 표시로 content_updated_at 을 찍는다(needs_rebuild=true).
|
||||
* @summary 디자인(색·서체·섹션) 저장
|
||||
*/
|
||||
export const setTheme = (
|
||||
placeId: string,
|
||||
reqSiteTheme: ReqSiteTheme,
|
||||
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
||||
) => {
|
||||
|
||||
|
||||
return customFetch<ResSite>(
|
||||
{url: `/v1/place/${placeId}/site/theme`, method: 'POST',
|
||||
headers: {'Content-Type': 'application/json', },
|
||||
data: reqSiteTheme, signal
|
||||
},
|
||||
options);
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const getSetThemeMutationOptions = <TError = void | HTTPValidationError,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof setTheme>>, TError,{placeId: string;data: ReqSiteTheme}, TContext>, request?: SecondParameter<typeof customFetch>}
|
||||
): UseMutationOptions<Awaited<ReturnType<typeof setTheme>>, TError,{placeId: string;data: ReqSiteTheme}, TContext> => {
|
||||
|
||||
const mutationKey = ['setTheme'];
|
||||
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 setTheme>>, {placeId: string;data: ReqSiteTheme}> = (props) => {
|
||||
const {placeId,data} = props ?? {};
|
||||
|
||||
return setTheme(placeId,data,requestOptions)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return { mutationFn, ...mutationOptions }}
|
||||
|
||||
export type SetThemeMutationResult = NonNullable<Awaited<ReturnType<typeof setTheme>>>
|
||||
export type SetThemeMutationBody = ReqSiteTheme
|
||||
export type SetThemeMutationError = void | HTTPValidationError
|
||||
|
||||
/**
|
||||
* @summary 디자인(색·서체·섹션) 저장
|
||||
*/
|
||||
export const useSetTheme = <TError = void | HTTPValidationError,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof setTheme>>, TError,{placeId: string;data: ReqSiteTheme}, TContext>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient): UseMutationResult<
|
||||
Awaited<ReturnType<typeof setTheme>>,
|
||||
TError,
|
||||
{placeId: string;data: ReqSiteTheme},
|
||||
TContext
|
||||
> => {
|
||||
|
||||
const mutationOptions = getSetThemeMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions, queryClient);
|
||||
}
|
||||
/**
|
||||
* 스냅샷을 박제해 HTML + JSON-LD 를 만들고 발행 검수 게이트를 돌린다. publish=true 면 통과 시 바로 발행한다. ★ 게이트를 우회하는 옵션은 없다.
|
||||
* @summary 정적 빌드(비동기)
|
||||
*/
|
||||
export const startBuild = (
|
||||
placeId: string,
|
||||
reqStartBuild: ReqStartBuild,
|
||||
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
||||
) => {
|
||||
|
||||
|
||||
return customFetch<ResStartBuild>(
|
||||
{url: `/v1/place/${placeId}/site/build`, method: 'POST',
|
||||
headers: {'Content-Type': 'application/json', },
|
||||
data: reqStartBuild, signal
|
||||
},
|
||||
options);
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const getStartBuildMutationOptions = <TError = void | HTTPValidationError,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof startBuild>>, TError,{placeId: string;data: ReqStartBuild}, TContext>, request?: SecondParameter<typeof customFetch>}
|
||||
): UseMutationOptions<Awaited<ReturnType<typeof startBuild>>, TError,{placeId: string;data: ReqStartBuild}, TContext> => {
|
||||
|
||||
const mutationKey = ['startBuild'];
|
||||
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 startBuild>>, {placeId: string;data: ReqStartBuild}> = (props) => {
|
||||
const {placeId,data} = props ?? {};
|
||||
|
||||
return startBuild(placeId,data,requestOptions)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return { mutationFn, ...mutationOptions }}
|
||||
|
||||
export type StartBuildMutationResult = NonNullable<Awaited<ReturnType<typeof startBuild>>>
|
||||
export type StartBuildMutationBody = ReqStartBuild
|
||||
export type StartBuildMutationError = void | HTTPValidationError
|
||||
|
||||
/**
|
||||
* @summary 정적 빌드(비동기)
|
||||
*/
|
||||
export const useStartBuild = <TError = void | HTTPValidationError,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof startBuild>>, TError,{placeId: string;data: ReqStartBuild}, TContext>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient): UseMutationResult<
|
||||
Awaited<ReturnType<typeof startBuild>>,
|
||||
TError,
|
||||
{placeId: string;data: ReqStartBuild},
|
||||
TContext
|
||||
> => {
|
||||
|
||||
const mutationOptions = getStartBuildMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions, queryClient);
|
||||
}
|
||||
/**
|
||||
* @summary 빌드 버전 목록
|
||||
*/
|
||||
export const listVersions = (
|
||||
placeId: string,
|
||||
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
||||
) => {
|
||||
|
||||
|
||||
return customFetch<ResSiteVersions>(
|
||||
{url: `/v1/place/${placeId}/site/version/list`, method: 'GET', signal
|
||||
},
|
||||
options);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export const getListVersionsQueryKey = (placeId?: string,) => {
|
||||
return [
|
||||
`/v1/place/${placeId}/site/version/list`
|
||||
] as const;
|
||||
}
|
||||
|
||||
|
||||
export const getListVersionsQueryOptions = <TData = Awaited<ReturnType<typeof listVersions>>, TError = void | HTTPValidationError>(placeId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listVersions>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
) => {
|
||||
|
||||
const {query: queryOptions, request: requestOptions} = options ?? {};
|
||||
|
||||
const queryKey = queryOptions?.queryKey ?? getListVersionsQueryKey(placeId);
|
||||
|
||||
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof listVersions>>> = ({ signal }) => listVersions(placeId, requestOptions, signal);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return { queryKey, queryFn, enabled: !!(placeId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listVersions>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
}
|
||||
|
||||
export type ListVersionsQueryResult = NonNullable<Awaited<ReturnType<typeof listVersions>>>
|
||||
export type ListVersionsQueryError = void | HTTPValidationError
|
||||
|
||||
|
||||
export function useListVersions<TData = Awaited<ReturnType<typeof listVersions>>, TError = void | HTTPValidationError>(
|
||||
placeId: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listVersions>>, TError, TData>> & Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof listVersions>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof listVersions>>
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useListVersions<TData = Awaited<ReturnType<typeof listVersions>>, TError = void | HTTPValidationError>(
|
||||
placeId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listVersions>>, TError, TData>> & Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof listVersions>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof listVersions>>
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useListVersions<TData = Awaited<ReturnType<typeof listVersions>>, TError = void | HTTPValidationError>(
|
||||
placeId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listVersions>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
/**
|
||||
* @summary 빌드 버전 목록
|
||||
*/
|
||||
|
||||
export function useListVersions<TData = Awaited<ReturnType<typeof listVersions>>, TError = void | HTTPValidationError>(
|
||||
placeId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listVersions>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
||||
|
||||
const queryOptions = getListVersionsQueryOptions(placeId,options)
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
query.queryKey = queryOptions.queryKey ;
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 발행 시도와 거부 사유. 게이트가 막았으면 무엇이 문제였는지 detail 에 남는다.
|
||||
* @summary 발행 기록
|
||||
*/
|
||||
export const listLogs = (
|
||||
placeId: string,
|
||||
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
||||
) => {
|
||||
|
||||
|
||||
return customFetch<ResPublishLogs>(
|
||||
{url: `/v1/place/${placeId}/site/log/list`, method: 'GET', signal
|
||||
},
|
||||
options);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export const getListLogsQueryKey = (placeId?: string,) => {
|
||||
return [
|
||||
`/v1/place/${placeId}/site/log/list`
|
||||
] as const;
|
||||
}
|
||||
|
||||
|
||||
export const getListLogsQueryOptions = <TData = Awaited<ReturnType<typeof listLogs>>, TError = void | HTTPValidationError>(placeId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLogs>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
) => {
|
||||
|
||||
const {query: queryOptions, request: requestOptions} = options ?? {};
|
||||
|
||||
const queryKey = queryOptions?.queryKey ?? getListLogsQueryKey(placeId);
|
||||
|
||||
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof listLogs>>> = ({ signal }) => listLogs(placeId, requestOptions, signal);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return { queryKey, queryFn, enabled: !!(placeId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listLogs>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
}
|
||||
|
||||
export type ListLogsQueryResult = NonNullable<Awaited<ReturnType<typeof listLogs>>>
|
||||
export type ListLogsQueryError = void | HTTPValidationError
|
||||
|
||||
|
||||
export function useListLogs<TData = Awaited<ReturnType<typeof listLogs>>, TError = void | HTTPValidationError>(
|
||||
placeId: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLogs>>, TError, TData>> & Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof listLogs>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof listLogs>>
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useListLogs<TData = Awaited<ReturnType<typeof listLogs>>, TError = void | HTTPValidationError>(
|
||||
placeId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLogs>>, TError, TData>> & Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof listLogs>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof listLogs>>
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useListLogs<TData = Awaited<ReturnType<typeof listLogs>>, TError = void | HTTPValidationError>(
|
||||
placeId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLogs>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
/**
|
||||
* @summary 발행 기록
|
||||
*/
|
||||
|
||||
export function useListLogs<TData = Awaited<ReturnType<typeof listLogs>>, TError = void | HTTPValidationError>(
|
||||
placeId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listLogs>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
||||
|
||||
const queryOptions = getListLogsQueryOptions(placeId,options)
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
query.queryKey = queryOptions.queryKey ;
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ★ 해지는 삭제가 아니라 상태 전이다. 색인된 페이지를 갑자기 404 로 만들면 AI 검색이 그 자리를 다시 OTA 로 채운다.
|
||||
* @summary 발행 상태 전이(중지·재개·내림)
|
||||
*/
|
||||
export const changeStatus = (
|
||||
placeId: string,
|
||||
reqSiteStatus: ReqSiteStatus,
|
||||
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
||||
) => {
|
||||
|
||||
|
||||
return customFetch<ResSite>(
|
||||
{url: `/v1/place/${placeId}/site/status`, method: 'POST',
|
||||
headers: {'Content-Type': 'application/json', },
|
||||
data: reqSiteStatus, signal
|
||||
},
|
||||
options);
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const getChangeStatusMutationOptions = <TError = void | HTTPValidationError,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof changeStatus>>, TError,{placeId: string;data: ReqSiteStatus}, TContext>, request?: SecondParameter<typeof customFetch>}
|
||||
): UseMutationOptions<Awaited<ReturnType<typeof changeStatus>>, TError,{placeId: string;data: ReqSiteStatus}, TContext> => {
|
||||
|
||||
const mutationKey = ['changeStatus'];
|
||||
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 changeStatus>>, {placeId: string;data: ReqSiteStatus}> = (props) => {
|
||||
const {placeId,data} = props ?? {};
|
||||
|
||||
return changeStatus(placeId,data,requestOptions)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return { mutationFn, ...mutationOptions }}
|
||||
|
||||
export type ChangeStatusMutationResult = NonNullable<Awaited<ReturnType<typeof changeStatus>>>
|
||||
export type ChangeStatusMutationBody = ReqSiteStatus
|
||||
export type ChangeStatusMutationError = void | HTTPValidationError
|
||||
|
||||
/**
|
||||
* @summary 발행 상태 전이(중지·재개·내림)
|
||||
*/
|
||||
export const useChangeStatus = <TError = void | HTTPValidationError,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof changeStatus>>, TError,{placeId: string;data: ReqSiteStatus}, TContext>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient): UseMutationResult<
|
||||
Awaited<ReturnType<typeof changeStatus>>,
|
||||
TError,
|
||||
{placeId: string;data: ReqSiteStatus},
|
||||
TContext
|
||||
> => {
|
||||
|
||||
const mutationOptions = getChangeStatusMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions, queryClient);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user