feat: reworked user and login page
This commit is contained in:
parent
87eb6a6b12
commit
354c577f7d
6 changed files with 323 additions and 21 deletions
|
|
@ -20,7 +20,7 @@ export class DefaultService {
|
|||
* @param sort
|
||||
* @param sortForward
|
||||
* @param word
|
||||
* @param status
|
||||
* @param status List of title statuses to filter
|
||||
* @param rating
|
||||
* @param releaseYear
|
||||
* @param releaseSeason
|
||||
|
|
@ -35,7 +35,7 @@ export class DefaultService {
|
|||
sort?: TitleSort,
|
||||
sortForward: boolean = true,
|
||||
word?: string,
|
||||
status?: TitleStatus,
|
||||
status?: Array<TitleStatus>,
|
||||
rating?: number,
|
||||
releaseYear?: number,
|
||||
releaseSeason?: ReleaseSeason,
|
||||
|
|
@ -125,45 +125,112 @@ export class DefaultService {
|
|||
},
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Partially update a user account
|
||||
* Update selected user profile fields (excluding password).
|
||||
* Password updates must be done via the dedicated auth-service (`/auth/`).
|
||||
* Fields not provided in the request body remain unchanged.
|
||||
*
|
||||
* @param userId User ID (primary key)
|
||||
* @param requestBody
|
||||
* @returns User User updated successfully. Returns updated user representation (excluding sensitive fields).
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static updateUser(
|
||||
userId: number,
|
||||
requestBody: {
|
||||
/**
|
||||
* ID of the user avatar (references `images.id`); set to `null` to remove avatar
|
||||
*/
|
||||
avatar_id?: number | null;
|
||||
/**
|
||||
* User email (must be unique and valid)
|
||||
*/
|
||||
mail?: string;
|
||||
/**
|
||||
* Username (alphanumeric + `_` or `-`, 3–16 chars)
|
||||
*/
|
||||
nickname?: string;
|
||||
/**
|
||||
* Display name
|
||||
*/
|
||||
disp_name?: string;
|
||||
/**
|
||||
* User description / bio
|
||||
*/
|
||||
user_desc?: string;
|
||||
},
|
||||
): CancelablePromise<User> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PATCH',
|
||||
url: '/users/{user_id}',
|
||||
path: {
|
||||
'user_id': userId,
|
||||
},
|
||||
body: requestBody,
|
||||
mediaType: 'application/json',
|
||||
errors: {
|
||||
400: `Invalid input (e.g., validation failed, nickname/email conflict, malformed JSON)`,
|
||||
401: `Unauthorized — missing or invalid authentication token`,
|
||||
403: `Forbidden — user is not allowed to modify this resource (e.g., not own profile & no admin rights)`,
|
||||
404: `User not found`,
|
||||
409: `Conflict — e.g., requested \`nickname\` or \`mail\` already taken by another user`,
|
||||
422: `Unprocessable Entity — semantic errors not caught by schema (e.g., invalid \`avatar_id\`)`,
|
||||
500: `Unknown server error`,
|
||||
},
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Get user titles
|
||||
* @param userId
|
||||
* @param cursor
|
||||
* @param sort
|
||||
* @param sortForward
|
||||
* @param word
|
||||
* @param status
|
||||
* @param status List of title statuses to filter
|
||||
* @param watchStatus
|
||||
* @param rating
|
||||
* @param myRate
|
||||
* @param releaseYear
|
||||
* @param releaseSeason
|
||||
* @param limit
|
||||
* @param fields
|
||||
* @returns UserTitle List of user titles
|
||||
* @returns any List of user titles
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getUsersTitles(
|
||||
userId: string,
|
||||
cursor?: string,
|
||||
sort?: TitleSort,
|
||||
sortForward: boolean = true,
|
||||
word?: string,
|
||||
status?: TitleStatus,
|
||||
watchStatus?: UserTitleStatus,
|
||||
status?: Array<TitleStatus>,
|
||||
watchStatus?: Array<UserTitleStatus>,
|
||||
rating?: number,
|
||||
myRate?: number,
|
||||
releaseYear?: number,
|
||||
releaseSeason?: ReleaseSeason,
|
||||
limit: number = 10,
|
||||
fields: string = 'all',
|
||||
): CancelablePromise<Array<UserTitle>> {
|
||||
): CancelablePromise<{
|
||||
data: Array<UserTitle>;
|
||||
cursor: CursorObj;
|
||||
}> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/users/{user_id}/titles/',
|
||||
url: '/users/{user_id}/titles',
|
||||
path: {
|
||||
'user_id': userId,
|
||||
},
|
||||
query: {
|
||||
'cursor': cursor,
|
||||
'sort': sort,
|
||||
'sort_forward': sortForward,
|
||||
'word': word,
|
||||
'status': status,
|
||||
'watch_status': watchStatus,
|
||||
'rating': rating,
|
||||
'my_rate': myRate,
|
||||
'release_year': releaseYear,
|
||||
'release_season': releaseSeason,
|
||||
'limit': limit,
|
||||
|
|
@ -175,4 +242,43 @@ export class DefaultService {
|
|||
},
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Add a title to a user
|
||||
* User adding title to list af watched, status required
|
||||
* @param userId ID of the user to assign the title to
|
||||
* @param requestBody
|
||||
* @returns any Title successfully added to user
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static addUserTitle(
|
||||
userId: number,
|
||||
requestBody: UserTitle,
|
||||
): CancelablePromise<{
|
||||
data?: {
|
||||
user_id: number;
|
||||
title_id: number;
|
||||
status: UserTitleStatus;
|
||||
rate?: number;
|
||||
review_id?: number;
|
||||
ctime?: string;
|
||||
};
|
||||
}> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'POST',
|
||||
url: '/users/{user_id}/titles',
|
||||
path: {
|
||||
'user_id': userId,
|
||||
},
|
||||
body: requestBody,
|
||||
mediaType: 'application/json',
|
||||
errors: {
|
||||
400: `Invalid request body (missing fields, invalid types, etc.)`,
|
||||
401: `Unauthorized — missing or invalid auth token`,
|
||||
403: `Forbidden — user not allowed to assign titles to this user`,
|
||||
404: `User or Title not found`,
|
||||
409: `Conflict — title already assigned to user (if applicable)`,
|
||||
500: `Internal server error`,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue