A lot of changes
This commit is contained in:
Vendored
+155
-5
@@ -75,6 +75,23 @@ export interface paths {
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/albums/{id}/picture": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
get?: never;
|
||||
/** Replace an album picture with an uploaded image */
|
||||
put: operations["UpdateAlbumPicture"];
|
||||
post?: never;
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/albums/{id}/tracks": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
@@ -282,6 +299,23 @@ export interface paths {
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/playlists/{id}/picture": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
get?: never;
|
||||
/** Replace a playlist picture with an uploaded image */
|
||||
put: operations["UpdatePlayListPicture"];
|
||||
post?: never;
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/playlists/users/{userId}": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
@@ -958,20 +992,24 @@ export interface components {
|
||||
/** Format: int32 */
|
||||
expiresInSeconds: number | string;
|
||||
};
|
||||
UpdateAlbumPictureRequest: {
|
||||
/** Format: uuid */
|
||||
pictureIntentId: string;
|
||||
};
|
||||
UpdateAlbumRequest: {
|
||||
title: string;
|
||||
description: null | string;
|
||||
/** Format: int32 */
|
||||
releaseYear: null | number | string;
|
||||
};
|
||||
UpdatePlayListPictureRequest: {
|
||||
/** Format: uuid */
|
||||
pictureIntentId: null | string;
|
||||
pictureIntentId: string;
|
||||
};
|
||||
UpdatePlayListRequest: {
|
||||
name: null | string;
|
||||
name: string;
|
||||
description: null | string;
|
||||
/** Format: uuid */
|
||||
pictureIntentId: null | string;
|
||||
visibility?: null | components["schemas"]["PlayListVisibility"];
|
||||
visibility: null | components["schemas"]["PlayListVisibility"];
|
||||
};
|
||||
UserApplicationResponse: {
|
||||
id: string;
|
||||
@@ -1172,6 +1210,62 @@ export interface operations {
|
||||
};
|
||||
};
|
||||
};
|
||||
UpdateAlbumPicture: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
id: string;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody: {
|
||||
content: {
|
||||
"application/json": components["schemas"]["UpdateAlbumPictureRequest"];
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description OK */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["AlbumApplicationResponse"];
|
||||
};
|
||||
};
|
||||
/** @description Bad Request */
|
||||
400: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/problem+json": components["schemas"]["HttpValidationProblemDetails"];
|
||||
};
|
||||
};
|
||||
/** @description Unauthorized */
|
||||
401: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content?: never;
|
||||
};
|
||||
/** @description Forbidden */
|
||||
403: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content?: never;
|
||||
};
|
||||
/** @description Not Found */
|
||||
404: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content?: never;
|
||||
};
|
||||
};
|
||||
};
|
||||
DeleteAlbum: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
@@ -1761,6 +1855,62 @@ export interface operations {
|
||||
};
|
||||
};
|
||||
};
|
||||
UpdatePlayListPicture: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
id: string;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody: {
|
||||
content: {
|
||||
"application/json": components["schemas"]["UpdatePlayListPictureRequest"];
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description OK */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["PlayListApplicationResponse"];
|
||||
};
|
||||
};
|
||||
/** @description Bad Request */
|
||||
400: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/problem+json": components["schemas"]["HttpValidationProblemDetails"];
|
||||
};
|
||||
};
|
||||
/** @description Unauthorized */
|
||||
401: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content?: never;
|
||||
};
|
||||
/** @description Forbidden */
|
||||
403: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content?: never;
|
||||
};
|
||||
/** @description Not Found */
|
||||
404: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content?: never;
|
||||
};
|
||||
};
|
||||
};
|
||||
DeletePlayList: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
|
||||
@@ -71,21 +71,34 @@ export const actions: Actions = {
|
||||
const parsed = parseAlbumForm(form);
|
||||
if ('failMessage' in parsed) return fail(400, { message: parsed.failMessage });
|
||||
|
||||
const cover = await uploadOptionalCover(api, '/albums/upload-picture', formFile(form, 'cover'));
|
||||
if ('failMessage' in cover) {
|
||||
return fail(502, { message: cover.failMessage, detail: cover.detail });
|
||||
}
|
||||
|
||||
const result = await api.PUT('/albums/{id}', {
|
||||
params: { path: { id: params.id } },
|
||||
body: {
|
||||
title: parsed.body.title,
|
||||
description: parsed.body.description,
|
||||
releaseYear: parsed.body.releaseYear,
|
||||
pictureIntentId: cover.intentId
|
||||
releaseYear: parsed.body.releaseYear
|
||||
}
|
||||
});
|
||||
return failOnError(result, 'No se pudo actualizar el álbum.') ?? { edited: true };
|
||||
const failure = failOnError(result, 'No se pudo actualizar el álbum.');
|
||||
if (failure) return failure;
|
||||
|
||||
const coverFile = formFile(form, 'cover');
|
||||
if (coverFile) {
|
||||
const cover = await uploadOptionalCover(api, '/albums/upload-picture', coverFile);
|
||||
if ('failMessage' in cover) {
|
||||
return fail(502, { message: cover.failMessage, detail: cover.detail });
|
||||
}
|
||||
if (cover.intentId) {
|
||||
const pictureResult = await api.PUT('/albums/{id}/picture', {
|
||||
params: { path: { id: params.id } },
|
||||
body: { pictureIntentId: cover.intentId }
|
||||
});
|
||||
const pictureFailure = failOnError(pictureResult, 'No se pudo actualizar la portada.');
|
||||
if (pictureFailure) return pictureFailure;
|
||||
}
|
||||
}
|
||||
|
||||
return { edited: true };
|
||||
}),
|
||||
|
||||
delete: authedAction(async ({ api, params }) => {
|
||||
|
||||
@@ -52,21 +52,29 @@ export const actions: Actions = {
|
||||
if ('failMessage' in parsed) return fail(400, { message: parsed.failMessage });
|
||||
const { name, description, visibility, cover } = parsed.body;
|
||||
|
||||
const uploaded = await uploadOptionalCover(api, '/playlists/upload-picture', cover);
|
||||
if ('failMessage' in uploaded) {
|
||||
return fail(502, { message: uploaded.failMessage, detail: uploaded.detail });
|
||||
}
|
||||
|
||||
const result = await api.PUT('/playlists/{id}', {
|
||||
params: { path: { id: params.id } },
|
||||
body: {
|
||||
name,
|
||||
description,
|
||||
pictureIntentId: uploaded.intentId,
|
||||
visibility
|
||||
}
|
||||
body: { name, description, visibility }
|
||||
});
|
||||
return failOnError(result, 'No se pudo actualizar la playlist.') ?? { edited: true };
|
||||
const failure = failOnError(result, 'No se pudo actualizar la playlist.');
|
||||
if (failure) return failure;
|
||||
|
||||
if (cover) {
|
||||
const uploaded = await uploadOptionalCover(api, '/playlists/upload-picture', cover);
|
||||
if ('failMessage' in uploaded) {
|
||||
return fail(502, { message: uploaded.failMessage, detail: uploaded.detail });
|
||||
}
|
||||
if (uploaded.intentId) {
|
||||
const pictureResult = await api.PUT('/playlists/{id}/picture', {
|
||||
params: { path: { id: params.id } },
|
||||
body: { pictureIntentId: uploaded.intentId }
|
||||
});
|
||||
const pictureFailure = failOnError(pictureResult, 'No se pudo actualizar la portada.');
|
||||
if (pictureFailure) return pictureFailure;
|
||||
}
|
||||
}
|
||||
|
||||
return { edited: true };
|
||||
}),
|
||||
|
||||
delete: authedAction(async ({ api, params }) => {
|
||||
|
||||
Reference in New Issue
Block a user