some ai generated code from claude that does not work
This commit is contained in:
@@ -541,6 +541,83 @@ export async function validateReadUser(
|
||||
}
|
||||
|
||||
|
||||
export type UpdateProfileInput = {
|
||||
username?: string | null;
|
||||
displayName?: string | null;
|
||||
};
|
||||
|
||||
export type UpdateProfileFields = UnifiedFieldSelection<usersResourceSchema>[];
|
||||
|
||||
export type InferUpdateProfileResult<
|
||||
Fields extends UpdateProfileFields | undefined,
|
||||
> = InferResult<usersResourceSchema, Fields>;
|
||||
|
||||
export type UpdateProfileResult<Fields extends UpdateProfileFields | undefined = undefined> = | { success: true; data: InferUpdateProfileResult<Fields>; }
|
||||
| { success: false; errors: AshRpcError[]; }
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* Update an existing User
|
||||
*
|
||||
* @ashActionType :update
|
||||
*/
|
||||
export async function updateProfile<Fields extends UpdateProfileFields | undefined = undefined>(
|
||||
config: {
|
||||
tenant?: string;
|
||||
identity: UUID;
|
||||
input?: UpdateProfileInput;
|
||||
fields?: Fields;
|
||||
headers?: Record<string, string>;
|
||||
fetchOptions?: RequestInit;
|
||||
customFetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
||||
}
|
||||
): Promise<UpdateProfileResult<Fields extends undefined ? [] : Fields>> {
|
||||
const payload = {
|
||||
action: "update_profile",
|
||||
...(config.tenant !== undefined && { tenant: config.tenant }),
|
||||
identity: config.identity,
|
||||
input: config.input,
|
||||
...(config.fields !== undefined && { fields: config.fields })
|
||||
};
|
||||
|
||||
return executeActionRpcRequest<UpdateProfileResult<Fields extends undefined ? [] : Fields>>(
|
||||
payload,
|
||||
config
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate: Update an existing User
|
||||
*
|
||||
* @ashActionType :update
|
||||
* @validation true
|
||||
*/
|
||||
export async function validateUpdateProfile(
|
||||
config: {
|
||||
tenant?: string;
|
||||
identity: UUID | string;
|
||||
input?: UpdateProfileInput;
|
||||
headers?: Record<string, string>;
|
||||
fetchOptions?: RequestInit;
|
||||
customFetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
||||
}
|
||||
): Promise<ValidationResult> {
|
||||
const payload = {
|
||||
action: "update_profile",
|
||||
...(config.tenant !== undefined && { tenant: config.tenant }),
|
||||
identity: config.identity,
|
||||
input: config.input
|
||||
};
|
||||
|
||||
return executeValidationRpcRequest<ValidationResult>(
|
||||
payload,
|
||||
config
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
export type ReadMediaFields = UnifiedFieldSelection<mediaResourceSchema>[];
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user