Updates
This commit is contained in:
@@ -1462,3 +1462,46 @@ export type ApiGetQueryObject<
|
||||
table: string;
|
||||
dbFullName?: string;
|
||||
};
|
||||
|
||||
export const DataCrudRequestMethods = ["GET", "POST", "PUT", "DELETE"] as const;
|
||||
|
||||
export type DsqlMethodCrudParam<
|
||||
T extends { [key: string]: any } = { [key: string]: any }
|
||||
> = {
|
||||
method: (typeof DataCrudRequestMethods)[number];
|
||||
body?: T;
|
||||
query?: string | T;
|
||||
tableName: string;
|
||||
addUser?: {
|
||||
field: string;
|
||||
};
|
||||
user?: DATASQUIREL_LoggedInUser;
|
||||
extraData?: T;
|
||||
transform?: ({
|
||||
data,
|
||||
existingData,
|
||||
user,
|
||||
}: {
|
||||
user?: DATASQUIREL_LoggedInUser;
|
||||
data: T;
|
||||
existingData?: T;
|
||||
reqMethod: (typeof DataCrudRequestMethods)[number];
|
||||
}) => Promise<T>;
|
||||
existingData?: T;
|
||||
};
|
||||
|
||||
export const DsqlCrudActions = ["insert", "update", "delete", "get"] as const;
|
||||
|
||||
export type DsqlCrudQueryObject<T extends object = { [key: string]: any }> =
|
||||
ServerQueryParam & {
|
||||
query: ServerQueryQueryObject<T>;
|
||||
};
|
||||
|
||||
export type DsqlCrudParam<T extends object = { [key: string]: any }> = {
|
||||
action: (typeof DsqlCrudActions)[number];
|
||||
table: string;
|
||||
data?: T;
|
||||
targetId?: string | number;
|
||||
query?: DsqlCrudQueryObject<T>;
|
||||
sanitize?: (data?: T) => T;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user