From 5cf00407b4c5d32c3cc16c946784aa5f2a06efee Mon Sep 17 00:00:00 2001 From: Noa Virellia Date: Fri, 6 Feb 2026 20:58:23 +0800 Subject: [PATCH] refactor(client): remove excess api version header Signed-off-by: Noa Virellia --- .../src/client/@tanstack/react-query.gen.ts | 92 +++++++- client/cms/src/client/client.gen.ts | 2 +- client/cms/src/client/index.ts | 4 +- client/cms/src/client/sdk.gen.ts | 27 ++- client/cms/src/client/types.gen.ts | 212 +++++++++++------- client/cms/src/client/zod.gen.ts | 118 +++++----- .../events/kyc/kyc.dialog.container.tsx | 5 +- client/cms/src/components/login-form.tsx | 3 +- .../profile/edit-profile.dialog.container.tsx | 3 +- .../components/profile/profile.container.tsx | 3 +- .../cms/src/hooks/data/useCreateKycSession.ts | 2 - client/cms/src/hooks/data/useGetEvents.ts | 2 - client/cms/src/hooks/data/useUpdateUser.ts | 7 +- client/cms/src/hooks/data/useUserInfo.ts | 5 +- client/cms/src/lib/token.ts | 2 - client/cms/src/routes/authorize.tsx | 2 - client/cms/src/routes/token.tsx | 3 +- 17 files changed, 305 insertions(+), 187 deletions(-) diff --git a/client/cms/src/client/@tanstack/react-query.gen.ts b/client/cms/src/client/@tanstack/react-query.gen.ts index 89fcd78..e6b2ff3 100644 --- a/client/cms/src/client/@tanstack/react-query.gen.ts +++ b/client/cms/src/client/@tanstack/react-query.gen.ts @@ -3,8 +3,27 @@ import { type InfiniteData, infiniteQueryOptions, queryOptions, type UseMutationOptions } from '@tanstack/react-query'; import { client } from '../client.gen'; -import { getAuthRedirect, getEventAttendance, getEventCheckin, getEventCheckinQuery, getEventInfo, getEventList, getUserInfo, getUserInfoByUserId, getUserList, type Options, patchUserUpdate, postAuthExchange, postAuthMagic, postAuthRefresh, postAuthToken, postEventCheckinSubmit, postEventJoin, postKycQuery, postKycSession } from '../sdk.gen'; -import type { GetAuthRedirectData, GetAuthRedirectError, GetEventAttendanceData, GetEventAttendanceError, GetEventAttendanceResponse, GetEventCheckinData, GetEventCheckinError, GetEventCheckinQueryData, GetEventCheckinQueryError, GetEventCheckinQueryResponse, GetEventCheckinResponse, GetEventInfoData, GetEventInfoError, GetEventInfoResponse, GetEventListData, GetEventListError, GetEventListResponse, GetUserInfoByUserIdData, GetUserInfoByUserIdError, GetUserInfoByUserIdResponse, GetUserInfoData, GetUserInfoError, GetUserInfoResponse, GetUserListData, GetUserListError, GetUserListResponse, PatchUserUpdateData, PatchUserUpdateError, PatchUserUpdateResponse, PostAuthExchangeData, PostAuthExchangeError, PostAuthExchangeResponse, PostAuthMagicData, PostAuthMagicError, PostAuthMagicResponse, PostAuthRefreshData, PostAuthRefreshError, PostAuthRefreshResponse, PostAuthTokenData, PostAuthTokenError, PostAuthTokenResponse, PostEventCheckinSubmitData, PostEventCheckinSubmitError, PostEventCheckinSubmitResponse, PostEventJoinData, PostEventJoinError, PostEventJoinResponse, PostKycQueryData, PostKycQueryError, PostKycQueryResponse, PostKycSessionData, PostKycSessionError, PostKycSessionResponse } from '../types.gen'; +import { getAuthRedirect, getEventAttendance, getEventCheckin, getEventCheckinQuery, getEventInfo, getEventJoined, getEventList, getUserInfo, getUserInfoByUserId, getUserList, type Options, patchUserUpdate, postAgendaSubmit, postAuthExchange, postAuthMagic, postAuthRefresh, postAuthToken, postEventCheckinSubmit, postEventJoin, postKycQuery, postKycSession } from '../sdk.gen'; +import type { GetAuthRedirectData, GetAuthRedirectError, GetEventAttendanceData, GetEventAttendanceError, GetEventAttendanceResponse, GetEventCheckinData, GetEventCheckinError, GetEventCheckinQueryData, GetEventCheckinQueryError, GetEventCheckinQueryResponse, GetEventCheckinResponse, GetEventInfoData, GetEventInfoError, GetEventInfoResponse, GetEventJoinedData, GetEventJoinedError, GetEventJoinedResponse, GetEventListData, GetEventListError, GetEventListResponse, GetUserInfoByUserIdData, GetUserInfoByUserIdError, GetUserInfoByUserIdResponse, GetUserInfoData, GetUserInfoError, GetUserInfoResponse, GetUserListData, GetUserListError, GetUserListResponse, PatchUserUpdateData, PatchUserUpdateError, PatchUserUpdateResponse, PostAgendaSubmitData, PostAgendaSubmitError, PostAgendaSubmitResponse, PostAuthExchangeData, PostAuthExchangeError, PostAuthExchangeResponse, PostAuthMagicData, PostAuthMagicError, PostAuthMagicResponse, PostAuthRefreshData, PostAuthRefreshError, PostAuthRefreshResponse, PostAuthTokenData, PostAuthTokenError, PostAuthTokenResponse, PostEventCheckinSubmitData, PostEventCheckinSubmitError, PostEventCheckinSubmitResponse, PostEventJoinData, PostEventJoinError, PostEventJoinResponse, PostKycQueryData, PostKycQueryError, PostKycQueryResponse, PostKycSessionData, PostKycSessionError, PostKycSessionResponse } from '../types.gen'; + +/** + * Submit Agenda + * + * Creates a new agenda item for a specific attendance record. + */ +export const postAgendaSubmitMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await postAgendaSubmit({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; +}; /** * Exchange Auth Code @@ -253,16 +272,16 @@ export const postEventJoinMutation = (options?: Partial) => createQueryKey('getEventList', options); +export const getEventJoinedQueryKey = (options?: Options) => createQueryKey('getEventJoined', options); /** - * List Events + * Get Joined Events * - * Fetches a list of events with support for pagination via limit and offset. Data is retrieved directly from the database for consistency. + * Fetches a list of events where the authenticated user is a participant. Supports pagination. */ -export const getEventListOptions = (options: Options) => queryOptions>({ +export const getEventJoinedOptions = (options?: Options) => queryOptions>({ queryFn: async ({ queryKey, signal }) => { - const { data } = await getEventList({ + const { data } = await getEventJoined({ ...options, ...queryKey[0], signal, @@ -270,7 +289,7 @@ export const getEventListOptions = (options: Options) => query }); return data; }, - queryKey: getEventListQueryKey(options) + queryKey: getEventJoinedQueryKey(options) }); const createInfiniteParams = [0], 'body' | 'headers' | 'path' | 'query'>>(queryKey: QueryKey, page: K) => { @@ -302,14 +321,63 @@ const createInfiniteParams = [0], 'body' | 'hea return params as unknown as typeof page; }; -export const getEventListInfiniteQueryKey = (options: Options): QueryKey> => createQueryKey('getEventList', options, true); +export const getEventJoinedInfiniteQueryKey = (options?: Options): QueryKey> => createQueryKey('getEventJoined', options, true); + +/** + * Get Joined Events + * + * Fetches a list of events where the authenticated user is a participant. Supports pagination. + */ +export const getEventJoinedInfiniteOptions = (options?: Options) => infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey, signal }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === 'object' ? pageParam : { + query: { + offset: pageParam + } + }; + const params = createInfiniteParams(queryKey, page); + const { data } = await getEventJoined({ + ...options, + ...params, + signal, + throwOnError: true + }); + return data; + }, + queryKey: getEventJoinedInfiniteQueryKey(options) +}); + +export const getEventListQueryKey = (options?: Options) => createQueryKey('getEventList', options); /** * List Events * * Fetches a list of events with support for pagination via limit and offset. Data is retrieved directly from the database for consistency. */ -export const getEventListInfiniteOptions = (options: Options) => infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +export const getEventListOptions = (options?: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getEventList({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: getEventListQueryKey(options) +}); + +export const getEventListInfiniteQueryKey = (options?: Options): QueryKey> => createQueryKey('getEventList', options, true); + +/** + * List Events + * + * Fetches a list of events with support for pagination via limit and offset. Data is retrieved directly from the database for consistency. + */ +export const getEventListInfiniteOptions = (options?: Options) => infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( // @ts-ignore { queryFn: async ({ pageParam, queryKey, signal }) => { @@ -369,14 +437,14 @@ export const postKycSessionMutation = (options?: Partial) => createQueryKey('getUserInfo', options); +export const getUserInfoQueryKey = (options?: Options) => createQueryKey('getUserInfo', options); /** * Get My User Information * * Fetches the complete profile data for the user associated with the provided session/token. */ -export const getUserInfoOptions = (options: Options) => queryOptions>({ +export const getUserInfoOptions = (options?: Options) => queryOptions>({ queryFn: async ({ queryKey, signal }) => { const { data } = await getUserInfo({ ...options, diff --git a/client/cms/src/client/client.gen.ts b/client/cms/src/client/client.gen.ts index 36ba69f..579bbbd 100644 --- a/client/cms/src/client/client.gen.ts +++ b/client/cms/src/client/client.gen.ts @@ -13,4 +13,4 @@ import type { ClientOptions as ClientOptions2 } from './types.gen'; */ export type CreateClientConfig = (override?: Config) => Config & T>; -export const client = createClient(createConfig({ baseUrl: 'http://localhost:8000/api/v1' })); +export const client = createClient(createConfig({ baseUrl: 'http://localhost:8000/app/api/v1' })); diff --git a/client/cms/src/client/index.ts b/client/cms/src/client/index.ts index 0b14418..e9ad98d 100644 --- a/client/cms/src/client/index.ts +++ b/client/cms/src/client/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts -export { getAuthRedirect, getEventAttendance, getEventCheckin, getEventCheckinQuery, getEventInfo, getEventList, getUserInfo, getUserInfoByUserId, getUserList, type Options, patchUserUpdate, postAuthExchange, postAuthMagic, postAuthRefresh, postAuthToken, postEventCheckinSubmit, postEventJoin, postKycQuery, postKycSession } from './sdk.gen'; -export type { ClientOptions, DataEventIndexDoc, DataUserIndexDoc, GetAuthRedirectData, GetAuthRedirectError, GetAuthRedirectErrors, GetEventAttendanceData, GetEventAttendanceError, GetEventAttendanceErrors, GetEventAttendanceResponse, GetEventAttendanceResponses, GetEventCheckinData, GetEventCheckinError, GetEventCheckinErrors, GetEventCheckinQueryData, GetEventCheckinQueryError, GetEventCheckinQueryErrors, GetEventCheckinQueryResponse, GetEventCheckinQueryResponses, GetEventCheckinResponse, GetEventCheckinResponses, GetEventInfoData, GetEventInfoError, GetEventInfoErrors, GetEventInfoResponse, GetEventInfoResponses, GetEventListData, GetEventListError, GetEventListErrors, GetEventListResponse, GetEventListResponses, GetUserInfoByUserIdData, GetUserInfoByUserIdError, GetUserInfoByUserIdErrors, GetUserInfoByUserIdResponse, GetUserInfoByUserIdResponses, GetUserInfoData, GetUserInfoError, GetUserInfoErrors, GetUserInfoResponse, GetUserInfoResponses, GetUserListData, GetUserListError, GetUserListErrors, GetUserListResponse, GetUserListResponses, PatchUserUpdateData, PatchUserUpdateError, PatchUserUpdateErrors, PatchUserUpdateResponse, PatchUserUpdateResponses, PostAuthExchangeData, PostAuthExchangeError, PostAuthExchangeErrors, PostAuthExchangeResponse, PostAuthExchangeResponses, PostAuthMagicData, PostAuthMagicError, PostAuthMagicErrors, PostAuthMagicResponse, PostAuthMagicResponses, PostAuthRefreshData, PostAuthRefreshError, PostAuthRefreshErrors, PostAuthRefreshResponse, PostAuthRefreshResponses, PostAuthTokenData, PostAuthTokenError, PostAuthTokenErrors, PostAuthTokenResponse, PostAuthTokenResponses, PostEventCheckinSubmitData, PostEventCheckinSubmitError, PostEventCheckinSubmitErrors, PostEventCheckinSubmitResponse, PostEventCheckinSubmitResponses, PostEventJoinData, PostEventJoinError, PostEventJoinErrors, PostEventJoinResponse, PostEventJoinResponses, PostKycQueryData, PostKycQueryError, PostKycQueryErrors, PostKycQueryResponse, PostKycQueryResponses, PostKycSessionData, PostKycSessionError, PostKycSessionErrors, PostKycSessionResponse, PostKycSessionResponses, ServiceAuthExchangeData, ServiceAuthExchangeResponse, ServiceAuthMagicData, ServiceAuthMagicResponse, ServiceAuthRefreshData, ServiceAuthTokenData, ServiceAuthTokenResponse, ServiceEventAttendanceListResponse, ServiceEventCheckinQueryResponse, ServiceEventCheckinResponse, ServiceEventCheckinSubmitData, ServiceEventEventJoinData, ServiceKycKycQueryData, ServiceKycKycQueryResponse, ServiceKycKycSessionData, ServiceKycKycSessionResponse, ServiceUserUserInfoData, UtilsRespStatus } from './types.gen'; +export { getAuthRedirect, getEventAttendance, getEventCheckin, getEventCheckinQuery, getEventInfo, getEventJoined, getEventList, getUserInfo, getUserInfoByUserId, getUserList, type Options, patchUserUpdate, postAgendaSubmit, postAuthExchange, postAuthMagic, postAuthRefresh, postAuthToken, postEventCheckinSubmit, postEventJoin, postKycQuery, postKycSession } from './sdk.gen'; +export type { ClientOptions, DataEventIndexDoc, DataUserIndexDoc, GetAuthRedirectData, GetAuthRedirectError, GetAuthRedirectErrors, GetEventAttendanceData, GetEventAttendanceError, GetEventAttendanceErrors, GetEventAttendanceResponse, GetEventAttendanceResponses, GetEventCheckinData, GetEventCheckinError, GetEventCheckinErrors, GetEventCheckinQueryData, GetEventCheckinQueryError, GetEventCheckinQueryErrors, GetEventCheckinQueryResponse, GetEventCheckinQueryResponses, GetEventCheckinResponse, GetEventCheckinResponses, GetEventInfoData, GetEventInfoError, GetEventInfoErrors, GetEventInfoResponse, GetEventInfoResponses, GetEventJoinedData, GetEventJoinedError, GetEventJoinedErrors, GetEventJoinedResponse, GetEventJoinedResponses, GetEventListData, GetEventListError, GetEventListErrors, GetEventListResponse, GetEventListResponses, GetUserInfoByUserIdData, GetUserInfoByUserIdError, GetUserInfoByUserIdErrors, GetUserInfoByUserIdResponse, GetUserInfoByUserIdResponses, GetUserInfoData, GetUserInfoError, GetUserInfoErrors, GetUserInfoResponse, GetUserInfoResponses, GetUserListData, GetUserListError, GetUserListErrors, GetUserListResponse, GetUserListResponses, PatchUserUpdateData, PatchUserUpdateError, PatchUserUpdateErrors, PatchUserUpdateResponse, PatchUserUpdateResponses, PostAgendaSubmitData, PostAgendaSubmitError, PostAgendaSubmitErrors, PostAgendaSubmitResponse, PostAgendaSubmitResponses, PostAuthExchangeData, PostAuthExchangeError, PostAuthExchangeErrors, PostAuthExchangeResponse, PostAuthExchangeResponses, PostAuthMagicData, PostAuthMagicError, PostAuthMagicErrors, PostAuthMagicResponse, PostAuthMagicResponses, PostAuthRefreshData, PostAuthRefreshError, PostAuthRefreshErrors, PostAuthRefreshResponse, PostAuthRefreshResponses, PostAuthTokenData, PostAuthTokenError, PostAuthTokenErrors, PostAuthTokenResponse, PostAuthTokenResponses, PostEventCheckinSubmitData, PostEventCheckinSubmitError, PostEventCheckinSubmitErrors, PostEventCheckinSubmitResponse, PostEventCheckinSubmitResponses, PostEventJoinData, PostEventJoinError, PostEventJoinErrors, PostEventJoinResponse, PostEventJoinResponses, PostKycQueryData, PostKycQueryError, PostKycQueryErrors, PostKycQueryResponse, PostKycQueryResponses, PostKycSessionData, PostKycSessionError, PostKycSessionErrors, PostKycSessionResponse, PostKycSessionResponses, ServiceAgendaSubmitData, ServiceAgendaSubmitResponse, ServiceAuthExchangeData, ServiceAuthExchangeResponse, ServiceAuthMagicData, ServiceAuthMagicResponse, ServiceAuthRefreshData, ServiceAuthTokenData, ServiceAuthTokenResponse, ServiceEventAttendanceListResponse, ServiceEventCheckinQueryResponse, ServiceEventCheckinResponse, ServiceEventCheckinSubmitData, ServiceEventEventJoinData, ServiceEventEventJoinResponse, ServiceKycKycQueryData, ServiceKycKycQueryResponse, ServiceKycKycSessionData, ServiceKycKycSessionResponse, ServiceUserUserInfoData, UtilsRespStatus } from './types.gen'; diff --git a/client/cms/src/client/sdk.gen.ts b/client/cms/src/client/sdk.gen.ts index ae9f15d..4252078 100644 --- a/client/cms/src/client/sdk.gen.ts +++ b/client/cms/src/client/sdk.gen.ts @@ -2,7 +2,7 @@ import type { Client, Options as Options2, TDataShape } from './client'; import { client } from './client.gen'; -import type { GetAuthRedirectData, GetAuthRedirectErrors, GetEventAttendanceData, GetEventAttendanceErrors, GetEventAttendanceResponses, GetEventCheckinData, GetEventCheckinErrors, GetEventCheckinQueryData, GetEventCheckinQueryErrors, GetEventCheckinQueryResponses, GetEventCheckinResponses, GetEventInfoData, GetEventInfoErrors, GetEventInfoResponses, GetEventListData, GetEventListErrors, GetEventListResponses, GetUserInfoByUserIdData, GetUserInfoByUserIdErrors, GetUserInfoByUserIdResponses, GetUserInfoData, GetUserInfoErrors, GetUserInfoResponses, GetUserListData, GetUserListErrors, GetUserListResponses, PatchUserUpdateData, PatchUserUpdateErrors, PatchUserUpdateResponses, PostAuthExchangeData, PostAuthExchangeErrors, PostAuthExchangeResponses, PostAuthMagicData, PostAuthMagicErrors, PostAuthMagicResponses, PostAuthRefreshData, PostAuthRefreshErrors, PostAuthRefreshResponses, PostAuthTokenData, PostAuthTokenErrors, PostAuthTokenResponses, PostEventCheckinSubmitData, PostEventCheckinSubmitErrors, PostEventCheckinSubmitResponses, PostEventJoinData, PostEventJoinErrors, PostEventJoinResponses, PostKycQueryData, PostKycQueryErrors, PostKycQueryResponses, PostKycSessionData, PostKycSessionErrors, PostKycSessionResponses } from './types.gen'; +import type { GetAuthRedirectData, GetAuthRedirectErrors, GetEventAttendanceData, GetEventAttendanceErrors, GetEventAttendanceResponses, GetEventCheckinData, GetEventCheckinErrors, GetEventCheckinQueryData, GetEventCheckinQueryErrors, GetEventCheckinQueryResponses, GetEventCheckinResponses, GetEventInfoData, GetEventInfoErrors, GetEventInfoResponses, GetEventJoinedData, GetEventJoinedErrors, GetEventJoinedResponses, GetEventListData, GetEventListErrors, GetEventListResponses, GetUserInfoByUserIdData, GetUserInfoByUserIdErrors, GetUserInfoByUserIdResponses, GetUserInfoData, GetUserInfoErrors, GetUserInfoResponses, GetUserListData, GetUserListErrors, GetUserListResponses, PatchUserUpdateData, PatchUserUpdateErrors, PatchUserUpdateResponses, PostAgendaSubmitData, PostAgendaSubmitErrors, PostAgendaSubmitResponses, PostAuthExchangeData, PostAuthExchangeErrors, PostAuthExchangeResponses, PostAuthMagicData, PostAuthMagicErrors, PostAuthMagicResponses, PostAuthRefreshData, PostAuthRefreshErrors, PostAuthRefreshResponses, PostAuthTokenData, PostAuthTokenErrors, PostAuthTokenResponses, PostEventCheckinSubmitData, PostEventCheckinSubmitErrors, PostEventCheckinSubmitResponses, PostEventJoinData, PostEventJoinErrors, PostEventJoinResponses, PostKycQueryData, PostKycQueryErrors, PostKycQueryResponses, PostKycSessionData, PostKycSessionErrors, PostKycSessionResponses } from './types.gen'; export type Options = Options2 & { /** @@ -18,6 +18,20 @@ export type Options; }; +/** + * Submit Agenda + * + * Creates a new agenda item for a specific attendance record. + */ +export const postAgendaSubmit = (options: Options) => (options.client ?? client).post({ + url: '/agenda/submit', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); + /** * Exchange Auth Code * @@ -137,12 +151,19 @@ export const postEventJoin = (options: Opt } }); +/** + * Get Joined Events + * + * Fetches a list of events where the authenticated user is a participant. Supports pagination. + */ +export const getEventJoined = (options?: Options) => (options?.client ?? client).get({ url: '/event/joined', ...options }); + /** * List Events * * Fetches a list of events with support for pagination via limit and offset. Data is retrieved directly from the database for consistency. */ -export const getEventList = (options: Options) => (options.client ?? client).get({ url: '/event/list', ...options }); +export const getEventList = (options?: Options) => (options?.client ?? client).get({ url: '/event/list', ...options }); /** * Query KYC Status @@ -177,7 +198,7 @@ export const postKycSession = (options: Op * * Fetches the complete profile data for the user associated with the provided session/token. */ -export const getUserInfo = (options: Options) => (options.client ?? client).get({ url: '/user/info', ...options }); +export const getUserInfo = (options?: Options) => (options?.client ?? client).get({ url: '/user/info', ...options }); /** * Get Other User Information diff --git a/client/cms/src/client/types.gen.ts b/client/cms/src/client/types.gen.ts index 379bdc7..cb65abf 100644 --- a/client/cms/src/client/types.gen.ts +++ b/client/cms/src/client/types.gen.ts @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts export type ClientOptions = { - baseUrl: 'http://localhost:8000/api/v1' | 'https://localhost:8000/api/v1' | (string & {}); + baseUrl: 'http://localhost:8000/app/api/v1' | 'https://localhost:8000/app/api/v1' | (string & {}); }; export type DataEventIndexDoc = { @@ -28,6 +28,16 @@ export type DataUserIndexDoc = { username?: string; }; +export type ServiceAgendaSubmitData = { + description?: string; + event_id?: string; + name?: string; +}; + +export type ServiceAgendaSubmitResponse = { + agenda_id?: string; +}; + export type ServiceAuthExchangeData = { client_id?: string; redirect_uri?: string; @@ -88,6 +98,10 @@ export type ServiceEventEventJoinData = { kyc_id?: string; }; +export type ServiceEventEventJoinResponse = { + attendance_id?: string; +}; + export type ServiceKycKycQueryData = { kyc_id?: string; }; @@ -138,17 +152,53 @@ export type UtilsRespStatus = { status?: string; }; +export type PostAgendaSubmitData = { + /** + * Agenda Submission Data + */ + body: ServiceAgendaSubmitData; + path?: never; + query?: never; + url: '/agenda/submit'; +}; + +export type PostAgendaSubmitErrors = { + /** + * Invalid Input + */ + 400: UtilsRespStatus & { + data?: { + [key: string]: unknown; + }; + }; + /** + * Internal Server Error + */ + 500: UtilsRespStatus & { + data?: { + [key: string]: unknown; + }; + }; +}; + +export type PostAgendaSubmitError = PostAgendaSubmitErrors[keyof PostAgendaSubmitErrors]; + +export type PostAgendaSubmitResponses = { + /** + * OK + */ + 200: UtilsRespStatus & { + data?: ServiceAgendaSubmitResponse; + }; +}; + +export type PostAgendaSubmitResponse = PostAgendaSubmitResponses[keyof PostAgendaSubmitResponses]; + export type PostAuthExchangeData = { /** * Exchange Request Credentials */ body: ServiceAuthExchangeData; - headers: { - /** - * latest - */ - 'X-Api-Version': string; - }; path?: never; query?: never; url: '/auth/exchange'; @@ -199,12 +249,6 @@ export type PostAuthMagicData = { * Magic Link Request Data */ body: ServiceAuthMagicData; - headers: { - /** - * latest - */ - 'X-Api-Version': string; - }; path?: never; query?: never; url: '/auth/magic'; @@ -308,12 +352,6 @@ export type PostAuthRefreshData = { * Refresh Token Body */ body: ServiceAuthRefreshData; - headers: { - /** - * latest - */ - 'X-Api-Version': string; - }; path?: never; query?: never; url: '/auth/refresh'; @@ -364,12 +402,6 @@ export type PostAuthTokenData = { * Token Request Body */ body: ServiceAuthTokenData; - headers: { - /** - * latest - */ - 'X-Api-Version': string; - }; path?: never; query?: never; url: '/auth/token'; @@ -417,12 +449,6 @@ export type PostAuthTokenResponse = PostAuthTokenResponses[keyof PostAuthTokenRe export type GetEventAttendanceData = { body?: never; - headers: { - /** - * latest - */ - 'X-Api-Version': string; - }; path?: never; query: { /** @@ -480,6 +506,10 @@ export type GetEventCheckinData = { * latest */ 'X-Api-Version': string; + /** + * Bearer token + */ + Authorization: string; }; path?: never; query: { @@ -580,6 +610,16 @@ export type PostEventCheckinSubmitData = { * Checkin Code Data */ body: ServiceEventCheckinSubmitData; + headers: { + /** + * latest + */ + 'X-Api-Version': string; + /** + * Bearer token + */ + Authorization: string; + }; path?: never; query?: never; url: '/event/checkin/submit'; @@ -613,12 +653,6 @@ export type PostEventCheckinSubmitResponse = PostEventCheckinSubmitResponses[key export type GetEventInfoData = { body?: never; - headers: { - /** - * latest - */ - 'X-Api-Version': string; - }; path?: never; query: { /** @@ -682,12 +716,6 @@ export type PostEventJoinData = { * Event Join Details (UserId and EventId are required) */ body: ServiceEventEventJoinData; - headers: { - /** - * latest - */ - 'X-Api-Version': string; - }; path?: never; query?: never; url: '/event/join'; @@ -735,22 +763,70 @@ export type PostEventJoinResponses = { * Successfully joined the event */ 200: UtilsRespStatus & { + data?: ServiceEventEventJoinResponse; + }; +}; + +export type PostEventJoinResponse = PostEventJoinResponses[keyof PostEventJoinResponses]; + +export type GetEventJoinedData = { + body?: never; + path?: never; + query?: { + /** + * Maximum number of events to return (default 20) + */ + limit?: number; + /** + * Number of events to skip + */ + offset?: number; + }; + url: '/event/joined'; +}; + +export type GetEventJoinedErrors = { + /** + * Invalid Input + */ + 400: UtilsRespStatus & { + data?: { + [key: string]: unknown; + }; + }; + /** + * Unauthorized + */ + 401: UtilsRespStatus & { + data?: { + [key: string]: unknown; + }; + }; + /** + * Internal Server Error + */ + 500: UtilsRespStatus & { data?: { [key: string]: unknown; }; }; }; -export type PostEventJoinResponse = PostEventJoinResponses[keyof PostEventJoinResponses]; +export type GetEventJoinedError = GetEventJoinedErrors[keyof GetEventJoinedErrors]; + +export type GetEventJoinedResponses = { + /** + * Successful retrieval of joined events + */ + 200: UtilsRespStatus & { + data?: Array; + }; +}; + +export type GetEventJoinedResponse = GetEventJoinedResponses[keyof GetEventJoinedResponses]; export type GetEventListData = { body?: never; - headers: { - /** - * latest - */ - 'X-Api-Version': string; - }; path?: never; query?: { /** @@ -810,12 +886,6 @@ export type PostKycQueryData = { * KYC query data (KycId) */ body: ServiceKycKycQueryData; - headers: { - /** - * latest - */ - 'X-Api-Version': string; - }; path?: never; query?: never; url: '/kyc/query'; @@ -866,12 +936,6 @@ export type PostKycSessionData = { * KYC session data (Type and Base64 Identity) */ body: ServiceKycKycSessionData; - headers: { - /** - * latest - */ - 'X-Api-Version': string; - }; path?: never; query?: never; url: '/kyc/session'; @@ -919,12 +983,6 @@ export type PostKycSessionResponse = PostKycSessionResponses[keyof PostKycSessio export type GetUserInfoData = { body?: never; - headers: { - /** - * latest - */ - 'X-Api-Version': string; - }; path?: never; query?: never; url: '/user/info'; @@ -972,12 +1030,6 @@ export type GetUserInfoResponse = GetUserInfoResponses[keyof GetUserInfoResponse export type GetUserInfoByUserIdData = { body?: never; - headers: { - /** - * latest - */ - 'X-Api-Version': string; - }; path: { /** * Other user id @@ -1038,12 +1090,6 @@ export type GetUserInfoByUserIdResponse = GetUserInfoByUserIdResponses[keyof Get export type GetUserListData = { body?: never; - headers: { - /** - * latest - */ - 'X-Api-Version': string; - }; path?: never; query: { /** @@ -1103,12 +1149,6 @@ export type PatchUserUpdateData = { * Updated User Profile Data */ body: ServiceUserUserInfoData; - headers: { - /** - * latest - */ - 'X-Api-Version': string; - }; path?: never; query?: never; url: '/user/update'; diff --git a/client/cms/src/client/zod.gen.ts b/client/cms/src/client/zod.gen.ts index 3303d44..0dcffaa 100644 --- a/client/cms/src/client/zod.gen.ts +++ b/client/cms/src/client/zod.gen.ts @@ -26,6 +26,16 @@ export const zDataUserIndexDoc = z.object({ username: z.string().optional() }); +export const zServiceAgendaSubmitData = z.object({ + description: z.string().optional(), + event_id: z.string().optional(), + name: z.string().optional() +}); + +export const zServiceAgendaSubmitResponse = z.object({ + agenda_id: z.string().optional() +}); + export const zServiceAuthExchangeData = z.object({ client_id: z.string().optional(), redirect_uri: z.string().optional(), @@ -79,6 +89,10 @@ export const zServiceEventEventJoinData = z.object({ kyc_id: z.string().optional() }); +export const zServiceEventEventJoinResponse = z.object({ + attendance_id: z.string().optional() +}); + export const zServiceKycKycQueryData = z.object({ kyc_id: z.string().optional() }); @@ -124,13 +138,23 @@ export const zUtilsRespStatus = z.object({ status: z.string().optional() }); +export const zPostAgendaSubmitData = z.object({ + body: zServiceAgendaSubmitData, + path: z.never().optional(), + query: z.never().optional() +}); + +/** + * OK + */ +export const zPostAgendaSubmitResponse = zUtilsRespStatus.and(z.object({ + data: zServiceAgendaSubmitResponse.optional() +})); + export const zPostAuthExchangeData = z.object({ body: zServiceAuthExchangeData, path: z.never().optional(), - query: z.never().optional(), - headers: z.object({ - 'X-Api-Version': z.string() - }) + query: z.never().optional() }); /** @@ -143,10 +167,7 @@ export const zPostAuthExchangeResponse = zUtilsRespStatus.and(z.object({ export const zPostAuthMagicData = z.object({ body: zServiceAuthMagicData, path: z.never().optional(), - query: z.never().optional(), - headers: z.object({ - 'X-Api-Version': z.string() - }) + query: z.never().optional() }); /** @@ -170,10 +191,7 @@ export const zGetAuthRedirectData = z.object({ export const zPostAuthRefreshData = z.object({ body: zServiceAuthRefreshData, path: z.never().optional(), - query: z.never().optional(), - headers: z.object({ - 'X-Api-Version': z.string() - }) + query: z.never().optional() }); /** @@ -186,10 +204,7 @@ export const zPostAuthRefreshResponse = zUtilsRespStatus.and(z.object({ export const zPostAuthTokenData = z.object({ body: zServiceAuthTokenData, path: z.never().optional(), - query: z.never().optional(), - headers: z.object({ - 'X-Api-Version': z.string() - }) + query: z.never().optional() }); /** @@ -204,9 +219,6 @@ export const zGetEventAttendanceData = z.object({ path: z.never().optional(), query: z.object({ event_id: z.string() - }), - headers: z.object({ - 'X-Api-Version': z.string() }) }); @@ -224,7 +236,8 @@ export const zGetEventCheckinData = z.object({ event_id: z.string() }), headers: z.object({ - 'X-Api-Version': z.string() + 'X-Api-Version': z.string(), + Authorization: z.string() }) }); @@ -253,7 +266,11 @@ export const zGetEventCheckinQueryResponse = zUtilsRespStatus.and(z.object({ export const zPostEventCheckinSubmitData = z.object({ body: zServiceEventCheckinSubmitData, path: z.never().optional(), - query: z.never().optional() + query: z.never().optional(), + headers: z.object({ + 'X-Api-Version': z.string(), + Authorization: z.string() + }) }); /** @@ -268,9 +285,6 @@ export const zGetEventInfoData = z.object({ path: z.never().optional(), query: z.object({ event_id: z.string() - }), - headers: z.object({ - 'X-Api-Version': z.string() }) }); @@ -284,17 +298,30 @@ export const zGetEventInfoResponse = zUtilsRespStatus.and(z.object({ export const zPostEventJoinData = z.object({ body: zServiceEventEventJoinData, path: z.never().optional(), - query: z.never().optional(), - headers: z.object({ - 'X-Api-Version': z.string() - }) + query: z.never().optional() }); /** * Successfully joined the event */ export const zPostEventJoinResponse = zUtilsRespStatus.and(z.object({ - data: z.record(z.unknown()).optional() + data: zServiceEventEventJoinResponse.optional() +})); + +export const zGetEventJoinedData = z.object({ + body: z.never().optional(), + path: z.never().optional(), + query: z.object({ + limit: z.number().int().optional(), + offset: z.number().int().optional() + }).optional() +}); + +/** + * Successful retrieval of joined events + */ +export const zGetEventJoinedResponse = zUtilsRespStatus.and(z.object({ + data: z.array(zDataEventIndexDoc).optional() })); export const zGetEventListData = z.object({ @@ -303,10 +330,7 @@ export const zGetEventListData = z.object({ query: z.object({ limit: z.number().int().optional(), offset: z.number().int().optional() - }).optional(), - headers: z.object({ - 'X-Api-Version': z.string() - }) + }).optional() }); /** @@ -319,10 +343,7 @@ export const zGetEventListResponse = zUtilsRespStatus.and(z.object({ export const zPostKycQueryData = z.object({ body: zServiceKycKycQueryData, path: z.never().optional(), - query: z.never().optional(), - headers: z.object({ - 'X-Api-Version': z.string() - }) + query: z.never().optional() }); /** @@ -335,10 +356,7 @@ export const zPostKycQueryResponse = zUtilsRespStatus.and(z.object({ export const zPostKycSessionData = z.object({ body: zServiceKycKycSessionData, path: z.never().optional(), - query: z.never().optional(), - headers: z.object({ - 'X-Api-Version': z.string() - }) + query: z.never().optional() }); /** @@ -351,10 +369,7 @@ export const zPostKycSessionResponse = zUtilsRespStatus.and(z.object({ export const zGetUserInfoData = z.object({ body: z.never().optional(), path: z.never().optional(), - query: z.never().optional(), - headers: z.object({ - 'X-Api-Version': z.string() - }) + query: z.never().optional() }); /** @@ -369,10 +384,7 @@ export const zGetUserInfoByUserIdData = z.object({ path: z.object({ user_id: z.string() }), - query: z.never().optional(), - headers: z.object({ - 'X-Api-Version': z.string() - }) + query: z.never().optional() }); /** @@ -388,9 +400,6 @@ export const zGetUserListData = z.object({ query: z.object({ limit: z.string().optional(), offset: z.string() - }), - headers: z.object({ - 'X-Api-Version': z.string() }) }); @@ -404,10 +413,7 @@ export const zGetUserListResponse = zUtilsRespStatus.and(z.object({ export const zPatchUserUpdateData = z.object({ body: zServiceUserUserInfoData, path: z.never().optional(), - query: z.never().optional(), - headers: z.object({ - 'X-Api-Version': z.string() - }) + query: z.never().optional() }); /** diff --git a/client/cms/src/components/events/kyc/kyc.dialog.container.tsx b/client/cms/src/components/events/kyc/kyc.dialog.container.tsx index ad7953c..0ab3c8b 100644 --- a/client/cms/src/components/events/kyc/kyc.dialog.container.tsx +++ b/client/cms/src/components/events/kyc/kyc.dialog.container.tsx @@ -6,7 +6,6 @@ import { useStore } from 'zustand'; import { postEventJoin, postKycQuery } from '@/client'; import { getEventListInfiniteQueryKey } from '@/client/@tanstack/react-query.gen'; import { useCreateKycSession } from '@/hooks/data/useCreateKycSession'; -import { ver } from '@/lib/apiVersion'; import { KycFailedDialogView } from './kyc-failed.dialog.view'; import { KycMethodSelectionDialogView } from './kyc-method-selection.dialog.view'; import { KycPendingDialogView } from './kyc-pending.dialog.view'; @@ -30,7 +29,6 @@ export function KycDialogContainer({ eventIdToJoin, children }: { eventIdToJoin: await postEventJoin({ signal: abortSignal, body: { event_id: eventId, kyc_id: kycId }, - headers: ver('20260205'), }); setStage('success'); } @@ -71,7 +69,6 @@ export function KycDialogContainer({ eventIdToJoin, children }: { eventIdToJoin: const { data } = await postKycQuery({ signal: controller.signal, body: { kyc_id: store.getState().kycId! }, - headers: ver('20260205'), }); const status = data?.data?.status; @@ -112,7 +109,7 @@ export function KycDialogContainer({ eventIdToJoin, children }: { eventIdToJoin: onOpenChange={(open) => { if (!open) { void queryClient.invalidateQueries({ - queryKey: getEventListInfiniteQueryKey({ query: {}, headers: ver('20260205') }), + queryKey: getEventListInfiniteQueryKey({ query: {} }), }); } setIsDialogOpen(open); diff --git a/client/cms/src/components/login-form.tsx b/client/cms/src/components/login-form.tsx index 68afe8e..5447440 100644 --- a/client/cms/src/components/login-form.tsx +++ b/client/cms/src/components/login-form.tsx @@ -13,7 +13,6 @@ import { } from '@/components/ui/field'; import { Input } from '@/components/ui/input'; import { useGetMagicLink } from '@/hooks/data/useGetMagicLink'; -import { ver } from '@/lib/apiVersion'; import { cn } from '@/lib/utils'; export function LoginForm({ @@ -33,7 +32,7 @@ export function LoginForm({ event.preventDefault(); const formData = new FormData(formRef.current!); const email = formData.get('email')! as string; - mutateAsync({ body: { email, turnstile_token: token!, ...oauthParams }, headers: ver('20260205') }).then(() => { + mutateAsync({ body: { email, turnstile_token: token!, ...oauthParams } }).then(() => { void navigate({ to: '/magicLinkSent', search: { email } }); }).catch((error) => { console.error(error); diff --git a/client/cms/src/components/profile/edit-profile.dialog.container.tsx b/client/cms/src/components/profile/edit-profile.dialog.container.tsx index d8ade1b..53cd883 100644 --- a/client/cms/src/components/profile/edit-profile.dialog.container.tsx +++ b/client/cms/src/components/profile/edit-profile.dialog.container.tsx @@ -1,6 +1,5 @@ import type { ServiceUserUserInfoData } from '@/client'; import { useUpdateUser } from '@/hooks/data/useUpdateUser'; -import { ver } from '@/lib/apiVersion'; import { EditProfileDialogView } from './edit-profile.dialog.view'; export function EditProfileDialogContainer({ data }: { data: ServiceUserUserInfoData }) { @@ -9,7 +8,7 @@ export function EditProfileDialogContainer({ data }: { data: ServiceUserUserInfo { - await mutateAsync({ body: data, headers: ver('20260205') }); + await mutateAsync({ body: data }); }} /> ); diff --git a/client/cms/src/components/profile/profile.container.tsx b/client/cms/src/components/profile/profile.container.tsx index 38afb2d..c82593e 100644 --- a/client/cms/src/components/profile/profile.container.tsx +++ b/client/cms/src/components/profile/profile.container.tsx @@ -1,6 +1,5 @@ import { useUpdateUser } from '@/hooks/data/useUpdateUser'; import { useOtherUserInfo } from '@/hooks/data/useUserInfo'; -import { ver } from '@/lib/apiVersion'; import { utf8ToBase64 } from '@/lib/utils'; import { ProfileView } from './profile.view'; @@ -11,7 +10,7 @@ export function ProfileContainer({ userId }: { userId: string }) { { - await mutateAsync({ body: { bio: utf8ToBase64(bio) }, headers: ver('20260205') }); + await mutateAsync({ body: { bio: utf8ToBase64(bio) } }); }} /> ); diff --git a/client/cms/src/hooks/data/useCreateKycSession.ts b/client/cms/src/hooks/data/useCreateKycSession.ts index 4f0c342..1c95b91 100644 --- a/client/cms/src/hooks/data/useCreateKycSession.ts +++ b/client/cms/src/hooks/data/useCreateKycSession.ts @@ -1,7 +1,6 @@ import type { KycSubmission } from '@/components/events/kyc/kyc.types'; import { useMutation } from '@tanstack/react-query'; import { postKycSessionMutation } from '@/client/@tanstack/react-query.gen'; -import { ver } from '@/lib/apiVersion'; import { utf8ToBase64 } from '@/lib/utils'; type CreateKycSessionBase64Payload = { @@ -37,7 +36,6 @@ export function useCreateKycSession() { identity: payload, type: data.method, }, - headers: ver('20260205'), }); return response; }, diff --git a/client/cms/src/hooks/data/useGetEvents.ts b/client/cms/src/hooks/data/useGetEvents.ts index 854969a..8ba728a 100644 --- a/client/cms/src/hooks/data/useGetEvents.ts +++ b/client/cms/src/hooks/data/useGetEvents.ts @@ -1,13 +1,11 @@ import { useInfiniteQuery } from '@tanstack/react-query'; import { isNil } from 'lodash-es'; import { getEventListInfiniteOptions } from '@/client/@tanstack/react-query.gen'; -import { ver } from '@/lib/apiVersion'; export function useGetEvents() { return useInfiniteQuery({ ...getEventListInfiniteOptions({ query: {}, - headers: ver('20260205'), }), initialPageParam: 0, getNextPageParam: (lastPage, allPages) => { diff --git a/client/cms/src/hooks/data/useUpdateUser.ts b/client/cms/src/hooks/data/useUpdateUser.ts index c3940ea..d99a302 100644 --- a/client/cms/src/hooks/data/useUpdateUser.ts +++ b/client/cms/src/hooks/data/useUpdateUser.ts @@ -1,17 +1,16 @@ import type { ServiceUserUserInfoData } from '@/client'; import { useMutation, useQueryClient } from '@tanstack/react-query'; import { getUserInfoByUserIdQueryKey, getUserInfoQueryKey, patchUserUpdateMutation } from '@/client/@tanstack/react-query.gen'; -import { ver } from '@/lib/apiVersion'; export function useUpdateUser() { const queryClient = useQueryClient(); - const data: { data: ServiceUserUserInfoData | undefined } | undefined = queryClient.getQueryData(getUserInfoQueryKey({ headers: ver('20260205') })); + const data: { data: ServiceUserUserInfoData | undefined } | undefined = queryClient.getQueryData(getUserInfoQueryKey()); return useMutation({ ...patchUserUpdateMutation(), onSuccess: async () => { - await queryClient.invalidateQueries({ queryKey: getUserInfoQueryKey({ headers: ver('20260205') }) }); + await queryClient.invalidateQueries({ queryKey: getUserInfoQueryKey() }); if ((data?.data?.user_id) != null) { - await queryClient.invalidateQueries({ queryKey: getUserInfoByUserIdQueryKey({ path: { user_id: data.data.user_id }, headers: ver('20260205') }) }); + await queryClient.invalidateQueries({ queryKey: getUserInfoByUserIdQueryKey({ path: { user_id: data.data.user_id } }) }); } }, }); diff --git a/client/cms/src/hooks/data/useUserInfo.ts b/client/cms/src/hooks/data/useUserInfo.ts index b1b9d81..369b0ee 100644 --- a/client/cms/src/hooks/data/useUserInfo.ts +++ b/client/cms/src/hooks/data/useUserInfo.ts @@ -3,18 +3,17 @@ import { getUserInfoByUserIdOptions, getUserInfoOptions, } from '@/client/@tanstack/react-query.gen'; -import { ver } from '@/lib/apiVersion'; export function useUserInfo() { return useSuspenseQuery({ - ...getUserInfoOptions({ headers: ver('20260205') }), + ...getUserInfoOptions(), staleTime: 10 * 60 * 1000, }); } export function useOtherUserInfo(userId: string) { return useSuspenseQuery({ - ...getUserInfoByUserIdOptions({ path: { user_id: userId }, headers: ver('20260205') }), + ...getUserInfoByUserIdOptions({ path: { user_id: userId } }), staleTime: 10 * 60 * 1000, retry: (_failureCount, error) => error.code !== 403, }); diff --git a/client/cms/src/lib/token.ts b/client/cms/src/lib/token.ts index 6354075..d491945 100644 --- a/client/cms/src/lib/token.ts +++ b/client/cms/src/lib/token.ts @@ -1,7 +1,6 @@ import type { ServiceAuthTokenResponse } from '@/client'; import { toast } from 'sonner'; import { postAuthRefresh } from '@/client'; -import { ver } from './apiVersion'; import { router } from './router'; const ACCESS_TOKEN_LOCALSTORAGE_KEY = 'token'; @@ -41,7 +40,6 @@ export async function doRefreshToken(refreshToken: string): Promise { if (mutation.isIdle) { - mutation.mutate({ body: { code }, headers: ver('20260205') }); + mutation.mutate({ body: { code } }); } // eslint-disable-next-line react-hooks/exhaustive-deps }, []);