Add ability to view personal notes and update note schemas
Adds a new endpoint for listing user-specific notes and refines OpenAPI schemas for better data structure definition. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 77cfe984-2c65-4152-bb7a-0df28274fe66 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 3565b59b-6890-4cf5-90a7-0c8041e15041 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/c3c252e4-c83d-40ca-9fff-99a3ea60701e/77cfe984-2c65-4152-bb7a-0df28274fe66/G3ZvHke Replit-Helium-Checkpoint-Created: true
This commit is contained in:
@@ -1075,7 +1075,6 @@ export interface NoteRecipientSummary {
|
||||
id: number;
|
||||
noteId?: number;
|
||||
recipientUserId: number;
|
||||
senderUserId: number;
|
||||
status: NoteRecipientStatus;
|
||||
sentAt: string;
|
||||
/** @nullable */
|
||||
@@ -1701,6 +1700,12 @@ export type GetAdminServiceDependentOrdersParams = {
|
||||
offset?: number;
|
||||
};
|
||||
|
||||
export type ListMyNotesAliasParams = {
|
||||
archived?: boolean;
|
||||
};
|
||||
|
||||
export type ListMyNotesAlias200Item = { [key: string]: unknown };
|
||||
|
||||
export type ListReceivedNotesParams = {
|
||||
archived?: boolean;
|
||||
};
|
||||
|
||||
@@ -78,6 +78,8 @@ import type {
|
||||
LeaveConversationBody,
|
||||
ListAuditLogsParams,
|
||||
ListGroupsParams,
|
||||
ListMyNotesAlias200Item,
|
||||
ListMyNotesAliasParams,
|
||||
ListReceivedNotesParams,
|
||||
ListUsersParams,
|
||||
LoginBody,
|
||||
@@ -8261,6 +8263,106 @@ export function useGetAdminServiceDependentOrders<
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Alias of GET /notes — list the caller's own notes
|
||||
*/
|
||||
export const getListMyNotesAliasUrl = (params?: ListMyNotesAliasParams) => {
|
||||
const normalizedParams = new URLSearchParams();
|
||||
|
||||
Object.entries(params || {}).forEach(([key, value]) => {
|
||||
if (value !== undefined) {
|
||||
normalizedParams.append(key, value === null ? "null" : value.toString());
|
||||
}
|
||||
});
|
||||
|
||||
const stringifiedParams = normalizedParams.toString();
|
||||
|
||||
return stringifiedParams.length > 0
|
||||
? `/api/notes/my?${stringifiedParams}`
|
||||
: `/api/notes/my`;
|
||||
};
|
||||
|
||||
export const listMyNotesAlias = async (
|
||||
params?: ListMyNotesAliasParams,
|
||||
options?: RequestInit,
|
||||
): Promise<ListMyNotesAlias200Item[]> => {
|
||||
return customFetch<ListMyNotesAlias200Item[]>(
|
||||
getListMyNotesAliasUrl(params),
|
||||
{
|
||||
...options,
|
||||
method: "GET",
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getListMyNotesAliasQueryKey = (
|
||||
params?: ListMyNotesAliasParams,
|
||||
) => {
|
||||
return [`/api/notes/my`, ...(params ? [params] : [])] as const;
|
||||
};
|
||||
|
||||
export const getListMyNotesAliasQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof listMyNotesAlias>>,
|
||||
TError = ErrorType<unknown>,
|
||||
>(
|
||||
params?: ListMyNotesAliasParams,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listMyNotesAlias>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ?? getListMyNotesAliasQueryKey(params);
|
||||
|
||||
const queryFn: QueryFunction<
|
||||
Awaited<ReturnType<typeof listMyNotesAlias>>
|
||||
> = ({ signal }) => listMyNotesAlias(params, { signal, ...requestOptions });
|
||||
|
||||
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listMyNotesAlias>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: QueryKey };
|
||||
};
|
||||
|
||||
export type ListMyNotesAliasQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof listMyNotesAlias>>
|
||||
>;
|
||||
export type ListMyNotesAliasQueryError = ErrorType<unknown>;
|
||||
|
||||
/**
|
||||
* @summary Alias of GET /notes — list the caller's own notes
|
||||
*/
|
||||
|
||||
export function useListMyNotesAlias<
|
||||
TData = Awaited<ReturnType<typeof listMyNotesAlias>>,
|
||||
TError = ErrorType<unknown>,
|
||||
>(
|
||||
params?: ListMyNotesAliasParams,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listMyNotesAlias>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||
const queryOptions = getListMyNotesAliasQueryOptions(params, options);
|
||||
|
||||
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary List notes the caller has sent
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user