Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 16 additions & 43 deletions apps/web/src/api/endpoints.schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export type PostUsersCreate201User = {
username: string;
email: string;
createdAt?: string;
subscriptionType?: PostUsersCreate201UserSubscriptionType;
/** @nullable */
bannerUrl?: string | null;
/** @nullable */
Expand All @@ -35,6 +34,7 @@ export type PostUsersCreate201User = {
isLegacy?: boolean | null;
/** @nullable */
biography?: string | null;
subscriptionType: PostUsersCreate201UserSubscriptionType;
};

/**
Expand Down Expand Up @@ -102,7 +102,6 @@ export type GetUsersUsername200User = {
username: string;
email: string;
createdAt: string;
subscriptionType: GetUsersUsername200UserSubscriptionType;
/** @nullable */
bannerUrl: string | null;
/** @nullable */
Expand All @@ -111,56 +110,40 @@ export type GetUsersUsername200User = {
isLegacy: boolean | null;
/** @nullable */
biography: string | null;
subscriptionType: GetUsersUsername200UserSubscriptionType;
};

export type GetUsersUsername200 = {
user: GetUsersUsername200User;
};

export type GetUserById201UserSubscriptionType = typeof GetUserById201UserSubscriptionType[keyof typeof GetUserById201UserSubscriptionType];
export type GetUserById200UserSubscriptionType = typeof GetUserById200UserSubscriptionType[keyof typeof GetUserById200UserSubscriptionType];


// eslint-disable-next-line @typescript-eslint/no-redeclare
export const GetUserById201UserSubscriptionType = {
export const GetUserById200UserSubscriptionType = {
MEMBER: 'MEMBER',
PRO: 'PRO',
} as const;

export type GetUserById201User = {
id?: string;
export type GetUserById200User = {
id: string;
username: string;
email: string;
createdAt?: string;
subscriptionType?: GetUserById201UserSubscriptionType;
createdAt: string;
/** @nullable */
bannerUrl?: string | null;
bannerUrl: string | null;
/** @nullable */
avatarUrl?: string | null;
avatarUrl: string | null;
/** @nullable */
isLegacy?: boolean | null;
isLegacy: boolean | null;
/** @nullable */
biography?: string | null;
};

/**
* User created.
*/
export type GetUserById201 = {
user: GetUserById201User;
};

/**
* Email or username is already registered.
*/
export type GetUserById409 = {
message: string;
biography: string | null;
subscriptionType: GetUserById200UserSubscriptionType;
};

/**
* Fail to hash password.
*/
export type GetUserById500 = {
message: string;
export type GetUserById200 = {
user: GetUserById200User;
};

export type GetMe200UserSubscriptionType = typeof GetMe200UserSubscriptionType[keyof typeof GetMe200UserSubscriptionType];
Expand All @@ -177,7 +160,6 @@ export type GetMe200User = {
username: string;
email: string;
createdAt: string;
subscriptionType: GetMe200UserSubscriptionType;
/** @nullable */
bannerUrl: string | null;
/** @nullable */
Expand All @@ -186,6 +168,7 @@ export type GetMe200User = {
isLegacy: boolean | null;
/** @nullable */
biography: string | null;
subscriptionType: GetMe200UserSubscriptionType;
};

export type GetMe200 = {
Expand All @@ -199,21 +182,11 @@ export type PatchUserBody = {
biography?: string;
};

export type PatchUser200UserSubscriptionType = typeof PatchUser200UserSubscriptionType[keyof typeof PatchUser200UserSubscriptionType];


// eslint-disable-next-line @typescript-eslint/no-redeclare
export const PatchUser200UserSubscriptionType = {
MEMBER: 'MEMBER',
PRO: 'PRO',
} as const;

export type PatchUser200User = {
id: string;
username: string;
email: string;
createdAt: string;
subscriptionType: PatchUser200UserSubscriptionType;
/** @nullable */
bannerUrl: string | null;
/** @nullable */
Expand Down Expand Up @@ -1931,8 +1904,8 @@ export type GetFollowers200FollowersItemSubscriptionType = typeof GetFollowers20

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const GetFollowers200FollowersItemSubscriptionType = {
MEMBER: 'MEMBER',
PRO: 'PRO',
MEMBER: 'MEMBER',
} as const;

export type GetFollowers200FollowersItem = {
Expand Down
30 changes: 14 additions & 16 deletions apps/web/src/api/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ import type {
} from '@tanstack/react-query'
import type {
GetMe200,
GetUserById201,
GetUserById409,
GetUserById500,
GetUserById200,
GetUserPreferences200,
GetUsersAvailableEmail200,
GetUsersAvailableEmail409,
Expand Down Expand Up @@ -532,7 +530,7 @@ export const getUserById = (
) => {


return axiosInstance<GetUserById201>(
return axiosInstance<GetUserById200>(
{url: `/user/by/${id}`, method: 'GET', signal
},
);
Expand All @@ -544,7 +542,7 @@ export const getGetUserByIdQueryKey = (id: string,) => {
}


export const getGetUserByIdQueryOptions = <TData = Awaited<ReturnType<typeof getUserById>>, TError = GetUserById409 | GetUserById500>(id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserById>>, TError, TData>>, }
export const getGetUserByIdQueryOptions = <TData = Awaited<ReturnType<typeof getUserById>>, TError = unknown>(id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserById>>, TError, TData>>, }
) => {

const {query: queryOptions} = options ?? {};
Expand All @@ -563,10 +561,10 @@ const {query: queryOptions} = options ?? {};
}

export type GetUserByIdQueryResult = NonNullable<Awaited<ReturnType<typeof getUserById>>>
export type GetUserByIdQueryError = GetUserById409 | GetUserById500
export type GetUserByIdQueryError = unknown


export function useGetUserById<TData = Awaited<ReturnType<typeof getUserById>>, TError = GetUserById409 | GetUserById500>(
export function useGetUserById<TData = Awaited<ReturnType<typeof getUserById>>, TError = unknown>(
id: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserById>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getUserById>>,
Expand All @@ -576,7 +574,7 @@ export function useGetUserById<TData = Awaited<ReturnType<typeof getUserById>>,
>, }

): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> }
export function useGetUserById<TData = Awaited<ReturnType<typeof getUserById>>, TError = GetUserById409 | GetUserById500>(
export function useGetUserById<TData = Awaited<ReturnType<typeof getUserById>>, TError = unknown>(
id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserById>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getUserById>>,
Expand All @@ -586,12 +584,12 @@ export function useGetUserById<TData = Awaited<ReturnType<typeof getUserById>>,
>, }

): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> }
export function useGetUserById<TData = Awaited<ReturnType<typeof getUserById>>, TError = GetUserById409 | GetUserById500>(
export function useGetUserById<TData = Awaited<ReturnType<typeof getUserById>>, TError = unknown>(
id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserById>>, TError, TData>>, }

): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> }

export function useGetUserById<TData = Awaited<ReturnType<typeof getUserById>>, TError = GetUserById409 | GetUserById500>(
export function useGetUserById<TData = Awaited<ReturnType<typeof getUserById>>, TError = unknown>(
id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserById>>, TError, TData>>, }

): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> } {
Expand All @@ -607,7 +605,7 @@ export function useGetUserById<TData = Awaited<ReturnType<typeof getUserById>>,



export const getGetUserByIdSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getUserById>>, TError = GetUserById409 | GetUserById500>(id: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserById>>, TError, TData>>, }
export const getGetUserByIdSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getUserById>>, TError = unknown>(id: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserById>>, TError, TData>>, }
) => {

const {query: queryOptions} = options ?? {};
Expand All @@ -626,23 +624,23 @@ const {query: queryOptions} = options ?? {};
}

export type GetUserByIdSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getUserById>>>
export type GetUserByIdSuspenseQueryError = GetUserById409 | GetUserById500
export type GetUserByIdSuspenseQueryError = unknown


export function useGetUserByIdSuspense<TData = Awaited<ReturnType<typeof getUserById>>, TError = GetUserById409 | GetUserById500>(
export function useGetUserByIdSuspense<TData = Awaited<ReturnType<typeof getUserById>>, TError = unknown>(
id: string, options: { query:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserById>>, TError, TData>>, }

): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> }
export function useGetUserByIdSuspense<TData = Awaited<ReturnType<typeof getUserById>>, TError = GetUserById409 | GetUserById500>(
export function useGetUserByIdSuspense<TData = Awaited<ReturnType<typeof getUserById>>, TError = unknown>(
id: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserById>>, TError, TData>>, }

): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> }
export function useGetUserByIdSuspense<TData = Awaited<ReturnType<typeof getUserById>>, TError = GetUserById409 | GetUserById500>(
export function useGetUserByIdSuspense<TData = Awaited<ReturnType<typeof getUserById>>, TError = unknown>(
id: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserById>>, TError, TData>>, }

): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> }

export function useGetUserByIdSuspense<TData = Awaited<ReturnType<typeof getUserById>>, TError = GetUserById409 | GetUserById500>(
export function useGetUserByIdSuspense<TData = Awaited<ReturnType<typeof getUserById>>, TError = unknown>(
id: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserById>>, TError, TData>>, }

): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData> } {
Expand Down