♻️ Refactor update endpoints and regenerate client for new-frontend (#602)

This commit is contained in:
Alejandra
2024-02-21 15:55:19 -05:00
committed by GitHub
parent fe95750e3a
commit 176b6fb1c9
8 changed files with 132 additions and 56 deletions

View File

@@ -15,6 +15,7 @@ export type { ItemUpdate } from './models/ItemUpdate';
export type { Message } from './models/Message';
export type { NewPassword } from './models/NewPassword';
export type { Token } from './models/Token';
export type { UpdatePassword } from './models/UpdatePassword';
export type { UserCreate } from './models/UserCreate';
export type { UserCreateOpen } from './models/UserCreateOpen';
export type { UserOut } from './models/UserOut';
@@ -30,6 +31,7 @@ export { $ItemUpdate } from './schemas/$ItemUpdate';
export { $Message } from './schemas/$Message';
export { $NewPassword } from './schemas/$NewPassword';
export { $Token } from './schemas/$Token';
export { $UpdatePassword } from './schemas/$UpdatePassword';
export { $UserCreate } from './schemas/$UserCreate';
export { $UserCreateOpen } from './schemas/$UserCreateOpen';
export { $UserOut } from './schemas/$UserOut';

View File

@@ -0,0 +1,9 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type UpdatePassword = {
current_password: string;
new_password: string;
};

View File

@@ -4,7 +4,6 @@
/* eslint-disable */
export type UserUpdateMe = {
password?: string;
full_name?: string;
email?: string;
};

View File

@@ -0,0 +1,16 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $UpdatePassword = {
properties: {
current_password: {
type: 'string',
isRequired: true,
},
new_password: {
type: 'string',
isRequired: true,
},
},
} as const;

View File

@@ -4,9 +4,6 @@
/* eslint-disable */
export const $UserUpdateMe = {
properties: {
password: {
type: 'string',
},
full_name: {
type: 'string',
},

View File

@@ -3,6 +3,7 @@
/* tslint:disable */
/* eslint-disable */
import type { Message } from '../models/Message';
import type { UpdatePassword } from '../models/UpdatePassword';
import type { UserCreate } from '../models/UserCreate';
import type { UserCreateOpen } from '../models/UserCreateOpen';
import type { UserOut } from '../models/UserOut';
@@ -88,7 +89,7 @@ requestBody,
requestBody: UserUpdateMe,
}): CancelablePromise<UserOut> {
return __request(OpenAPI, {
method: 'PUT',
method: 'PATCH',
url: '/api/v1/users/me',
body: requestBody,
mediaType: 'application/json',
@@ -98,6 +99,28 @@ requestBody: UserUpdateMe,
});
}
/**
* Update Password Me
* Update own password.
* @returns Message Successful Response
* @throws ApiError
*/
public static updatePasswordMe({
requestBody,
}: {
requestBody: UpdatePassword,
}): CancelablePromise<Message> {
return __request(OpenAPI, {
method: 'PATCH',
url: '/api/v1/users/me/password',
body: requestBody,
mediaType: 'application/json',
errors: {
422: `Validation Error`,
},
});
}
/**
* Create User Open
* Create new user without the need to be logged in.
@@ -143,33 +166,6 @@ userId: number,
});
}
/**
* Update User
* Update a user.
* @returns UserOut Successful Response
* @throws ApiError
*/
public static updateUser({
userId,
requestBody,
}: {
userId: number,
requestBody: UserUpdate,
}): CancelablePromise<UserOut> {
return __request(OpenAPI, {
method: 'PUT',
url: '/api/v1/users/{user_id}',
path: {
'user_id': userId,
},
body: requestBody,
mediaType: 'application/json',
errors: {
422: `Validation Error`,
},
});
}
/**
* Delete User
* Delete a user.
@@ -193,4 +189,31 @@ userId: number,
});
}
/**
* Update User
* Update a user.
* @returns UserOut Successful Response
* @throws ApiError
*/
public static updateUser({
userId,
requestBody,
}: {
userId: number,
requestBody: UserUpdate,
}): CancelablePromise<UserOut> {
return __request(OpenAPI, {
method: 'PATCH',
url: '/api/v1/users/{user_id}',
path: {
'user_id': userId,
},
body: requestBody,
mediaType: 'application/json',
errors: {
422: `Validation Error`,
},
});
}
}