feat: main 병합 + 인스타 올리기 API(/v1/card/{id}/instagram), 관리자 올릴 곳 선택(로컬·킹서버), 만든 카드 화면
This commit is contained in:
commit
572b2a05c8
188 files changed
+16605
-741
No files matched your search
@@ -3,8 +3,8 @@
|
||||
import { type DefaultError, type InfiniteData, infiniteQueryOptions, queryOptions, type UseMutationOptions } from '@tanstack/react-query';
|
||||
|
||||
import { client } from '../client.gen';
|
||||
import { addComment, addMyGak, addTalk, authConfig, blockTalkAuthor, deleteComment, deleteMyGak, deleteTalk, getArticle, getFeed, getImage, getIndex, getPost, getSeasonWeek, getSky, getSkyRanking, getTalkImage, getTodayGuPage, getTodayPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, googleLogin, healthzHealthzGet, likeComment, likePost, likeTalk, listArticles, listComments, listEvents, listIndices, listMyGak, listPlaces, listRegions, listSaved, listTalks, login, logout, me, nearestRegion, type Options, refresh, reportTalk, savePost, scoreMyGak, signup, unlikeComment, unlikePost, unlikeTalk, unsavePost, updateMe, uploadTalkImage } from '../sdk.gen';
|
||||
import type { AddCommentData, AddCommentError, AddCommentResponse, AddMyGakData, AddMyGakError, AddMyGakResponse, AddTalkData, AddTalkError, AddTalkResponse, AuthConfigData, AuthConfigResponse, BlockTalkAuthorData, BlockTalkAuthorError, BlockTalkAuthorResponse, DeleteCommentData, DeleteCommentError, DeleteCommentResponse, DeleteMyGakData, DeleteMyGakError, DeleteMyGakResponse, DeleteTalkData, DeleteTalkError, DeleteTalkResponse, GetArticleData, GetArticleError, GetArticleResponse, GetFeedData, GetFeedError, GetFeedResponse, GetImageData, GetImageError, GetIndexData, GetIndexError, GetIndexResponse, GetPostData, GetPostError, GetPostResponse, GetSeasonWeekData, GetSeasonWeekResponse, GetSkyData, GetSkyError, GetSkyRankingData, GetSkyRankingResponse, GetSkyResponse, GetTalkImageData, GetTalkImageError, GetTodayGuPageData, GetTodayGuPageError, GetTodayGuPageResponse, GetTodayPageData, GetTodayPageError, GetTodayPageResponse, GetWatchSummaryData, GetWatchSummaryError, GetWatchSummaryResponse, GetWeatherNowData, GetWeatherNowError, GetWeatherNowResponse, GetWeatherTodayData, GetWeatherTodayError, GetWeatherTodayResponse, GetWeekData, GetWeekError, GetWeekRankingData, GetWeekRankingResponse, GetWeekResponse, GoogleLoginData, GoogleLoginError, GoogleLoginResponse, HealthzHealthzGetData, HealthzHealthzGetResponse, LikeCommentData, LikeCommentError, LikeCommentResponse, LikePostData, LikePostError, LikePostResponse, LikeTalkData, LikeTalkError, LikeTalkResponse, ListArticlesData, ListArticlesError, ListArticlesResponse, ListCommentsData, ListCommentsError, ListCommentsResponse, ListEventsData, ListEventsError, ListEventsResponse, ListIndicesData, ListIndicesError, ListIndicesResponse, ListMyGakData, ListMyGakError, ListMyGakResponse, ListPlacesData, ListPlacesError, ListPlacesResponse, ListRegionsData, ListRegionsError, ListRegionsResponse, ListSavedData, ListSavedError, ListSavedResponse, ListTalksData, ListTalksError, ListTalksResponse, LoginData, LoginError, LoginResponse, LogoutData, LogoutError, LogoutResponse, MeData, MeError, MeResponse, NearestRegionData, NearestRegionError, NearestRegionResponse, RefreshData, RefreshError, RefreshResponse, ReportTalkData, ReportTalkError, ReportTalkResponse, SavePostData, SavePostError, SavePostResponse, ScoreMyGakData, ScoreMyGakError, ScoreMyGakResponse, SignupData, SignupError, SignupResponse, UnlikeCommentData, UnlikeCommentError, UnlikeCommentResponse, UnlikePostData, UnlikePostError, UnlikePostResponse, UnlikeTalkData, UnlikeTalkError, UnlikeTalkResponse, UnsavePostData, UnsavePostError, UnsavePostResponse, UpdateMeData, UpdateMeError, UpdateMeResponse, UploadTalkImageData, UploadTalkImageError, UploadTalkImageResponse } from '../types.gen';
|
||||
import { addComment, addMyGak, addTalk, authConfig, blockTalkAuthor, createCard, deleteComment, deleteMyGak, deleteTalk, getArticle, getCardImage, getFeed, getImage, getIndex, getPost, getSeasonWeek, getSky, getSkyRanking, getTalkImage, getTodayGuPage, getTodayPage, getTomorrowGuPage, getTomorrowPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, googleLogin, healthzHealthzGet, likeComment, likePost, likeTalk, listArticles, listCards, listComments, listEvents, listIndices, listMyGak, listMyTalks, listPlaces, listPresets, listRegions, listSaved, listTalks, login, logout, me, nearestRegion, type Options, publishCard, refresh, rejectCard, reportTalk, savePost, scoreMyGak, signup, talkGroups, unlikeComment, unlikePost, unlikeTalk, unsavePost, updateMe, uploadTalkImage } from '../sdk.gen';
|
||||
import type { AddCommentData, AddCommentError, AddCommentResponse, AddMyGakData, AddMyGakError, AddMyGakResponse, AddTalkData, AddTalkError, AddTalkResponse, AuthConfigData, AuthConfigResponse, BlockTalkAuthorData, BlockTalkAuthorError, BlockTalkAuthorResponse, CreateCardData, CreateCardError, CreateCardResponse, DeleteCommentData, DeleteCommentError, DeleteCommentResponse, DeleteMyGakData, DeleteMyGakError, DeleteMyGakResponse, DeleteTalkData, DeleteTalkError, DeleteTalkResponse, GetArticleData, GetArticleError, GetArticleResponse, GetCardImageData, GetCardImageError, GetFeedData, GetFeedError, GetFeedResponse, GetImageData, GetImageError, GetIndexData, GetIndexError, GetIndexResponse, GetPostData, GetPostError, GetPostResponse, GetSeasonWeekData, GetSeasonWeekResponse, GetSkyData, GetSkyError, GetSkyRankingData, GetSkyRankingResponse, GetSkyResponse, GetTalkImageData, GetTalkImageError, GetTodayGuPageData, GetTodayGuPageError, GetTodayGuPageResponse, GetTodayPageData, GetTodayPageError, GetTodayPageResponse, GetTomorrowGuPageData, GetTomorrowGuPageError, GetTomorrowGuPageResponse, GetTomorrowPageData, GetTomorrowPageError, GetTomorrowPageResponse, GetWatchSummaryData, GetWatchSummaryError, GetWatchSummaryResponse, GetWeatherNowData, GetWeatherNowError, GetWeatherNowResponse, GetWeatherTodayData, GetWeatherTodayError, GetWeatherTodayResponse, GetWeekData, GetWeekError, GetWeekRankingData, GetWeekRankingResponse, GetWeekResponse, GoogleLoginData, GoogleLoginError, GoogleLoginResponse, HealthzHealthzGetData, HealthzHealthzGetResponse, LikeCommentData, LikeCommentError, LikeCommentResponse, LikePostData, LikePostError, LikePostResponse, LikeTalkData, LikeTalkError, LikeTalkResponse, ListArticlesData, ListArticlesError, ListArticlesResponse, ListCardsData, ListCardsError, ListCardsResponse, ListCommentsData, ListCommentsError, ListCommentsResponse, ListEventsData, ListEventsError, ListEventsResponse, ListIndicesData, ListIndicesError, ListIndicesResponse, ListMyGakData, ListMyGakError, ListMyGakResponse, ListMyTalksData, ListMyTalksError, ListMyTalksResponse, ListPlacesData, ListPlacesError, ListPlacesResponse, ListPresetsData, ListPresetsResponse, ListRegionsData, ListRegionsError, ListRegionsResponse, ListSavedData, ListSavedError, ListSavedResponse, ListTalksData, ListTalksError, ListTalksResponse, LoginData, LoginError, LoginResponse, LogoutData, LogoutError, LogoutResponse, MeData, MeError, MeResponse, NearestRegionData, NearestRegionError, NearestRegionResponse, PublishCardData, PublishCardError, PublishCardResponse, RefreshData, RefreshError, RefreshResponse, RejectCardData, RejectCardError, RejectCardResponse, ReportTalkData, ReportTalkError, ReportTalkResponse, SavePostData, SavePostError, SavePostResponse, ScoreMyGakData, ScoreMyGakError, ScoreMyGakResponse, SignupData, SignupError, SignupResponse, TalkGroupsData, TalkGroupsError, TalkGroupsResponse, UnlikeCommentData, UnlikeCommentError, UnlikeCommentResponse, UnlikePostData, UnlikePostError, UnlikePostResponse, UnlikeTalkData, UnlikeTalkError, UnlikeTalkResponse, UnsavePostData, UnsavePostError, UnsavePostResponse, UpdateMeData, UpdateMeError, UpdateMeResponse, UploadTalkImageData, UploadTalkImageError, UploadTalkImageResponse } from '../types.gen';
|
||||
|
||||
export type QueryKey<TOptions extends Options> = [
|
||||
Pick<TOptions, 'baseUrl' | 'body' | 'headers' | 'path' | 'query'> & {
|
||||
@@ -78,7 +78,7 @@ export const nearestRegionOptions = (options: Options<NearestRegionData>) => que
|
||||
export const getWeatherTodayQueryKey = (options: Options<GetWeatherTodayData>) => createQueryKey('getWeatherToday', options);
|
||||
|
||||
/**
|
||||
* 오늘 3시간 칸 날씨
|
||||
* 오늘(또는 내일) 3시간 칸 날씨
|
||||
*/
|
||||
export const getWeatherTodayOptions = (options: Options<GetWeatherTodayData>) => queryOptions<GetWeatherTodayResponse, GetWeatherTodayError, GetWeatherTodayResponse, ReturnType<typeof getWeatherTodayQueryKey>>({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
@@ -677,7 +677,7 @@ export const listCommentsInfiniteOptions = (options: Options<ListCommentsData>)
|
||||
};
|
||||
|
||||
/**
|
||||
* 댓글 쓰기 (60자)
|
||||
* 댓글 쓰기 (60자, 로그인 없으면 '동네 익명'으로 IP 당 하루 20개)
|
||||
*/
|
||||
export const addCommentMutation = (options?: Partial<Options<AddCommentData>>): UseMutationOptions<AddCommentResponse, AddCommentError, Options<AddCommentData>> => {
|
||||
const mutationOptions: UseMutationOptions<AddCommentResponse, AddCommentError, Options<AddCommentData>> = {
|
||||
@@ -694,7 +694,7 @@ export const addCommentMutation = (options?: Partial<Options<AddCommentData>>):
|
||||
};
|
||||
|
||||
/**
|
||||
* 내 댓글 지우기
|
||||
* 내 댓글 지우기 (로그인 없이 쓴 댓글은 같은 IP 에서)
|
||||
*/
|
||||
export const deleteCommentMutation = (options?: Partial<Options<DeleteCommentData>>): UseMutationOptions<DeleteCommentResponse, DeleteCommentError, Options<DeleteCommentData>> => {
|
||||
const mutationOptions: UseMutationOptions<DeleteCommentResponse, DeleteCommentError, Options<DeleteCommentData>> = {
|
||||
@@ -779,6 +779,24 @@ export const addMyGakMutation = (options?: Partial<Options<AddMyGakData>>): UseM
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const listPresetsQueryKey = (options?: Options<ListPresetsData>) => createQueryKey('listPresets', options);
|
||||
|
||||
/**
|
||||
* 공식 각을 내 각 조건으로 옮긴 목록 (내 각 만들기에서 골라 채우기)
|
||||
*/
|
||||
export const listPresetsOptions = (options?: Options<ListPresetsData>) => queryOptions<ListPresetsResponse, DefaultError, ListPresetsResponse, ReturnType<typeof listPresetsQueryKey>>({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await listPresets({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: listPresetsQueryKey(options)
|
||||
});
|
||||
|
||||
/**
|
||||
* 조건들의 그 동네 오늘 점수 (로그인 없이, 받은 링크의 각도)
|
||||
*/
|
||||
@@ -813,10 +831,28 @@ export const deleteMyGakMutation = (options?: Partial<Options<DeleteMyGakData>>)
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const talkGroupsQueryKey = (options?: Options<TalkGroupsData>) => createQueryKey('talkGroups', options);
|
||||
|
||||
/**
|
||||
* 오늘 피드 묶음 (동네 사람들 + 주제별, 가까운 동네·덜 지난 글 먼저, 한 사람 한 장)
|
||||
*/
|
||||
export const talkGroupsOptions = (options?: Options<TalkGroupsData>) => queryOptions<TalkGroupsResponse, TalkGroupsError, TalkGroupsResponse, ReturnType<typeof talkGroupsQueryKey>>({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await talkGroups({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: talkGroupsQueryKey(options)
|
||||
});
|
||||
|
||||
export const listTalksQueryKey = (options?: Options<ListTalksData>) => createQueryKey('listTalks', options);
|
||||
|
||||
/**
|
||||
* 동네 이야기 (전국, 최신순, 로그인 없이 보기)
|
||||
* 동네 이야기 (전국 최신순, 보는 동네와 같은 시도 글은 앞으로, 같은 사람 글은 띄움, 로그인 없이 보기)
|
||||
*/
|
||||
export const listTalksOptions = (options?: Options<ListTalksData>) => queryOptions<ListTalksResponse, ListTalksError, ListTalksResponse, ReturnType<typeof listTalksQueryKey>>({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
@@ -834,10 +870,10 @@ export const listTalksOptions = (options?: Options<ListTalksData>) => queryOptio
|
||||
export const listTalksInfiniteQueryKey = (options?: Options<ListTalksData>): QueryKey<Options<ListTalksData>> => createQueryKey('listTalks', options, true);
|
||||
|
||||
/**
|
||||
* 동네 이야기 (전국, 최신순, 로그인 없이 보기)
|
||||
* 동네 이야기 (전국 최신순, 보는 동네와 같은 시도 글은 앞으로, 같은 사람 글은 띄움, 로그인 없이 보기)
|
||||
*/
|
||||
export const listTalksInfiniteOptions = (options?: Options<ListTalksData>) => {
|
||||
const opts = infiniteQueryOptions<ListTalksResponse, ListTalksError, InfiniteData<ListTalksResponse>, QueryKey<Options<ListTalksData>>, number | null | Pick<QueryKey<Options<ListTalksData>>[0], 'body' | 'headers' | 'path' | 'query'>>(
|
||||
const opts = infiniteQueryOptions<ListTalksResponse, ListTalksError, InfiniteData<ListTalksResponse>, QueryKey<Options<ListTalksData>>, string | null | Pick<QueryKey<Options<ListTalksData>>[0], 'body' | 'headers' | 'path' | 'query'>>(
|
||||
// @ts-ignore
|
||||
{
|
||||
queryFn: async ({ pageParam, queryKey, signal }) => {
|
||||
@@ -861,6 +897,54 @@ export const listTalksInfiniteOptions = (options?: Options<ListTalksData>) => {
|
||||
return opts as Omit<typeof opts, 'initialData'>;
|
||||
};
|
||||
|
||||
export const listMyTalksQueryKey = (options?: Options<ListMyTalksData>) => createQueryKey('listMyTalks', options);
|
||||
|
||||
/**
|
||||
* 내가 쓴 글 (최신순)
|
||||
*/
|
||||
export const listMyTalksOptions = (options?: Options<ListMyTalksData>) => queryOptions<ListMyTalksResponse, ListMyTalksError, ListMyTalksResponse, ReturnType<typeof listMyTalksQueryKey>>({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await listMyTalks({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: listMyTalksQueryKey(options)
|
||||
});
|
||||
|
||||
export const listMyTalksInfiniteQueryKey = (options?: Options<ListMyTalksData>): QueryKey<Options<ListMyTalksData>> => createQueryKey('listMyTalks', options, true);
|
||||
|
||||
/**
|
||||
* 내가 쓴 글 (최신순)
|
||||
*/
|
||||
export const listMyTalksInfiniteOptions = (options?: Options<ListMyTalksData>) => {
|
||||
const opts = infiniteQueryOptions<ListMyTalksResponse, ListMyTalksError, InfiniteData<ListMyTalksResponse>, QueryKey<Options<ListMyTalksData>>, string | null | Pick<QueryKey<Options<ListMyTalksData>>[0], 'body' | 'headers' | 'path' | 'query'>>(
|
||||
// @ts-ignore
|
||||
{
|
||||
queryFn: async ({ pageParam, queryKey, signal }) => {
|
||||
// @ts-ignore
|
||||
const page: Pick<QueryKey<Options<ListMyTalksData>>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === 'object' ? pageParam : {
|
||||
query: {
|
||||
cursor: pageParam
|
||||
}
|
||||
};
|
||||
const params = createInfiniteParams(queryKey, page);
|
||||
const { data } = await listMyTalks({
|
||||
...options,
|
||||
...params,
|
||||
signal,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: listMyTalksInfiniteQueryKey(options)
|
||||
});
|
||||
return opts as Omit<typeof opts, 'initialData'>;
|
||||
};
|
||||
|
||||
/**
|
||||
* 동네 이야기 쓰기 (링크·전화번호 불가, 하루 5개)
|
||||
*/
|
||||
@@ -1070,6 +1154,129 @@ export const getTodayGuPageOptions = (options: Options<GetTodayGuPageData>) => q
|
||||
queryKey: getTodayGuPageQueryKey(options)
|
||||
});
|
||||
|
||||
export const getTomorrowPageQueryKey = (options: Options<GetTomorrowPageData>) => createQueryKey('getTomorrowPage', options);
|
||||
|
||||
/**
|
||||
* 지역 내일 날씨 페이지: 정적 HTML 에 내일 예보를 채운다 (nginx 가 /tomorrow/... 를 넘김)
|
||||
*/
|
||||
export const getTomorrowPageOptions = (options: Options<GetTomorrowPageData>) => queryOptions<GetTomorrowPageResponse, GetTomorrowPageError, GetTomorrowPageResponse, ReturnType<typeof getTomorrowPageQueryKey>>({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await getTomorrowPage({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: getTomorrowPageQueryKey(options)
|
||||
});
|
||||
|
||||
export const getTomorrowGuPageQueryKey = (options: Options<GetTomorrowGuPageData>) => createQueryKey('getTomorrowGuPage', options);
|
||||
|
||||
/**
|
||||
* 구로 나뉜 시의 구 내일 날씨 페이지
|
||||
*/
|
||||
export const getTomorrowGuPageOptions = (options: Options<GetTomorrowGuPageData>) => queryOptions<GetTomorrowGuPageResponse, GetTomorrowGuPageError, GetTomorrowGuPageResponse, ReturnType<typeof getTomorrowGuPageQueryKey>>({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await getTomorrowGuPage({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: getTomorrowGuPageQueryKey(options)
|
||||
});
|
||||
|
||||
export const listCardsQueryKey = (options?: Options<ListCardsData>) => createQueryKey('listCards', options);
|
||||
|
||||
/**
|
||||
* 만든 카드뉴스 목록 (관리자). 다시 내려받거나 올릴 때
|
||||
*/
|
||||
export const listCardsOptions = (options?: Options<ListCardsData>) => queryOptions<ListCardsResponse, ListCardsError, ListCardsResponse, ReturnType<typeof listCardsQueryKey>>({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await listCards({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: listCardsQueryKey(options)
|
||||
});
|
||||
|
||||
/**
|
||||
* 카드뉴스 저장 (관리자). publish 면 바로 그날 피드에 올린다
|
||||
*/
|
||||
export const createCardMutation = (options?: Partial<Options<CreateCardData>>): UseMutationOptions<CreateCardResponse, CreateCardError, Options<CreateCardData>> => {
|
||||
const mutationOptions: UseMutationOptions<CreateCardResponse, CreateCardError, Options<CreateCardData>> = {
|
||||
mutationFn: async (fnOptions) => {
|
||||
const { data } = await createCard({
|
||||
...options,
|
||||
...fnOptions,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
}
|
||||
};
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
/**
|
||||
* 승인 대기 카드뉴스를 그날 피드에 올리기 (관리자)
|
||||
*/
|
||||
export const publishCardMutation = (options?: Partial<Options<PublishCardData>>): UseMutationOptions<PublishCardResponse, PublishCardError, Options<PublishCardData>> => {
|
||||
const mutationOptions: UseMutationOptions<PublishCardResponse, PublishCardError, Options<PublishCardData>> = {
|
||||
mutationFn: async (fnOptions) => {
|
||||
const { data } = await publishCard({
|
||||
...options,
|
||||
...fnOptions,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
}
|
||||
};
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
/**
|
||||
* 승인 대기 카드뉴스 반려 (관리자)
|
||||
*/
|
||||
export const rejectCardMutation = (options?: Partial<Options<RejectCardData>>): UseMutationOptions<RejectCardResponse, RejectCardError, Options<RejectCardData>> => {
|
||||
const mutationOptions: UseMutationOptions<RejectCardResponse, RejectCardError, Options<RejectCardData>> = {
|
||||
mutationFn: async (fnOptions) => {
|
||||
const { data } = await rejectCard({
|
||||
...options,
|
||||
...fnOptions,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
}
|
||||
};
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const getCardImageQueryKey = (options: Options<GetCardImageData>) => createQueryKey('getCardImage', options);
|
||||
|
||||
/**
|
||||
* 카드뉴스 이미지
|
||||
*/
|
||||
export const getCardImageOptions = (options: Options<GetCardImageData>) => queryOptions<unknown, GetCardImageError, unknown, ReturnType<typeof getCardImageQueryKey>>({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await getCardImage({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: getCardImageQueryKey(options)
|
||||
});
|
||||
|
||||
export const healthzHealthzGetQueryKey = (options?: Options<HealthzHealthzGetData>) => createQueryKey('healthzHealthzGet', options);
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,4 +13,4 @@ import type { ClientOptions as ClientOptions2 } from './types.gen';
|
||||
*/
|
||||
export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
|
||||
|
||||
export const client: Client = createClient(createConfig<ClientOptions2>({ baseUrl: 'http://localhost:9811', throwOnError: true }));
|
||||
export const client: Client = createClient(createConfig<ClientOptions2>({ throwOnError: true }));
|
||||
@@ -1,4 +1,4 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export { addComment, addMyGak, addTalk, authConfig, blockTalkAuthor, deleteComment, deleteMyGak, deleteTalk, getArticle, getFeed, getImage, getIndex, getPost, getSeasonWeek, getSky, getSkyRanking, getTalkImage, getTodayGuPage, getTodayPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, googleLogin, healthzHealthzGet, likeComment, likePost, likeTalk, listArticles, listComments, listEvents, listIndices, listMyGak, listPlaces, listRegions, listSaved, listTalks, login, logout, me, nearestRegion, type Options, refresh, reportTalk, savePost, scoreMyGak, signup, unlikeComment, unlikePost, unlikeTalk, unsavePost, updateMe, uploadTalkImage } from './sdk.gen';
|
||||
export { type AddCommentData, type AddCommentError, type AddCommentErrors, type AddCommentResponse, type AddCommentResponses, type AddMyGakData, type AddMyGakError, type AddMyGakErrors, type AddMyGakResponse, type AddMyGakResponses, type AddTalkData, type AddTalkError, type AddTalkErrors, type AddTalkResponse, type AddTalkResponses, type AirData, AirGrade, ArticleCategory, type ArticleSummary, type AuthConfigData, type AuthConfigResponse, type AuthConfigResponses, AuthProvider, type BandArticle, type BandEvent, type Bands, type BestTime, type BlockTalkAuthorData, type BlockTalkAuthorError, type BlockTalkAuthorErrors, type BlockTalkAuthorResponse, type BlockTalkAuthorResponses, type BodyUploadTalkImageV1TalkImagePost, type ClientOptions, type CommentData, type CommuteData, Confidence, type Cut, type DayData, type DeleteCommentData, type DeleteCommentError, type DeleteCommentErrors, type DeleteCommentResponse, type DeleteCommentResponses, type DeleteMyGakData, type DeleteMyGakError, type DeleteMyGakErrors, type DeleteMyGakResponse, type DeleteMyGakResponses, type DeleteTalkData, type DeleteTalkError, type DeleteTalkErrors, type DeleteTalkResponse, type DeleteTalkResponses, type ErrorInfo, type EventData, type Factor, type GakSlide, type GetArticleData, type GetArticleError, type GetArticleErrors, type GetArticleResponse, type GetArticleResponses, type GetFeedData, type GetFeedError, type GetFeedErrors, type GetFeedResponse, type GetFeedResponses, type GetImageData, type GetImageError, type GetImageErrors, type GetImageResponses, type GetIndexData, type GetIndexError, type GetIndexErrors, type GetIndexResponse, type GetIndexResponses, type GetPostData, type GetPostError, type GetPostErrors, type GetPostResponse, type GetPostResponses, type GetSeasonWeekData, type GetSeasonWeekResponse, type GetSeasonWeekResponses, type GetSkyData, type GetSkyError, type GetSkyErrors, type GetSkyRankingData, type GetSkyRankingResponse, type GetSkyRankingResponses, type GetSkyResponse, type GetSkyResponses, type GetTalkImageData, type GetTalkImageError, type GetTalkImageErrors, type GetTalkImageResponses, type GetTodayGuPageData, type GetTodayGuPageError, type GetTodayGuPageErrors, type GetTodayGuPageResponse, type GetTodayGuPageResponses, type GetTodayPageData, type GetTodayPageError, type GetTodayPageErrors, type GetTodayPageResponse, type GetTodayPageResponses, type GetWatchSummaryData, type GetWatchSummaryError, type GetWatchSummaryErrors, type GetWatchSummaryResponse, type GetWatchSummaryResponses, type GetWeatherNowData, type GetWeatherNowError, type GetWeatherNowErrors, type GetWeatherNowResponse, type GetWeatherNowResponses, type GetWeatherTodayData, type GetWeatherTodayError, type GetWeatherTodayErrors, type GetWeatherTodayResponse, type GetWeatherTodayResponses, type GetWeekData, type GetWeekError, type GetWeekErrors, type GetWeekRankingData, type GetWeekRankingResponse, type GetWeekRankingResponses, type GetWeekResponse, type GetWeekResponses, type GoogleLoginData, type GoogleLoginError, type GoogleLoginErrors, type GoogleLoginResponse, type GoogleLoginResponses, type HealthzHealthzGetData, type HealthzHealthzGetResponse, type HealthzHealthzGetResponses, type Hero, type HeroStat, type HourCell, type HoursSlide, type HttpValidationError, IndexCategory, type IndexSummary, type LikeCommentData, type LikeCommentError, type LikeCommentErrors, type LikeCommentResponse, type LikeCommentResponses, type LikePostData, type LikePostError, type LikePostErrors, type LikePostResponse, type LikePostResponses, type LikeTalkData, type LikeTalkError, type LikeTalkErrors, type LikeTalkResponse, type LikeTalkResponses, type ListArticlesData, type ListArticlesError, type ListArticlesErrors, type ListArticlesResponse, type ListArticlesResponses, type ListCommentsData, type ListCommentsError, type ListCommentsErrors, type ListCommentsResponse, type ListCommentsResponses, type ListEventsData, type ListEventsError, type ListEventsErrors, type ListEventsResponse, type ListEventsResponses, type ListIndicesData, type ListIndicesError, type ListIndicesErrors, type ListIndicesResponse, type ListIndicesResponses, type ListMyGakData, type ListMyGakError, type ListMyGakErrors, type ListMyGakResponse, type ListMyGakResponses, type ListPlacesData, type ListPlacesError, type ListPlacesErrors, type ListPlacesResponse, type ListPlacesResponses, type ListRegionsData, type ListRegionsError, type ListRegionsErrors, type ListRegionsResponse, type ListRegionsResponses, type ListSavedData, type ListSavedError, type ListSavedErrors, type ListSavedResponse, type ListSavedResponses, type ListTalksData, type ListTalksError, type ListTalksErrors, type ListTalksResponse, type ListTalksResponses, type LoginData, type LoginError, type LoginErrors, type LoginResponse, type LoginResponses, type LogoutData, type LogoutError, type LogoutErrors, type LogoutResponse, type LogoutResponses, type Me, type MeData, type MeError, type MeErrors, type MeResponse, type MeResponses,
Line truncated
|
||||
export { addComment, addMyGak, addTalk, authConfig, blockTalkAuthor, createCard, deleteComment, deleteMyGak, deleteTalk, getArticle, getCardImage, getFeed, getImage, getIndex, getPost, getSeasonWeek, getSky, getSkyRanking, getTalkImage, getTodayGuPage, getTodayPage, getTomorrowGuPage, getTomorrowPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, googleLogin, healthzHealthzGet, likeComment, likePost, likeTalk, listArticles, listCards, listComments, listEvents, listIndices, listMyGak, listMyTalks, listPlaces, listPresets, listRegions, listSaved, listTalks, login, logout, me, nearestRegion, type Options, publishCard, refresh, rejectCard, reportTalk, savePost, scoreMyGak, signup, talkGroups, unlikeComment, unlikePost, unlikeTalk, unsavePost, updateMe, uploadTalkImage } from './sdk.gen';
|
||||
export { type AddCommentData, type AddCommentError, type AddCommentErrors, type AddCommentResponse, type AddCommentResponses, type AddMyGakData, type AddMyGakError, type AddMyGakErrors, type AddMyGakResponse, type AddMyGakResponses, type AddTalkData, type AddTalkError, type AddTalkErrors, type AddTalkResponse, type AddTalkResponses, type AirData, AirGrade, ArticleCategory, type ArticleSummary, type AuthConfigData, type AuthConfigResponse, type AuthConfigResponses, AuthProvider, type BandArticle, type BandEvent, type Bands, type BestTime, type BlockTalkAuthorData, type BlockTalkAuthorError, type BlockTalkAuthorErrors, type BlockTalkAuthorResponse, type BlockTalkAuthorResponses, type BodyUploadTalkImageV1TalkImagePost, type CardItem, CardStatus, type ClientOptions, type CommentData, type CommuteData, Confidence, type CreateCardData, type CreateCardError, type CreateCardErrors, type CreateCardResponse, type CreateCardResponses, type Cut, type DayData, type DeleteCommentData, type DeleteCommentError, type DeleteCommentErrors, type DeleteCommentResponse, type DeleteCommentResponses, type DeleteMyGakData, type DeleteMyGakError, type DeleteMyGakErrors, type DeleteMyGakResponse, type DeleteMyGakResponses, type DeleteTalkData, type DeleteTalkError, type DeleteTalkErrors, type DeleteTalkResponse, type DeleteTalkResponses, type ErrorInfo, type EventData, type Factor, type GakSlide, type GetArticleData, type GetArticleError, type GetArticleErrors, type GetArticleResponse, type GetArticleResponses, type GetCardImageData, type GetCardImageError, type GetCardImageErrors, type GetCardImageResponses, type GetFeedData, type GetFeedError, type GetFeedErrors, type GetFeedResponse, type GetFeedResponses, type GetImageData, type GetImageError, type GetImageErrors, type GetImageResponses, type GetIndexData, type GetIndexError, type GetIndexErrors, type GetIndexResponse, type GetIndexResponses, type GetPostData, type GetPostError, type GetPostErrors, type GetPostResponse, type GetPostResponses, type GetSeasonWeekData, type GetSeasonWeekResponse, type GetSeasonWeekResponses, type GetSkyData, type GetSkyError, type GetSkyErrors, type GetSkyRankingData, type GetSkyRankingResponse, type GetSkyRankingResponses, type GetSkyResponse, type GetSkyResponses, type GetTalkImageData, type GetTalkImageError, type GetTalkImageErrors, type GetTalkImageResponses, type GetTodayGuPageData, type GetTodayGuPageError, type GetTodayGuPageErrors, type GetTodayGuPageResponse, type GetTodayGuPageResponses, type GetTodayPageData, type GetTodayPageError, type GetTodayPageErrors, type GetTodayPageResponse, type GetTodayPageResponses, type GetTomorrowGuPageData, type GetTomorrowGuPageError, type GetTomorrowGuPageErrors, type GetTomorrowGuPageResponse, type GetTomorrowGuPageResponses, type GetTomorrowPageData, type GetTomorrowPageError, type GetTomorrowPageErrors, type GetTomorrowPageResponse, type GetTomorrowPageResponses, type GetWatchSummaryData, type GetWatchSummaryError, type GetWatchSummaryErrors, type GetWatchSummaryResponse, type GetWatchSummaryResponses, type GetWeatherNowData, type GetWeatherNowError, type GetWeatherNowErrors, type GetWeatherNowResponse, type GetWeatherNowResponses, type GetWeatherTodayData, type GetWeatherTodayError, type GetWeatherTodayErrors, type GetWeatherTodayResponse, type GetWeatherTodayResponses, type GetWeekData, type GetWeekError, type GetWeekErrors, type GetWeekRankingData, type GetWeekRankingResponse, type GetWeekRankingResponses, type GetWeekResponse, type GetWeekResponses, type GoogleLoginData, type GoogleLoginError, type GoogleLoginErrors, type GoogleLoginResponse, type GoogleLoginResponses, type HealthzHealthzGetData, type HealthzHealthzGetResponse, type HealthzHealthzGetResponses, type Hero, type HeroStat, type HeroTomorrow, type HourCell, type HoursSlide, type HttpValidationError, type ImageSlide, IndexCategory, type IndexSummary, type LikeCommentData, type LikeCommentError, type LikeCommentErrors, type LikeCommentResponse, type LikeCommentResponses, type LikePostData, type LikePostError, type LikePostErrors, type LikePostResponse, type LikePostResponses, type LikeTalkData, type LikeTalkError, type LikeTalkErrors, type LikeTalkResponse, type LikeTalkResponses, type ListArticlesData, type ListArticlesError, type ListArticlesErrors, type ListArticlesResponse, type ListArticlesResponses, type ListCardsData, type ListCardsError, type ListCardsErrors, type ListCardsResponse, type ListCardsResponses, type ListCommentsData, type ListCommentsError, type ListCommentsErrors, type ListCommentsResponse, type ListCommentsResponses, type ListEventsData, type ListEventsError, type ListEventsErrors, type ListEventsResponse, type ListEventsResponses, type ListIndicesData, type ListIndicesError, type ListIndicesErrors, type ListIndicesResponse, type ListIndicesResponses, type ListMyGakData, type ListMyGakError, type ListMyGakErrors, type ListMyGakResponse, type ListMyGakResponses, type ListMyTalksData, type ListMyTalksError, type LiLine truncated
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { type Client, type ClientMeta, formDataBodySerializer, type Options as Options2, type RequestResult, type TDataShape } from './client';
|
||||
import { client } from './client.gen';
|
||||
import type { AddCommentData, AddCommentErrors, AddCommentResponses, AddMyGakData, AddMyGakErrors, AddMyGakResponses, AddTalkData, AddTalkErrors, AddTalkResponses, AuthConfigData, AuthConfigResponses, BlockTalkAuthorData, BlockTalkAuthorErrors, BlockTalkAuthorResponses, DeleteCommentData, DeleteCommentErrors, DeleteCommentResponses, DeleteMyGakData, DeleteMyGakErrors, DeleteMyGakResponses, DeleteTalkData, DeleteTalkErrors, DeleteTalkResponses, GetArticleData, GetArticleErrors, GetArticleResponses, GetFeedData, GetFeedErrors, GetFeedResponses, GetImageData, GetImageErrors, GetImageResponses, GetIndexData, GetIndexErrors, GetIndexResponses, GetPostData, GetPostErrors, GetPostResponses, GetSeasonWeekData, GetSeasonWeekResponses, GetSkyData, GetSkyErrors, GetSkyRankingData, GetSkyRankingResponses, GetSkyResponses, GetTalkImageData, GetTalkImageErrors, GetTalkImageResponses, GetTodayGuPageData, GetTodayGuPageErrors, GetTodayGuPageResponses, GetTodayPageData, GetTodayPageErrors, GetTodayPageResponses, GetWatchSummaryData, GetWatchSummaryErrors, GetWatchSummaryResponses, GetWeatherNowData, GetWeatherNowErrors, GetWeatherNowResponses, GetWeatherTodayData, GetWeatherTodayErrors, GetWeatherTodayResponses, GetWeekData, GetWeekErrors, GetWeekRankingData, GetWeekRankingResponses, GetWeekResponses, GoogleLoginData, GoogleLoginErrors, GoogleLoginResponses, HealthzHealthzGetData, HealthzHealthzGetResponses, LikeCommentData, LikeCommentErrors, LikeCommentResponses, LikePostData, LikePostErrors, LikePostResponses, LikeTalkData, LikeTalkErrors, LikeTalkResponses, ListArticlesData, ListArticlesErrors, ListArticlesResponses, ListCommentsData, ListCommentsErrors, ListCommentsResponses, ListEventsData, ListEventsErrors, ListEventsResponses, ListIndicesData, ListIndicesErrors, ListIndicesResponses, ListMyGakData, ListMyGakErrors, ListMyGakResponses, ListPlacesData, ListPlacesErrors, ListPlacesResponses, ListRegionsData, ListRegionsErrors, ListRegionsResponses, ListSavedData, ListSavedErrors, ListSavedResponses, ListTalksData, ListTalksErrors, ListTalksResponses, LoginData, LoginErrors, LoginResponses, LogoutData, LogoutErrors, LogoutResponses, MeData, MeErrors, MeResponses, NearestRegionData, NearestRegionErrors, NearestRegionResponses, RefreshData, RefreshErrors, RefreshResponses, ReportTalkData, ReportTalkErrors, ReportTalkResponses, SavePostData, SavePostErrors, SavePostResponses, ScoreMyGakData, ScoreMyGakErrors, ScoreMyGakResponses, SignupData, SignupErrors, SignupResponses, UnlikeCommentData, UnlikeCommentErrors, UnlikeCommentResponses, UnlikePostData, UnlikePostErrors, UnlikePostResponses, UnlikeTalkData, UnlikeTalkErrors, UnlikeTalkResponses, UnsavePostData, UnsavePostErrors, UnsavePostResponses, UpdateMeData, UpdateMeErrors, UpdateMeResponses, UploadTalkImageData, UploadTalkImageErrors, UploadTalkImageResponses } from './types.gen';
|
||||
import type { AddCommentData, AddCommentErrors, AddCommentResponses, AddMyGakData, AddMyGakErrors, AddMyGakResponses, AddTalkData, AddTalkErrors, AddTalkResponses, AuthConfigData, AuthConfigResponses, BlockTalkAuthorData, BlockTalkAuthorErrors, BlockTalkAuthorResponses, CreateCardData, CreateCardErrors, CreateCardResponses, DeleteCommentData, DeleteCommentErrors, DeleteCommentResponses, DeleteMyGakData, DeleteMyGakErrors, DeleteMyGakResponses, DeleteTalkData, DeleteTalkErrors, DeleteTalkResponses, GetArticleData, GetArticleErrors, GetArticleResponses, GetCardImageData, GetCardImageErrors, GetCardImageResponses, GetFeedData, GetFeedErrors, GetFeedResponses, GetImageData, GetImageErrors, GetImageResponses, GetIndexData, GetIndexErrors, GetIndexResponses, GetPostData, GetPostErrors, GetPostResponses, GetSeasonWeekData, GetSeasonWeekResponses, GetSkyData, GetSkyErrors, GetSkyRankingData, GetSkyRankingResponses, GetSkyResponses, GetTalkImageData, GetTalkImageErrors, GetTalkImageResponses, GetTodayGuPageData, GetTodayGuPageErrors, GetTodayGuPageResponses, GetTodayPageData, GetTodayPageErrors, GetTodayPageResponses, GetTomorrowGuPageData, GetTomorrowGuPageErrors, GetTomorrowGuPageResponses, GetTomorrowPageData, GetTomorrowPageErrors, GetTomorrowPageResponses, GetWatchSummaryData, GetWatchSummaryErrors, GetWatchSummaryResponses, GetWeatherNowData, GetWeatherNowErrors, GetWeatherNowResponses, GetWeatherTodayData, GetWeatherTodayErrors, GetWeatherTodayResponses, GetWeekData, GetWeekErrors, GetWeekRankingData, GetWeekRankingResponses, GetWeekResponses, GoogleLoginData, GoogleLoginErrors, GoogleLoginResponses, HealthzHealthzGetData, HealthzHealthzGetResponses, LikeCommentData, LikeCommentErrors, LikeCommentResponses, LikePostData, LikePostErrors, LikePostResponses, LikeTalkData, LikeTalkErrors, LikeTalkResponses, ListArticlesData, ListArticlesErrors, ListArticlesResponses, ListCardsData, ListCardsErrors, ListCardsResponses, ListCommentsData, ListCommentsErrors, ListCommentsResponses, ListEventsData, ListEventsErrors, ListEventsResponses, ListIndicesData, ListIndicesErrors, ListIndicesResponses, ListMyGakData, ListMyGakErrors, ListMyGakResponses, ListMyTalksData, ListMyTalksErrors, ListMyTalksResponses, ListPlacesData, ListPlacesErrors, ListPlacesResponses, ListPresetsData, ListPresetsResponses, ListRegionsData, ListRegionsErrors, ListRegionsResponses, ListSavedData, ListSavedErrors, ListSavedResponses, ListTalksData, ListTalksErrors, ListTalksResponses, LoginData, LoginErrors, LoginResponses, LogoutData, LogoutErrors, LogoutResponses, MeData, MeErrors, MeResponses, NearestRegionData, NearestRegionErrors, NearestRegionResponses, PublishCardData, PublishCardErrors, PublishCardResponses, RefreshData, RefreshErrors, RefreshResponses, RejectCardData, RejectCardErrors, RejectCardResponses, ReportTalkData, ReportTalkErrors, ReportTalkResponses, SavePostData, SavePostErrors, SavePostResponses, ScoreMyGakData, ScoreMyGakErrors, ScoreMyGakResponses, SignupData, SignupErrors, SignupResponses, TalkGroupsData, TalkGroupsErrors, TalkGroupsResponses, UnlikeCommentData, UnlikeCommentErrors, UnlikeCommentResponses, UnlikePostData, UnlikePostErrors, UnlikePostResponses, UnlikeTalkData, UnlikeTalkErrors, UnlikeTalkResponses, UnsavePostData, UnsavePostErrors, UnsavePostResponses, UpdateMeData, UpdateMeErrors, UpdateMeResponses, UploadTalkImageData, UploadTalkImageErrors, UploadTalkImageResponses } from './types.gen';
|
||||
|
||||
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
|
||||
/**
|
||||
@@ -29,7 +29,7 @@ export const listRegions = <ThrowOnError extends boolean = true>(options?: Optio
|
||||
export const nearestRegion = <ThrowOnError extends boolean = true>(options: Options<NearestRegionData, ThrowOnError>): RequestResult<NearestRegionResponses, NearestRegionErrors, ThrowOnError> => (options.client ?? client).get<NearestRegionResponses, NearestRegionErrors, ThrowOnError>({ url: '/v1/region/nearest', ...options });
|
||||
|
||||
/**
|
||||
* 오늘 3시간 칸 날씨
|
||||
* 오늘(또는 내일) 3시간 칸 날씨
|
||||
*/
|
||||
export const getWeatherToday = <ThrowOnError extends boolean = true>(options: Options<GetWeatherTodayData, ThrowOnError>): RequestResult<GetWeatherTodayResponses, GetWeatherTodayErrors, ThrowOnError> => (options.client ?? client).get<GetWeatherTodayResponses, GetWeatherTodayErrors, ThrowOnError>({ url: '/v1/weather/today', ...options });
|
||||
|
||||
@@ -209,7 +209,7 @@ export const listSaved = <ThrowOnError extends boolean = true>(options?: Options
|
||||
export const listComments = <ThrowOnError extends boolean = true>(options: Options<ListCommentsData, ThrowOnError>): RequestResult<ListCommentsResponses, ListCommentsErrors, ThrowOnError> => (options.client ?? client).get<ListCommentsResponses, ListCommentsErrors, ThrowOnError>({ url: '/v1/reaction/post/{post_id}/comment/list', ...options });
|
||||
|
||||
/**
|
||||
* 댓글 쓰기 (60자)
|
||||
* 댓글 쓰기 (60자, 로그인 없으면 '동네 익명'으로 IP 당 하루 20개)
|
||||
*/
|
||||
export const addComment = <ThrowOnError extends boolean = true>(options: Options<AddCommentData, ThrowOnError>): RequestResult<AddCommentResponses, AddCommentErrors, ThrowOnError> => (options.client ?? client).post<AddCommentResponses, AddCommentErrors, ThrowOnError>({
|
||||
url: '/v1/reaction/post/{post_id}/comment',
|
||||
@@ -221,7 +221,7 @@ export const addComment = <ThrowOnError extends boolean = true>(options: Options
|
||||
});
|
||||
|
||||
/**
|
||||
* 내 댓글 지우기
|
||||
* 내 댓글 지우기 (로그인 없이 쓴 댓글은 같은 IP 에서)
|
||||
*/
|
||||
export const deleteComment = <ThrowOnError extends boolean = true>(options: Options<DeleteCommentData, ThrowOnError>): RequestResult<DeleteCommentResponses, DeleteCommentErrors, ThrowOnError> => (options.client ?? client).delete<DeleteCommentResponses, DeleteCommentErrors, ThrowOnError>({ url: '/v1/reaction/comment/{comment_id}', ...options });
|
||||
|
||||
@@ -252,6 +252,11 @@ export const addMyGak = <ThrowOnError extends boolean = true>(options: Options<A
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 공식 각을 내 각 조건으로 옮긴 목록 (내 각 만들기에서 골라 채우기)
|
||||
*/
|
||||
export const listPresets = <ThrowOnError extends boolean = true>(options?: Options<ListPresetsData, ThrowOnError>): RequestResult<ListPresetsResponses, unknown, ThrowOnError> => (options?.client ?? client).get<ListPresetsResponses, unknown, ThrowOnError>({ url: '/v1/my-gak/presets', ...options });
|
||||
|
||||
/**
|
||||
* 조건들의 그 동네 오늘 점수 (로그인 없이, 받은 링크의 각도)
|
||||
*/
|
||||
@@ -270,10 +275,20 @@ export const scoreMyGak = <ThrowOnError extends boolean = true>(options: Options
|
||||
export const deleteMyGak = <ThrowOnError extends boolean = true>(options: Options<DeleteMyGakData, ThrowOnError>): RequestResult<DeleteMyGakResponses, DeleteMyGakErrors, ThrowOnError> => (options.client ?? client).delete<DeleteMyGakResponses, DeleteMyGakErrors, ThrowOnError>({ url: '/v1/my-gak/{my_gak_id}', ...options });
|
||||
|
||||
/**
|
||||
* 동네 이야기 (전국, 최신순, 로그인 없이 보기)
|
||||
* 오늘 피드 묶음 (동네 사람들 + 주제별, 가까운 동네·덜 지난 글 먼저, 한 사람 한 장)
|
||||
*/
|
||||
export const talkGroups = <ThrowOnError extends boolean = true>(options?: Options<TalkGroupsData, ThrowOnError>): RequestResult<TalkGroupsResponses, TalkGroupsErrors, ThrowOnError> => (options?.client ?? client).get<TalkGroupsResponses, TalkGroupsErrors, ThrowOnError>({ url: '/v1/talk/groups', ...options });
|
||||
|
||||
/**
|
||||
* 동네 이야기 (전국 최신순, 보는 동네와 같은 시도 글은 앞으로, 같은 사람 글은 띄움, 로그인 없이 보기)
|
||||
*/
|
||||
export const listTalks = <ThrowOnError extends boolean = true>(options?: Options<ListTalksData, ThrowOnError>): RequestResult<ListTalksResponses, ListTalksErrors, ThrowOnError> => (options?.client ?? client).get<ListTalksResponses, ListTalksErrors, ThrowOnError>({ url: '/v1/talk/list', ...options });
|
||||
|
||||
/**
|
||||
* 내가 쓴 글 (최신순)
|
||||
*/
|
||||
export const listMyTalks = <ThrowOnError extends boolean = true>(options?: Options<ListMyTalksData, ThrowOnError>): RequestResult<ListMyTalksResponses, ListMyTalksErrors, ThrowOnError> => (options?.client ?? client).get<ListMyTalksResponses, ListMyTalksErrors, ThrowOnError>({ url: '/v1/talk/mine', ...options });
|
||||
|
||||
/**
|
||||
* 동네 이야기 쓰기 (링크·전화번호 불가, 하루 5개)
|
||||
*/
|
||||
@@ -356,6 +371,48 @@ export const getTodayPage = <ThrowOnError extends boolean = true>(options: Optio
|
||||
*/
|
||||
export const getTodayGuPage = <ThrowOnError extends boolean = true>(options: Options<GetTodayGuPageData, ThrowOnError>): RequestResult<GetTodayGuPageResponses, GetTodayGuPageErrors, ThrowOnError> => (options.client ?? client).get<GetTodayGuPageResponses, GetTodayGuPageErrors, ThrowOnError>({ url: '/v1/seo/today/{sido}/{place}/{gu}', ...options });
|
||||
|
||||
/**
|
||||
* 지역 내일 날씨 페이지: 정적 HTML 에 내일 예보를 채운다 (nginx 가 /tomorrow/... 를 넘김)
|
||||
*/
|
||||
export const getTomorrowPage = <ThrowOnError extends boolean = true>(options: Options<GetTomorrowPageData, ThrowOnError>): RequestResult<GetTomorrowPageResponses, GetTomorrowPageErrors, ThrowOnError> => (options.client ?? client).get<GetTomorrowPageResponses, GetTomorrowPageErrors, ThrowOnError>({ url: '/v1/seo/tomorrow/{sido}/{place}', ...options });
|
||||
|
||||
/**
|
||||
* 구로 나뉜 시의 구 내일 날씨 페이지
|
||||
*/
|
||||
export const getTomorrowGuPage = <ThrowOnError extends boolean = true>(options: Options<GetTomorrowGuPageData, ThrowOnError>): RequestResult<GetTomorrowGuPageResponses, GetTomorrowGuPageErrors, ThrowOnError> => (options.client ?? client).get<GetTomorrowGuPageResponses, GetTomorrowGuPageErrors, ThrowOnError>({ url: '/v1/seo/tomorrow/{sido}/{place}/{gu}', ...options });
|
||||
|
||||
/**
|
||||
* 만든 카드뉴스 목록 (관리자). 다시 내려받거나 올릴 때
|
||||
*/
|
||||
export const listCards = <ThrowOnError extends boolean = true>(options?: Options<ListCardsData, ThrowOnError>): RequestResult<ListCardsResponses, ListCardsErrors, ThrowOnError> => (options?.client ?? client).get<ListCardsResponses, ListCardsErrors, ThrowOnError>({ url: '/v1/card', ...options });
|
||||
|
||||
/**
|
||||
* 카드뉴스 저장 (관리자). publish 면 바로 그날 피드에 올린다
|
||||
*/
|
||||
export const createCard = <ThrowOnError extends boolean = true>(options: Options<CreateCardData, ThrowOnError>): RequestResult<CreateCardResponses, CreateCardErrors, ThrowOnError> => (options.client ?? client).post<CreateCardResponses, CreateCardErrors, ThrowOnError>({
|
||||
url: '/v1/card',
|
||||
...options,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...options.headers
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 승인 대기 카드뉴스를 그날 피드에 올리기 (관리자)
|
||||
*/
|
||||
export const publishCard = <ThrowOnError extends boolean = true>(options: Options<PublishCardData, ThrowOnError>): RequestResult<PublishCardResponses, PublishCardErrors, ThrowOnError> => (options.client ?? client).post<PublishCardResponses, PublishCardErrors, ThrowOnError>({ url: '/v1/card/{card_id}/publish', ...options });
|
||||
|
||||
/**
|
||||
* 승인 대기 카드뉴스 반려 (관리자)
|
||||
*/
|
||||
export const rejectCard = <ThrowOnError extends boolean = true>(options: Options<RejectCardData, ThrowOnError>): RequestResult<RejectCardResponses, RejectCardErrors, ThrowOnError> => (options.client ?? client).post<RejectCardResponses, RejectCardErrors, ThrowOnError>({ url: '/v1/card/{card_id}/reject', ...options });
|
||||
|
||||
/**
|
||||
* 카드뉴스 이미지
|
||||
*/
|
||||
export const getCardImage = <ThrowOnError extends boolean = true>(options: Options<GetCardImageData, ThrowOnError>): RequestResult<GetCardImageResponses, GetCardImageErrors, ThrowOnError> => (options.client ?? client).get<GetCardImageResponses, GetCardImageErrors, ThrowOnError>({ url: '/v1/card/{card_id}/{seq}.jpg', ...options });
|
||||
|
||||
/**
|
||||
* 헬스체크
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type ClientOptions = {
|
||||
baseUrl: 'http://localhost:9811' | (string & {});
|
||||
baseUrl: `${string}://${string}` | (string & {});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -248,6 +248,68 @@ export type BodyUploadTalkImageV1TalkImagePost = {
|
||||
file: Blob | File;
|
||||
};
|
||||
|
||||
/**
|
||||
* CardItem
|
||||
*/
|
||||
export type CardItem = {
|
||||
/**
|
||||
* Card Id
|
||||
*/
|
||||
card_id: number;
|
||||
/**
|
||||
* Template
|
||||
*/
|
||||
template: string;
|
||||
/**
|
||||
* Topic
|
||||
*/
|
||||
topic?: string | null;
|
||||
/**
|
||||
* Title
|
||||
*/
|
||||
title: string;
|
||||
status: CardStatus;
|
||||
/**
|
||||
* Post Id
|
||||
*/
|
||||
post_id?: number | null;
|
||||
/**
|
||||
* Created At
|
||||
*/
|
||||
created_at: string;
|
||||
/**
|
||||
* Published At
|
||||
*/
|
||||
published_at?: string | null;
|
||||
/**
|
||||
* Image Urls
|
||||
*/
|
||||
image_urls?: Array<string>;
|
||||
};
|
||||
|
||||
/**
|
||||
* CardStatus
|
||||
*/
|
||||
export const CardStatus = {
|
||||
/**
|
||||
* WAITING
|
||||
*/
|
||||
WAITING: 1,
|
||||
/**
|
||||
* PUBLISHED
|
||||
*/
|
||||
PUBLISHED: 2,
|
||||
/**
|
||||
* REJECTED
|
||||
*/
|
||||
REJECTED: 3
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* CardStatus
|
||||
*/
|
||||
export type CardStatus = typeof CardStatus[keyof typeof CardStatus];
|
||||
|
||||
/**
|
||||
* CommentData
|
||||
*/
|
||||
@@ -545,6 +607,18 @@ export type GakSlide = {
|
||||
* Summary
|
||||
*/
|
||||
summary: string;
|
||||
/**
|
||||
* Rows
|
||||
*
|
||||
* 점수 근거: 비중 큰 날씨 조건부터 네 개와 지금 값 (기온 · 체감 18°)
|
||||
*/
|
||||
rows?: Array<Row>;
|
||||
/**
|
||||
* Say
|
||||
*
|
||||
* 점수 구간 설명 문장 (seed sentences)
|
||||
*/
|
||||
say?: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -613,6 +687,14 @@ export type Hero = {
|
||||
weather_slots?: {
|
||||
[key: string]: number;
|
||||
};
|
||||
/**
|
||||
* Weather Why
|
||||
*
|
||||
* 구간별 날씨 점수 근거(조건·비중·조건 점수·지금 값). 키는 weather_slots 와 같다
|
||||
*/
|
||||
weather_why?: {
|
||||
[key: string]: Array<WeatherWhy>;
|
||||
};
|
||||
top1?: TopIndex | null;
|
||||
/**
|
||||
* Bubble
|
||||
@@ -642,6 +724,7 @@ export type Hero = {
|
||||
* 히어로 상태 한 줄: 습도·불쾌지수·자외선(밤 구간 빼고)·미세먼지 단계 이름. tone=warn 이면 조심(앱이 주황 글자로)
|
||||
*/
|
||||
status?: Array<HeroStat>;
|
||||
tomorrow?: HeroTomorrow | null;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -666,6 +749,44 @@ export type HeroStat = {
|
||||
* normal=기본, warn=조심(노랑), rain=비(파랑)
|
||||
*/
|
||||
tone: 'normal' | 'warn' | 'rain';
|
||||
/**
|
||||
* Detail
|
||||
*
|
||||
* 단계 이름 밑의 실제 값 (예: 68%, 72, 2, 초미세먼지 15㎍/㎥). 상태 줄에만
|
||||
*/
|
||||
detail?: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* HeroTomorrow
|
||||
*
|
||||
* 히어로 '내일' 스위치. 3시간 칸 날씨는 /v1/weather/today?day=tomorrow 로 따로 받는다.
|
||||
*/
|
||||
export type HeroTomorrow = {
|
||||
/**
|
||||
* Day
|
||||
*/
|
||||
day: string;
|
||||
/**
|
||||
* Weather Slots
|
||||
*
|
||||
* 내일 구간별 날씨 점수 {morning·day·evening·night: 점수}
|
||||
*/
|
||||
weather_slots?: {
|
||||
[key: string]: number;
|
||||
};
|
||||
/**
|
||||
* Weather Why
|
||||
*
|
||||
* 내일 구간별 날씨 점수 근거
|
||||
*/
|
||||
weather_why?: {
|
||||
[key: string]: Array<WeatherWhy>;
|
||||
};
|
||||
/**
|
||||
* 내일 하루 점수로 1위인 각. score·summary 는 내일 값
|
||||
*/
|
||||
top1?: TopIndex | null;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -709,6 +830,26 @@ export type HoursSlide = {
|
||||
hours: Array<HourCell>;
|
||||
};
|
||||
|
||||
/**
|
||||
* ImageSlide
|
||||
*
|
||||
* 카드뉴스 한 장 (1080×1350 JPEG). url 은 같은 서버의 /v1/card/... 경로.
|
||||
*/
|
||||
export type ImageSlide = {
|
||||
/**
|
||||
* Kind
|
||||
*/
|
||||
kind: 'image';
|
||||
/**
|
||||
* Url
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* Alt
|
||||
*/
|
||||
alt?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* IndexCategory
|
||||
*/
|
||||
@@ -855,6 +996,28 @@ export type MyGakData = {
|
||||
rule: MyGakRule;
|
||||
};
|
||||
|
||||
/**
|
||||
* MyGakPreset
|
||||
*/
|
||||
export type MyGakPreset = {
|
||||
/**
|
||||
* Code
|
||||
*/
|
||||
code: string;
|
||||
/**
|
||||
* Name
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Icon
|
||||
*/
|
||||
icon: string;
|
||||
/**
|
||||
* 공식 각을 내 각 조건으로 비슷하게 옮긴 값. 점수는 공식 각과 다를 수 있음
|
||||
*/
|
||||
rule: MyGakRule;
|
||||
};
|
||||
|
||||
/**
|
||||
* MyGakRule
|
||||
*/
|
||||
@@ -1077,7 +1240,7 @@ export type PostData = {
|
||||
/**
|
||||
* Slides
|
||||
*/
|
||||
slides: Array<HoursSlide | RowsSlide | GakSlide | SunsetSlide | WeekSlide | PlanSlide>;
|
||||
slides: Array<HoursSlide | RowsSlide | GakSlide | SunsetSlide | WeekSlide | PlanSlide | ImageSlide>;
|
||||
/**
|
||||
* Share Messages
|
||||
*/
|
||||
@@ -1108,6 +1271,30 @@ export type PostData = {
|
||||
saved?: boolean | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* PostReaction
|
||||
*
|
||||
* 포스트 틀이 아닌 카드(히어로·오늘의 각·단풍 지도·띠)에 붙는 좋아요·댓글.
|
||||
*/
|
||||
export type PostReaction = {
|
||||
/**
|
||||
* Post Id
|
||||
*/
|
||||
post_id: number;
|
||||
/**
|
||||
* Like Count
|
||||
*/
|
||||
like_count: number;
|
||||
/**
|
||||
* Comment Count
|
||||
*/
|
||||
comment_count: number;
|
||||
/**
|
||||
* Liked
|
||||
*/
|
||||
liked?: boolean | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* PostType
|
||||
*/
|
||||
@@ -1171,7 +1358,31 @@ export const PostType = {
|
||||
/**
|
||||
* UV
|
||||
*/
|
||||
UV: 15
|
||||
UV: 15,
|
||||
/**
|
||||
* HERO
|
||||
*/
|
||||
HERO: 16,
|
||||
/**
|
||||
* TODAY_GAK
|
||||
*/
|
||||
TODAY_GAK: 17,
|
||||
/**
|
||||
* FOLIAGE
|
||||
*/
|
||||
FOLIAGE: 18,
|
||||
/**
|
||||
* EVENTS_BAND
|
||||
*/
|
||||
EVENTS_BAND: 19,
|
||||
/**
|
||||
* SEASON_BAND
|
||||
*/
|
||||
SEASON_BAND: 20,
|
||||
/**
|
||||
* CARD
|
||||
*/
|
||||
CARD: 21
|
||||
} as const;
|
||||
|
||||
/**
|
||||
@@ -1300,6 +1511,50 @@ export type RegionData = {
|
||||
lon: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Req_CardCreate
|
||||
*/
|
||||
export type ReqCardCreate = {
|
||||
/**
|
||||
* Template
|
||||
*/
|
||||
template: string;
|
||||
/**
|
||||
* Topic
|
||||
*/
|
||||
topic?: string | null;
|
||||
/**
|
||||
* Title
|
||||
*
|
||||
* 피드 포스트 제목
|
||||
*/
|
||||
title: string;
|
||||
/**
|
||||
* Caption
|
||||
*/
|
||||
caption?: string;
|
||||
/**
|
||||
* Texts
|
||||
*
|
||||
* 카드 문구 (다시 그릴 때 쓴다)
|
||||
*/
|
||||
texts?: {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
/**
|
||||
* Images
|
||||
*
|
||||
* 1080×1350 JPEG, base64. 슬라이드 순서대로
|
||||
*/
|
||||
images: Array<string>;
|
||||
/**
|
||||
* Publish
|
||||
*
|
||||
* true 면 만들자마자 그날 피드에 올린다. false 면 승인 대기
|
||||
*/
|
||||
publish?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Req_Comment
|
||||
*/
|
||||
@@ -1308,6 +1563,12 @@ export type ReqComment = {
|
||||
* Body
|
||||
*/
|
||||
body: string;
|
||||
/**
|
||||
* Region
|
||||
*
|
||||
* 로그인 없이 쓸 때 보고 있는 동네 코드. 이름이 '마포구 익명'으로 보인다
|
||||
*/
|
||||
region?: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1411,6 +1672,10 @@ export type ReqTalk = {
|
||||
* 먼저 올린 사진 주소 (POST /v1/talk/image 결과)
|
||||
*/
|
||||
image?: string | null;
|
||||
/**
|
||||
* 글 주제. 안 고르면 동네 이야기
|
||||
*/
|
||||
topic?: TalkTopic;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1510,6 +1775,45 @@ export type ResAuthConfig = {
|
||||
google_client_id?: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Res_Card
|
||||
*/
|
||||
export type ResCard = {
|
||||
result?: ErrorInfo;
|
||||
/**
|
||||
* Msg
|
||||
*/
|
||||
msg?: string | null;
|
||||
/**
|
||||
* Card Id
|
||||
*/
|
||||
card_id?: number | null;
|
||||
status?: CardStatus | null;
|
||||
/**
|
||||
* Post Id
|
||||
*/
|
||||
post_id?: number | null;
|
||||
/**
|
||||
* Image Urls
|
||||
*/
|
||||
image_urls?: Array<string>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Res_CardList
|
||||
*/
|
||||
export type ResCardList = {
|
||||
result?: ErrorInfo;
|
||||
/**
|
||||
* Msg
|
||||
*/
|
||||
msg?: string | null;
|
||||
/**
|
||||
* Items
|
||||
*/
|
||||
items?: Array<CardItem>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Res_Comment
|
||||
*/
|
||||
@@ -1605,6 +1909,11 @@ export type ResFeed = {
|
||||
* Posts
|
||||
*/
|
||||
posts?: Array<PostData>;
|
||||
hero_post?: PostReaction | null;
|
||||
gak_post?: PostReaction | null;
|
||||
foliage_post?: PostReaction | null;
|
||||
events_post?: PostReaction | null;
|
||||
season_post?: PostReaction | null;
|
||||
bands?: Bands | null;
|
||||
};
|
||||
|
||||
@@ -1754,6 +2063,21 @@ export type ResMyGakList = {
|
||||
items?: Array<MyGakData>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Res_MyGakPresets
|
||||
*/
|
||||
export type ResMyGakPresets = {
|
||||
result?: ErrorInfo;
|
||||
/**
|
||||
* Msg
|
||||
*/
|
||||
msg?: string | null;
|
||||
/**
|
||||
* Items
|
||||
*/
|
||||
items?: Array<MyGakPreset>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Res_MyGakScore
|
||||
*/
|
||||
@@ -2010,6 +2334,23 @@ export type ResTalk = {
|
||||
talk?: TalkData | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Res_TalkGroups
|
||||
*/
|
||||
export type ResTalkGroups = {
|
||||
result?: ErrorInfo;
|
||||
/**
|
||||
* Msg
|
||||
*/
|
||||
msg?: string | null;
|
||||
/**
|
||||
* Groups
|
||||
*
|
||||
* 동네 사람들 묶음은 늘 있고(비어 있을 수 있음), 주제 묶음은 3장 이상일 때만
|
||||
*/
|
||||
groups?: Array<TalkGroup>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Res_TalkImage
|
||||
*/
|
||||
@@ -2061,8 +2402,10 @@ export type ResTalkList = {
|
||||
talks?: Array<TalkData>;
|
||||
/**
|
||||
* Next Cursor
|
||||
*
|
||||
* 다음 페이지를 받을 때 그대로 cursor 로 보낸다
|
||||
*/
|
||||
next_cursor?: number | null;
|
||||
next_cursor?: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -2716,6 +3059,7 @@ export type TalkData = {
|
||||
* 올린 사진 주소
|
||||
*/
|
||||
image?: string | null;
|
||||
topic?: TalkTopic;
|
||||
/**
|
||||
* Like Count
|
||||
*/
|
||||
@@ -2734,6 +3078,22 @@ export type TalkData = {
|
||||
created_at: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* TalkGroup
|
||||
*/
|
||||
export type TalkGroup = {
|
||||
/**
|
||||
* Topic
|
||||
*
|
||||
* 0 이면 '동네 사람들'(모든 주제), 아니면 TalkTopic
|
||||
*/
|
||||
topic: number;
|
||||
/**
|
||||
* Talks
|
||||
*/
|
||||
talks?: Array<TalkData>;
|
||||
};
|
||||
|
||||
/**
|
||||
* TalkReport
|
||||
*/
|
||||
@@ -2761,6 +3121,41 @@ export const TalkReport = {
|
||||
*/
|
||||
export type TalkReport = typeof TalkReport[keyof typeof TalkReport];
|
||||
|
||||
/**
|
||||
* TalkTopic
|
||||
*
|
||||
* 사람 글 주제. 안 고르면 동네 이야기. 피드에서 같은 주제 포스트 옆에 묶어 보여 준다
|
||||
*/
|
||||
export const TalkTopic = {
|
||||
/**
|
||||
* LOCAL
|
||||
*/
|
||||
LOCAL: 1,
|
||||
/**
|
||||
* SKY
|
||||
*/
|
||||
SKY: 2,
|
||||
/**
|
||||
* RAIN
|
||||
*/
|
||||
RAIN: 3,
|
||||
/**
|
||||
* FOLIAGE
|
||||
*/
|
||||
FOLIAGE: 4,
|
||||
/**
|
||||
* OUTFIT
|
||||
*/
|
||||
OUTFIT: 5
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* TalkTopic
|
||||
*
|
||||
* 사람 글 주제. 안 고르면 동네 이야기. 피드에서 같은 주제 포스트 옆에 묶어 보여 준다
|
||||
*/
|
||||
export type TalkTopic = typeof TalkTopic[keyof typeof TalkTopic];
|
||||
|
||||
/**
|
||||
* TermData
|
||||
*/
|
||||
@@ -2842,7 +3237,7 @@ export type TopIndex = {
|
||||
/**
|
||||
* Slot Ranks
|
||||
*
|
||||
* 오늘 구간별 순위 (점수 × 중요도 가중치). 각 시간대와 안 겹치는 구간은 없음
|
||||
* 오늘 구간별 순위 (중요도 배율을 반영한 최종 표시 점수 내림차순, 동점이면 중요도 순)
|
||||
*/
|
||||
slot_ranks?: {
|
||||
[key: string]: number;
|
||||
@@ -3129,6 +3524,10 @@ export type WeatherSlot = {
|
||||
* Rain Prob
|
||||
*/
|
||||
rain_prob?: number | null;
|
||||
/**
|
||||
* Humidity
|
||||
*/
|
||||
humidity?: number | null;
|
||||
/**
|
||||
* Icon
|
||||
*/
|
||||
@@ -3140,6 +3539,34 @@ export type WeatherSlot = {
|
||||
note: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* WeatherWhy
|
||||
*/
|
||||
export type WeatherWhy = {
|
||||
/**
|
||||
* Label
|
||||
*/
|
||||
label: string;
|
||||
/**
|
||||
* Weight
|
||||
*
|
||||
* 비중 % (합 100)
|
||||
*/
|
||||
weight: number;
|
||||
/**
|
||||
* Score
|
||||
*
|
||||
* 이 조건 점수 0~100
|
||||
*/
|
||||
score: number;
|
||||
/**
|
||||
* Note
|
||||
*
|
||||
* 지금 값 (예: 체감 19°, 편한 범위 18~24° 안)
|
||||
*/
|
||||
note: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* WeekDay
|
||||
*/
|
||||
@@ -3175,7 +3602,7 @@ export type WeekDay = {
|
||||
/**
|
||||
* Gaks
|
||||
*
|
||||
* 그날 대표 각 (점수 × 중요도 순 3개). 각 점수가 아직 없는 날은 비어 있음
|
||||
* 그날 대표 각 (중요도 배율을 반영한 최종 표시 점수 내림차순 3개, 동점이면 중요도 순). 각 점수가 아직 없는 날은 비어 있음
|
||||
*/
|
||||
gaks?: Array<WeekGak>;
|
||||
};
|
||||
@@ -3370,6 +3797,12 @@ export type GetWeatherTodayData = {
|
||||
* 구 행정코드
|
||||
*/
|
||||
region: string;
|
||||
/**
|
||||
* Day
|
||||
*
|
||||
* tomorrow 면 내일 칸
|
||||
*/
|
||||
day?: 'today' | 'tomorrow';
|
||||
};
|
||||
url: '/v1/weather/today';
|
||||
};
|
||||
@@ -4458,6 +4891,22 @@ export type AddMyGakResponses = {
|
||||
|
||||
export type AddMyGakResponse = AddMyGakResponses[keyof AddMyGakResponses];
|
||||
|
||||
export type ListPresetsData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: '/v1/my-gak/presets';
|
||||
};
|
||||
|
||||
export type ListPresetsResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: ResMyGakPresets;
|
||||
};
|
||||
|
||||
export type ListPresetsResponse = ListPresetsResponses[keyof ListPresetsResponses];
|
||||
|
||||
export type ScoreMyGakData = {
|
||||
body: ReqMyGakScore;
|
||||
path?: never;
|
||||
@@ -4519,6 +4968,44 @@ export type DeleteMyGakResponses = {
|
||||
|
||||
export type DeleteMyGakResponse = DeleteMyGakResponses[keyof DeleteMyGakResponses];
|
||||
|
||||
export type TalkGroupsData = {
|
||||
body?: never;
|
||||
headers?: {
|
||||
/**
|
||||
* Authorization
|
||||
*/
|
||||
authorization?: string | null;
|
||||
};
|
||||
path?: never;
|
||||
query?: {
|
||||
/**
|
||||
* Region
|
||||
*
|
||||
* 보는 사람의 구 행정코드
|
||||
*/
|
||||
region?: string | null;
|
||||
};
|
||||
url: '/v1/talk/groups';
|
||||
};
|
||||
|
||||
export type TalkGroupsErrors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type TalkGroupsError = TalkGroupsErrors[keyof TalkGroupsErrors];
|
||||
|
||||
export type TalkGroupsResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: ResTalkGroups;
|
||||
};
|
||||
|
||||
export type TalkGroupsResponse = TalkGroupsResponses[keyof TalkGroupsResponses];
|
||||
|
||||
export type ListTalksData = {
|
||||
body?: never;
|
||||
headers?: {
|
||||
@@ -4529,10 +5016,22 @@ export type ListTalksData = {
|
||||
};
|
||||
path?: never;
|
||||
query?: {
|
||||
/**
|
||||
* Region
|
||||
*
|
||||
* 보는 사람의 구 행정코드
|
||||
*/
|
||||
region?: string | null;
|
||||
/**
|
||||
* Topic
|
||||
*
|
||||
* 이 주제 글만. 없으면 전체
|
||||
*/
|
||||
topic?: TalkTopic | null;
|
||||
/**
|
||||
* Cursor
|
||||
*/
|
||||
cursor?: number | null;
|
||||
cursor?: string | null;
|
||||
};
|
||||
url: '/v1/talk/list';
|
||||
};
|
||||
@@ -4555,6 +5054,42 @@ export type ListTalksResponses = {
|
||||
|
||||
export type ListTalksResponse = ListTalksResponses[keyof ListTalksResponses];
|
||||
|
||||
export type ListMyTalksData = {
|
||||
body?: never;
|
||||
headers?: {
|
||||
/**
|
||||
* Authorization
|
||||
*/
|
||||
authorization?: string | null;
|
||||
};
|
||||
path?: never;
|
||||
query?: {
|
||||
/**
|
||||
* Cursor
|
||||
*/
|
||||
cursor?: string | null;
|
||||
};
|
||||
url: '/v1/talk/mine';
|
||||
};
|
||||
|
||||
export type ListMyTalksErrors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type ListMyTalksError = ListMyTalksErrors[keyof ListMyTalksErrors];
|
||||
|
||||
export type ListMyTalksResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: ResTalkList;
|
||||
};
|
||||
|
||||
export type ListMyTalksResponse = ListMyTalksResponses[keyof ListMyTalksResponses];
|
||||
|
||||
export type AddTalkData = {
|
||||
body: ReqTalk;
|
||||
headers?: {
|
||||
@@ -4973,6 +5508,253 @@ export type GetTodayGuPageResponses = {
|
||||
|
||||
export type GetTodayGuPageResponse = GetTodayGuPageResponses[keyof GetTodayGuPageResponses];
|
||||
|
||||
export type GetTomorrowPageData = {
|
||||
body?: never;
|
||||
path: {
|
||||
/**
|
||||
* Sido
|
||||
*/
|
||||
sido: string;
|
||||
/**
|
||||
* Place
|
||||
*/
|
||||
place: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/v1/seo/tomorrow/{sido}/{place}';
|
||||
};
|
||||
|
||||
export type GetTomorrowPageErrors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type GetTomorrowPageError = GetTomorrowPageErrors[keyof GetTomorrowPageErrors];
|
||||
|
||||
export type GetTomorrowPageResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: string;
|
||||
};
|
||||
|
||||
export type GetTomorrowPageResponse = GetTomorrowPageResponses[keyof GetTomorrowPageResponses];
|
||||
|
||||
export type GetTomorrowGuPageData = {
|
||||
body?: never;
|
||||
path: {
|
||||
/**
|
||||
* Sido
|
||||
*/
|
||||
sido: string;
|
||||
/**
|
||||
* Place
|
||||
*/
|
||||
place: string;
|
||||
/**
|
||||
* Gu
|
||||
*/
|
||||
gu: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/v1/seo/tomorrow/{sido}/{place}/{gu}';
|
||||
};
|
||||
|
||||
export type GetTomorrowGuPageErrors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type GetTomorrowGuPageError = GetTomorrowGuPageErrors[keyof GetTomorrowGuPageErrors];
|
||||
|
||||
export type GetTomorrowGuPageResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: string;
|
||||
};
|
||||
|
||||
export type GetTomorrowGuPageResponse = GetTomorrowGuPageResponses[keyof GetTomorrowGuPageResponses];
|
||||
|
||||
export type ListCardsData = {
|
||||
body?: never;
|
||||
headers?: {
|
||||
/**
|
||||
* X-Admin-Key
|
||||
*/
|
||||
'x-admin-key'?: string | null;
|
||||
};
|
||||
path?: never;
|
||||
query?: {
|
||||
/**
|
||||
* Limit
|
||||
*/
|
||||
limit?: number;
|
||||
};
|
||||
url: '/v1/card';
|
||||
};
|
||||
|
||||
export type ListCardsErrors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type ListCardsError = ListCardsErrors[keyof ListCardsErrors];
|
||||
|
||||
export type ListCardsResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: ResCardList;
|
||||
};
|
||||
|
||||
export type ListCardsResponse = ListCardsResponses[keyof ListCardsResponses];
|
||||
|
||||
export type CreateCardData = {
|
||||
body: ReqCardCreate;
|
||||
headers?: {
|
||||
/**
|
||||
* X-Admin-Key
|
||||
*/
|
||||
'x-admin-key'?: string | null;
|
||||
};
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: '/v1/card';
|
||||
};
|
||||
|
||||
export type CreateCardErrors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type CreateCardError = CreateCardErrors[keyof CreateCardErrors];
|
||||
|
||||
export type CreateCardResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: ResCard;
|
||||
};
|
||||
|
||||
export type CreateCardResponse = CreateCardResponses[keyof CreateCardResponses];
|
||||
|
||||
export type PublishCardData = {
|
||||
body?: never;
|
||||
headers?: {
|
||||
/**
|
||||
* X-Admin-Key
|
||||
*/
|
||||
'x-admin-key'?: string | null;
|
||||
};
|
||||
path: {
|
||||
/**
|
||||
* Card Id
|
||||
*/
|
||||
card_id: number;
|
||||
};
|
||||
query?: never;
|
||||
url: '/v1/card/{card_id}/publish';
|
||||
};
|
||||
|
||||
export type PublishCardErrors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type PublishCardError = PublishCardErrors[keyof PublishCardErrors];
|
||||
|
||||
export type PublishCardResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: ResCard;
|
||||
};
|
||||
|
||||
export type PublishCardResponse = PublishCardResponses[keyof PublishCardResponses];
|
||||
|
||||
export type RejectCardData = {
|
||||
body?: never;
|
||||
headers?: {
|
||||
/**
|
||||
* X-Admin-Key
|
||||
*/
|
||||
'x-admin-key'?: string | null;
|
||||
};
|
||||
path: {
|
||||
/**
|
||||
* Card Id
|
||||
*/
|
||||
card_id: number;
|
||||
};
|
||||
query?: never;
|
||||
url: '/v1/card/{card_id}/reject';
|
||||
};
|
||||
|
||||
export type RejectCardErrors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type RejectCardError = RejectCardErrors[keyof RejectCardErrors];
|
||||
|
||||
export type RejectCardResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: ResCard;
|
||||
};
|
||||
|
||||
export type RejectCardResponse = RejectCardResponses[keyof RejectCardResponses];
|
||||
|
||||
export type GetCardImageData = {
|
||||
body?: never;
|
||||
path: {
|
||||
/**
|
||||
* Card Id
|
||||
*/
|
||||
card_id: number;
|
||||
/**
|
||||
* Seq
|
||||
*/
|
||||
seq: number;
|
||||
};
|
||||
query?: never;
|
||||
url: '/v1/card/{card_id}/{seq}.jpg';
|
||||
};
|
||||
|
||||
export type GetCardImageErrors = {
|
||||
/**
|
||||
* Not Found
|
||||
*/
|
||||
404: unknown;
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type GetCardImageError = GetCardImageErrors[keyof GetCardImageErrors];
|
||||
|
||||
export type GetCardImageResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: unknown;
|
||||
};
|
||||
|
||||
export type HealthzHealthzGetData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
|
||||
/** 올릴 곳 (관리자 서버가 비밀값을 가진 곳만 나온다): 로컬 백엔드, 킹서버 */
|
||||
export type Target = { id: 'local' | 'king'; label: string; site: string; api: string }
|
||||
|
||||
export function useTargets() {
|
||||
return useQuery({
|
||||
queryKey: ['targets'],
|
||||
queryFn: async () => (await (await fetch('/api/targets')).json()) as Target[],
|
||||
staleTime: Infinity,
|
||||
})
|
||||
}
|
||||
|
||||
export type CardSummary = { card_id: number; status: 1 | 2 | 3; post_id?: number; ig_media_id?: string }
|
||||
|
||||
export async function postCard(target: Target['id'], body: unknown): Promise<CardSummary> {
|
||||
const r = await fetch(`/api/post?target=${target}`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) })
|
||||
const res = await r.json()
|
||||
if (!r.ok || res.result?.success === false) throw new Error(res.error ?? res.msg ?? res.result?.desc ?? `HTTP ${r.status}`)
|
||||
return res
|
||||
}
|
||||
|
||||
export async function cardAction(target: Target['id'], id: number, what: 'publish' | 'reject' | 'instagram'): Promise<CardSummary> {
|
||||
const r = await fetch(`/api/cards/${id}/${what}?target=${target}`, { method: 'POST' })
|
||||
const res = await r.json()
|
||||
if (!r.ok || res.result?.success === false) throw new Error(res.error ?? res.msg ?? res.result?.desc ?? `HTTP ${r.status}`)
|
||||
return res
|
||||
}
|
||||
+108
-24
@@ -11,6 +11,8 @@ import { CATEGORIES, categoryOf, questionOf } from '../cards/topics'
|
||||
import { GAK_DECK, gakByCode } from '../cards/gaks'
|
||||
import type { IndexSummary } from '../api/client'
|
||||
import { neededImages } from '../cards/images'
|
||||
import { cardAction, postCard, useTargets } from '../api/targets'
|
||||
import type { CardSummary, Target } from '../api/targets'
|
||||
import { DEFAULT_STYLE, OOTD_STYLES } from '../cards/ootd'
|
||||
import type { Copy, Template } from '../cards/templates'
|
||||
|
||||
@@ -314,21 +316,14 @@ function Editor({ template, data, overrides, onEdit }: { template: Template; dat
|
||||
|
||||
<PostBox
|
||||
disabled={busy !== null || !made}
|
||||
onPost={async (publish) => {
|
||||
buildBody={async (publish) => {
|
||||
const images = []
|
||||
for (const i of slides.map((_, k) => k)) {
|
||||
const node = refs.current[i]?.firstElementChild as HTMLElement | null
|
||||
if (node) images.push(await toJpeg(node))
|
||||
}
|
||||
const { title, caption } = template.post(data, copy)
|
||||
const res = await fetch('/api/post', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ template: template.id, topic: copy.topic ?? null, title, caption, texts: copy, images, publish }),
|
||||
})
|
||||
const body = await res.json()
|
||||
if (!res.ok || body.result?.success === false) throw new Error(body.error ?? body.result?.desc ?? `HTTP ${res.status}`)
|
||||
return body as { card_id: number; status: number; post_id?: number }
|
||||
return { template: template.id, topic: copy.topic ?? null, title, caption, texts: copy, images, publish }
|
||||
}}
|
||||
/>
|
||||
<CommandBox command={command} />
|
||||
@@ -662,37 +657,126 @@ function HowBox({ template }: { template: Template }) {
|
||||
)
|
||||
}
|
||||
|
||||
/** 날씨각 피드에 올리기: 바로 게시하거나, 승인 대기로 저장(나중에 Teams 승인으로 게시) */
|
||||
function PostBox({ disabled, onPost }: { disabled: boolean; onPost: (publish: boolean) => Promise<{ card_id: number; post_id?: number }> }) {
|
||||
const [state, setState] = useState<{ busy?: boolean; done?: string; error?: string }>({})
|
||||
type Posted = Record<string, { busy?: boolean; card?: CardSummary; error?: string; ig?: string; igBusy?: boolean; igError?: string }>
|
||||
|
||||
/** 날씨각 피드에 올리기: 올릴 곳(로컬·킹서버)을 골라 바로 게시하거나 승인 대기로 저장. 올린 뒤 인스타(@nalssigak)에도 */
|
||||
function PostBox({ disabled, buildBody }: { disabled: boolean; buildBody: (publish: boolean) => Promise<unknown> }) {
|
||||
const { data: targets = [] } = useTargets()
|
||||
const [picked, setPicked] = useState<Target['id'][] | null>(null)
|
||||
const chosen = picked ?? targets.map((t) => t.id)
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [posted, setPosted] = useState<Posted>({})
|
||||
const [error, setError] = useState('')
|
||||
|
||||
const run = async (publish: boolean) => {
|
||||
setState({ busy: true })
|
||||
setBusy(true)
|
||||
setError('')
|
||||
try {
|
||||
const r = await onPost(publish)
|
||||
setState({ done: publish ? `날씨각 피드에 올렸어요 (카드 ${r.card_id}, 포스트 ${r.post_id}). 오늘 피드 날씨 바로 아래에 보여요.` : `승인 대기로 저장했어요 (카드 ${r.card_id}).` })
|
||||
const body = await buildBody(publish)
|
||||
await Promise.all(
|
||||
chosen.map(async (id) => {
|
||||
setPosted((p) => ({ ...p, [id]: { busy: true } }))
|
||||
try {
|
||||
const card = await postCard(id, body)
|
||||
setPosted((p) => ({ ...p, [id]: { card } }))
|
||||
} catch (e) {
|
||||
setPosted((p) => ({ ...p, [id]: { error: e instanceof Error ? e.message : String(e) } }))
|
||||
}
|
||||
}),
|
||||
)
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
setState({ error: e instanceof Error ? e.message : String(e) })
|
||||
setError(`이미지를 만들지 못했어요: ${e instanceof Error ? e.message : String(e)}`)
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
// 인스타는 이미지가 공개 주소여야 해서 킹서버에 올린 카드로만 올린다
|
||||
const igTarget = targets.find((t) => t.id === 'king') ?? targets[0]
|
||||
const igCard = igTarget ? posted[igTarget.id]?.card : undefined
|
||||
const toInstagram = async () => {
|
||||
if (!igTarget || !igCard) return
|
||||
setPosted((p) => ({ ...p, [igTarget.id]: { ...p[igTarget.id], igBusy: true, igError: undefined } }))
|
||||
try {
|
||||
const r = await cardAction(igTarget.id, igCard.card_id, 'instagram')
|
||||
setPosted((p) => ({ ...p, [igTarget.id]: { ...p[igTarget.id], igBusy: false, ig: r.ig_media_id } }))
|
||||
} catch (e) {
|
||||
setPosted((p) => ({ ...p, [igTarget.id]: { ...p[igTarget.id], igBusy: false, igError: e instanceof Error ? e.message : String(e) } }))
|
||||
}
|
||||
}
|
||||
const ig = igTarget ? posted[igTarget.id] : undefined
|
||||
|
||||
return (
|
||||
<section className="flex flex-col gap-2 border-t border-line pt-5">
|
||||
<section className="flex flex-col gap-3 border-t border-line pt-5">
|
||||
<h2 className="text-[15px] font-bold">날씨각에 올리기</h2>
|
||||
<p className="text-[12px] leading-relaxed text-muted">지금 카드를 이미지로 만들어 오늘 전국 피드에 올려요. 내일 03시에 피드에서 빠져요.</p>
|
||||
{targets.length === 0 ? (
|
||||
<p className="text-[12px] text-muted">올릴 곳이 없어요. 관리자 서버에 ADMIN_API_KEY(로컬)·KING_ADMIN_API_KEY(킹서버)를 환경변수로 주고 다시 켜 주세요.</p>
|
||||
) : (
|
||||
<div className="flex flex-wrap items-center gap-x-4 gap-y-1 text-[13px]">
|
||||
<span className="text-muted">올릴 곳</span>
|
||||
{targets.map((t) => (
|
||||
<label key={t.id} className="flex items-center gap-1.5 font-semibold">
|
||||
<input type="checkbox" id={`target-${t.id}`} checked={chosen.includes(t.id)} onChange={(e) => setPicked(e.target.checked ? [...chosen, t.id] : chosen.filter((x) => x !== t.id))} className="accent-ink" />
|
||||
{t.label}
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<p className="text-[12px] leading-relaxed text-muted">지금 카드를 이미지로 만들어 고른 곳의 오늘 전국 피드에 올려요. 내일 03시에 피드에서 빠져요.</p>
|
||||
<div className="flex gap-2">
|
||||
<button onClick={() => run(true)} disabled={disabled || state.busy} className="flex-1 rounded-xl bg-ink px-4 py-2.5 text-[14px] font-bold text-white hover:opacity-90 disabled:opacity-40">
|
||||
{state.busy ? '올리는 중…' : '지금 올리기'}
|
||||
<button onClick={() => run(true)} disabled={disabled || busy || chosen.length === 0} className="flex-1 rounded-xl bg-ink px-4 py-2.5 text-[14px] font-bold text-white hover:opacity-90 disabled:opacity-40">
|
||||
{busy ? '올리는 중…' : '지금 올리기'}
|
||||
</button>
|
||||
<button onClick={() => run(false)} disabled={disabled || state.busy} className="rounded-xl border border-ink px-3 py-2.5 text-[13px] font-bold text-ink hover:bg-rail disabled:opacity-40">
|
||||
<button onClick={() => run(false)} disabled={disabled || busy || chosen.length === 0} className="rounded-xl border border-ink px-3 py-2.5 text-[13px] font-bold text-ink hover:bg-rail disabled:opacity-40">
|
||||
승인 대기로 저장
|
||||
</button>
|
||||
</div>
|
||||
{state.done && <p className="text-[12px] font-semibold text-ink-soft">{state.done}</p>}
|
||||
{state.error && (
|
||||
{error && (
|
||||
<p role="alert" className="text-[12px] text-bad">
|
||||
올리지 못했어요: {state.error}
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
{Object.keys(posted).length > 0 && (
|
||||
<ul className="m-0 flex list-none flex-col gap-1.5 p-0 text-[12px]">
|
||||
{targets
|
||||
.filter((t) => posted[t.id])
|
||||
.map((t) => {
|
||||
const r = posted[t.id]
|
||||
return (
|
||||
<li key={t.id} className="flex flex-wrap items-center gap-x-2 rounded-lg bg-page px-3 py-2">
|
||||
<b>{t.label}</b>
|
||||
{r.busy && <span className="text-muted">올리는 중…</span>}
|
||||
{r.card && (
|
||||
<>
|
||||
<span className="text-ink-soft">
|
||||
{r.card.status === 2 ? `올렸어요 · 카드 ${r.card.card_id} · 포스트 ${r.card.post_id}` : `승인 대기로 저장 · 카드 ${r.card.card_id}`}
|
||||
</span>
|
||||
{r.card.status === 2 && (
|
||||
<a href={t.site} target="_blank" rel="noreferrer" className="font-semibold text-rust underline-offset-2 hover:underline">
|
||||
피드에서 보기
|
||||
</a>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{r.error && <span className="text-bad">올리지 못했어요: {r.error}</span>}
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
)}
|
||||
{igTarget && igCard?.status === 2 && (
|
||||
<div className="flex flex-col gap-1.5 border-t border-line pt-3">
|
||||
<button onClick={toInstagram} disabled={ig?.igBusy || !!ig?.ig} className="rounded-xl border border-ink px-4 py-2.5 text-[14px] font-bold text-ink hover:bg-rail disabled:opacity-40">
|
||||
{ig?.ig ? `인스타에 올렸어요 (${ig.ig})` : ig?.igBusy ? '인스타에 올리는 중… (1분쯤)' : `인스타(@nalssigak)에도 올리기 · ${igTarget.label} 이미지로`}
|
||||
</button>
|
||||
{ig?.igError && (
|
||||
<p role="alert" className="text-[12px] text-bad">
|
||||
인스타에 올리지 못했어요: {ig.igError}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
+154
-52
@@ -1,99 +1,201 @@
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { useState } from 'react'
|
||||
import { API_BASE_URL } from '../api/setup'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useSearchParams } from 'react-router'
|
||||
import { cardAction, useTargets } from '../api/targets'
|
||||
import type { Target } from '../api/targets'
|
||||
|
||||
type Card = { card_id: number; template: string; topic?: string; title: string; status: 1 | 2 | 3; post_id?: number; created_at: string; published_at?: string; image_urls: string[] }
|
||||
type Card = { card_id: number; template: string; topic?: string; title: string; status: 1 | 2 | 3; post_id?: number; created_at: string; published_at?: string; image_urls: string[]; ig_media_id?: string }
|
||||
type Status = Card['status']
|
||||
|
||||
const STATUS: Record<Card['status'], [string, string]> = { 1: ['승인 대기', 'bg-warn-soft text-warn'], 2: ['올림', 'bg-rust-soft text-rust'], 3: ['반려', 'bg-rail text-muted'] }
|
||||
const STATUS: Record<Status, { label: string; tone: string }> = {
|
||||
2: { label: '올림', tone: 'bg-rust-soft text-rust' },
|
||||
1: { label: '승인 대기', tone: 'bg-warn-soft text-warn' },
|
||||
3: { label: '반려', tone: 'bg-rail text-muted' },
|
||||
}
|
||||
const TEMPLATE: Record<string, string> = { tarot: '날씨 타로', ootd: '오늘의 코디' }
|
||||
const DAY = ['일', '월', '화', '수', '목', '금', '토']
|
||||
|
||||
const when = (iso: string) => new Date(iso).toLocaleString('ko-KR', { month: 'numeric', day: 'numeric', hour: '2-digit', minute: '2-digit' })
|
||||
function when(iso: string) {
|
||||
const d = new Date(iso)
|
||||
return `${d.getMonth() + 1}.${d.getDate()} ${DAY[d.getDay()]} ${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`
|
||||
}
|
||||
|
||||
/** 만든 카드가 쌓이는 곳. 날씨각 서버(card_set·card_image)에 저장된 것을 보여 주고, 다시 내려받거나 올린다 */
|
||||
/** 발행된 포스트가 쌓이는 곳. 올릴 곳(로컬·킹서버)마다 날씨각 서버에 저장된 카드를 보여 주고, 다시 내려받거나 올리거나 인스타에 보낸다 */
|
||||
export function HistoryPage() {
|
||||
const { data: targets = [] } = useTargets()
|
||||
const [params, setParams] = useSearchParams()
|
||||
const target = targets.find((t) => t.id === params.get('target')) ?? targets[0]
|
||||
const status = (Number(params.get('status')) || 0) as 0 | Status
|
||||
const set = (next: Record<string, string>) => setParams((p) => {
|
||||
for (const [k, v] of Object.entries(next)) {
|
||||
if (v) p.set(k, v)
|
||||
else p.delete(k)
|
||||
}
|
||||
return p
|
||||
}, { replace: true })
|
||||
|
||||
return (
|
||||
<div className="mx-auto flex max-w-[1440px] flex-col gap-5 px-4 py-5 sm:px-6">
|
||||
<header className="flex flex-wrap items-center justify-between gap-x-6 gap-y-3">
|
||||
<div className="flex min-w-0 flex-col gap-0.5">
|
||||
<h1 className="text-[20px] font-bold tracking-[-0.02em]">만든 카드</h1>
|
||||
<p className="text-[13px] text-muted">올리거나 승인 대기로 저장한 카드가 서버에 쌓여요. 장마다 JPEG로 다시 내려받을 수 있어요.</p>
|
||||
</div>
|
||||
{targets.length > 1 && (
|
||||
<div role="tablist" aria-label="올린 곳" className="flex gap-1 rounded-xl border border-line bg-panel p-1">
|
||||
{targets.map((t) => (
|
||||
<button key={t.id} role="tab" aria-selected={t.id === target?.id} onClick={() => set({ target: t.id })} className={`rounded-lg px-4 py-2 text-[14px] font-bold transition-colors duration-150 ${t.id === target?.id ? 'bg-ink text-white' : 'text-ink-soft hover:bg-rail'}`}>
|
||||
{t.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</header>
|
||||
{target ? <CardList target={target} status={status} onStatus={(s) => set({ status: s ? String(s) : '' })} /> : <p className="rounded-xl border border-bad/30 bg-bad-soft px-5 py-4 text-[14px] text-bad">올릴 곳이 없어요. 관리자 서버에 ADMIN_API_KEY(로컬)·KING_ADMIN_API_KEY(킹서버)를 주고 다시 켜 주세요.</p>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function CardList({ target, status, onStatus }: { target: Target; status: 0 | Status; onStatus: (s: 0 | Status) => void }) {
|
||||
const qc = useQueryClient()
|
||||
const { data, error, isLoading } = useQuery({
|
||||
queryKey: ['cards'],
|
||||
queryKey: ['cards', target.id],
|
||||
queryFn: async () => {
|
||||
const r = await fetch('/api/cards')
|
||||
const r = await fetch(`/api/cards?target=${target.id}`)
|
||||
const body = await r.json()
|
||||
if (!r.ok || body.result?.success === false) throw new Error(body.error ?? body.result?.desc ?? `HTTP ${r.status}`)
|
||||
return body.items as Card[]
|
||||
},
|
||||
})
|
||||
const [busy, setBusy] = useState<number | null>(null)
|
||||
const act = async (id: number, what: 'publish' | 'reject') => {
|
||||
setBusy(id)
|
||||
const [note, setNote] = useState<{ id: number; text: string; bad?: boolean } | null>(null)
|
||||
useEffect(() => {
|
||||
if (!note || note.bad) return
|
||||
const t = setTimeout(() => setNote(null), 4000)
|
||||
return () => clearTimeout(t)
|
||||
}, [note])
|
||||
|
||||
const act = async (c: Card, what: 'publish' | 'reject' | 'instagram') => {
|
||||
setBusy(c.card_id)
|
||||
setNote(null)
|
||||
try {
|
||||
const r = await fetch(`/api/cards/${id}/${what}`, { method: 'POST' })
|
||||
if (!r.ok) throw new Error((await r.json()).error)
|
||||
await qc.invalidateQueries({ queryKey: ['cards'] })
|
||||
const r = await cardAction(target.id, c.card_id, what)
|
||||
await qc.invalidateQueries({ queryKey: ['cards', target.id] })
|
||||
setNote({ id: c.card_id, text: what === 'instagram' ? `인스타에 올렸어요 (${r.ig_media_id})` : what === 'publish' ? `오늘 피드에 올렸어요 (포스트 ${r.post_id})` : '반려했어요' })
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
window.alert(`처리하지 못했어요: ${e instanceof Error ? e.message : String(e)}`)
|
||||
setNote({ id: c.card_id, text: e instanceof Error ? e.message : String(e), bad: true })
|
||||
} finally {
|
||||
setBusy(null)
|
||||
}
|
||||
}
|
||||
const downloadAll = (c: Card) => {
|
||||
c.image_urls.forEach((u, i) =>
|
||||
setTimeout(() => {
|
||||
const a = document.createElement('a')
|
||||
a.href = `${target.api}${u}`
|
||||
a.download = `card-${c.card_id}-${i + 1}.jpg`
|
||||
a.target = '_blank'
|
||||
a.rel = 'noreferrer'
|
||||
a.click()
|
||||
}, i * 400),
|
||||
)
|
||||
}
|
||||
|
||||
const counts = { 0: data?.length ?? 0, 1: 0, 2: 0, 3: 0 } as Record<0 | Status, number>
|
||||
for (const c of data ?? []) counts[c.status] += 1
|
||||
const shown = (data ?? []).filter((c) => !status || c.status === status)
|
||||
|
||||
return (
|
||||
<div className="mx-auto flex max-w-[1440px] flex-col gap-5 px-4 py-5 sm:px-6">
|
||||
<header className="flex flex-col gap-0.5">
|
||||
<h1 className="text-[20px] font-bold tracking-[-0.02em]">만든 카드</h1>
|
||||
<p className="text-[13px] text-muted">'지금 올리기'나 '승인 대기로 저장'을 누른 카드가 날씨각 서버에 쌓여요. 장마다 JPEG로 다시 내려받을 수 있어요.</p>
|
||||
</header>
|
||||
<div className="flex flex-col gap-4">
|
||||
<div role="radiogroup" aria-label="상태" className="flex flex-wrap gap-1.5">
|
||||
{([0, 2, 1, 3] as const).map((s) => (
|
||||
<button key={s} role="radio" aria-checked={status === s} onClick={() => onStatus(s)} className={`rounded-full border px-3 py-1 text-[12px] font-semibold transition-colors duration-150 ${status === s ? 'border-ink bg-ink text-white' : 'border-line bg-panel text-ink hover:border-ink-soft'}`}>
|
||||
{s === 0 ? '전체' : STATUS[s].label} <span className={status === s ? 'text-white/70' : 'text-muted'}>{counts[s]}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
{error && (
|
||||
<div role="alert" className="rounded-xl border border-bad/30 bg-bad-soft px-5 py-4 text-[14px] text-bad">
|
||||
목록을 받지 못했어요: {String(error instanceof Error ? error.message : error)}
|
||||
{target.label} 목록을 받지 못했어요: {error instanceof Error ? error.message : String(error)}
|
||||
</div>
|
||||
)}
|
||||
{isLoading && <div className="h-40 animate-pulse rounded-2xl bg-rail" aria-busy="true" />}
|
||||
{data?.length === 0 && <p className="rounded-2xl border border-dashed border-line bg-panel px-5 py-10 text-center text-[14px] text-muted">아직 저장한 카드가 없어요.</p>}
|
||||
{isLoading && (
|
||||
<div className="flex flex-col gap-3" aria-busy="true">
|
||||
{[0, 1].map((i) => (
|
||||
<div key={i} className="h-44 animate-pulse rounded-2xl bg-rail" />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{data && shown.length === 0 && <p className="rounded-2xl border border-dashed border-line bg-panel px-5 py-10 text-center text-[14px] text-muted">{status ? `${STATUS[status].label} 카드가 없어요.` : `${target.label}에 저장한 카드가 아직 없어요. 인스타 카드 탭에서 만들어 올려 보세요.`}</p>}
|
||||
<ul className="m-0 flex list-none flex-col gap-3 p-0">
|
||||
{data?.map((c) => {
|
||||
const [label, tone] = STATUS[c.status]
|
||||
{shown.map((c) => {
|
||||
const st = STATUS[c.status]
|
||||
const mine = note?.id === c.card_id ? note : null
|
||||
return (
|
||||
<li key={c.card_id} className="grid gap-4 rounded-2xl border border-line bg-panel p-4 md:grid-cols-[minmax(0,1fr)_auto]">
|
||||
<li key={c.card_id} className="grid gap-4 rounded-2xl border border-line bg-panel p-4 md:grid-cols-[minmax(0,1fr)_176px]">
|
||||
<div className="flex min-w-0 flex-col gap-3">
|
||||
<div className="flex flex-wrap items-center gap-2 text-[13px]">
|
||||
<span className={`rounded-full px-2 py-0.5 text-[12px] font-bold ${tone}`}>{label}</span>
|
||||
<div className="flex flex-wrap items-center gap-x-2.5 gap-y-1">
|
||||
<span className={`rounded-full px-2 py-0.5 text-[12px] font-bold ${st.tone}`}>{st.label}</span>
|
||||
<b className="text-[15px]">{c.title}</b>
|
||||
<span className="text-muted">
|
||||
<span className="text-[12px] text-muted">
|
||||
{TEMPLATE[c.template] ?? c.template}
|
||||
{c.topic ? ` · ${c.topic}` : ''} · 카드 {c.card_id}
|
||||
{c.post_id ? ` · 포스트 ${c.post_id}` : ''}
|
||||
{c.topic ? ` · ${c.topic}` : ''} · {c.image_urls.length}장 · 카드 {c.card_id}
|
||||
</span>
|
||||
<span className="text-muted">만든 때 {when(c.created_at)}{c.published_at ? ` · 올린 때 ${when(c.published_at)}` : ''}</span>
|
||||
</div>
|
||||
<ol className="m-0 flex list-none gap-2 overflow-x-auto p-0.5">
|
||||
{c.image_urls.map((u, i) => (
|
||||
<li key={u} className="shrink-0">
|
||||
<a href={`${API_BASE_URL}${u}`} download={`card-${c.card_id}-${i + 1}.jpg`} target="_blank" rel="noreferrer" title={`${i + 1}장 내려받기`} className="block overflow-hidden rounded-md outline-offset-2 hover:outline-2 hover:outline-ink">
|
||||
<img src={`${API_BASE_URL}${u}`} alt={`${c.title} ${i + 1}장`} loading="lazy" className="h-[135px] w-[108px] object-cover" />
|
||||
<a href={`${target.api}${u}`} download={`card-${c.card_id}-${i + 1}.jpg`} target="_blank" rel="noreferrer" title={`${i + 1}장 내려받기`} className="block overflow-hidden rounded-lg outline-offset-2 transition-shadow duration-150 hover:shadow-[0_6px_18px_#28304a22] hover:outline-2 hover:outline-ink">
|
||||
<img src={`${target.api}${u}`} alt={`${c.title} ${i + 1}장`} loading="lazy" className={`object-cover ${i === 0 ? 'h-[200px] w-[160px]' : 'h-[200px] w-[160px] opacity-90'}`} />
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
<dl className="grid grid-cols-[64px_1fr] gap-x-3 gap-y-0.5 text-[12px]">
|
||||
<dt className="text-muted">만든 때</dt>
|
||||
<dd className="m-0">{when(c.created_at)}</dd>
|
||||
{c.published_at && (
|
||||
<>
|
||||
<dt className="text-muted">올린 때</dt>
|
||||
<dd className="m-0">
|
||||
{when(c.published_at)} · 포스트 {c.post_id} ·{' '}
|
||||
<a href={target.site} target="_blank" rel="noreferrer" className="font-semibold text-rust underline-offset-2 hover:underline">
|
||||
피드에서 보기
|
||||
</a>
|
||||
</dd>
|
||||
</>
|
||||
)}
|
||||
{c.ig_media_id && (
|
||||
<>
|
||||
<dt className="text-muted">인스타</dt>
|
||||
<dd className="m-0">올림 · {c.ig_media_id}</dd>
|
||||
</>
|
||||
)}
|
||||
</dl>
|
||||
{mine && (
|
||||
<p role={mine.bad ? 'alert' : 'status'} className={`text-[12px] font-semibold ${mine.bad ? 'text-bad' : 'text-ink-soft'}`}>
|
||||
{mine.bad ? `처리하지 못했어요: ${mine.text}` : mine.text}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex shrink-0 flex-col gap-2 md:w-40">
|
||||
<a
|
||||
href={`${API_BASE_URL}${c.image_urls[0] ?? ''}`}
|
||||
download={`card-${c.card_id}-1.jpg`}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="rounded-lg border border-line px-3 py-2 text-center text-[13px] font-bold text-ink hover:bg-rail"
|
||||
>
|
||||
이미지 열기
|
||||
</a>
|
||||
<div className="flex shrink-0 flex-col gap-2">
|
||||
<button onClick={() => downloadAll(c)} className="rounded-lg border border-line px-3 py-2 text-[13px] font-bold text-ink hover:bg-rail">
|
||||
JPEG {c.image_urls.length}장 내려받기
|
||||
</button>
|
||||
{c.status === 1 && (
|
||||
<>
|
||||
<button onClick={() => act(c.card_id, 'publish')} disabled={busy === c.card_id} className="rounded-lg bg-ink px-3 py-2 text-[13px] font-bold text-white hover:opacity-90 disabled:opacity-40">
|
||||
오늘 피드에 올리기
|
||||
</button>
|
||||
<button onClick={() => act(c.card_id, 'reject')} disabled={busy === c.card_id} className="rounded-lg px-3 py-2 text-[13px] font-semibold text-muted hover:bg-rail disabled:opacity-40">
|
||||
반려
|
||||
</button>
|
||||
</>
|
||||
<button onClick={() => act(c, 'publish')} disabled={busy === c.card_id} className="rounded-lg bg-ink px-3 py-2 text-[13px] font-bold text-white hover:opacity-90 disabled:opacity-40">
|
||||
오늘 피드에 올리기
|
||||
</button>
|
||||
)}
|
||||
{c.status === 2 && !c.ig_media_id && (
|
||||
<button onClick={() => act(c, 'instagram')} disabled={busy === c.card_id} className="rounded-lg border border-ink px-3 py-2 text-[13px] font-bold text-ink hover:bg-rail disabled:opacity-40">
|
||||
{busy === c.card_id ? '인스타에 올리는 중…' : '인스타에 올리기'}
|
||||
</button>
|
||||
)}
|
||||
{c.status === 1 && (
|
||||
<button onClick={() => act(c, 'reject')} disabled={busy === c.card_id} className="rounded-lg px-3 py-2 text-[13px] font-semibold text-muted hover:bg-rail disabled:opacity-40">
|
||||
반려
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</li>
|
||||
|
||||
Reference in new issue
Block a user