[DEV] update new model

This commit is contained in:
Edouard DUPIN 2024-03-19 08:37:07 +01:00
parent cebf7d35fb
commit a1684f0fc0
11 changed files with 196 additions and 181 deletions

View File

@ -129,30 +129,30 @@ const routes: Routes = [
component: AlbumsScene,
canActivate: [OnlyUsersGuard],
},
{
path: 'album/:albumId/edit',
component: AlbumEditScene,
canActivate: [OnlyAdminGuard],
},
{
path: 'album/:albumId',
component: AlbumScene,
canActivate: [OnlyUsersGuard],
},
{
path: 'album-edit/:albumId',
component: AlbumEditScene,
canActivate: [OnlyAdminGuard],
},
// ------------------------------------
// -- Tracks:
// ------------------------------------
{
path: 'track/:trackId/edit',
component: TrackEditScene,
canActivate: [OnlyAdminGuard],
},
{
path: 'track/:genderId/:artistId/:albumId/:trackId',
component: TrackScene,
canActivate: [OnlyUsersGuard],
},
{
path: 'track-edit/:trackId',
component: TrackEditScene,
canActivate: [OnlyAdminGuard],
},
// ------------------------------------
// -- setting:

View File

@ -2,7 +2,7 @@
* API of the server (auto-generated code)
*/
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {Long, UUID, Album, isAlbum, } from "./model"
import {UUID, Long, Album, isAlbum, } from "./model"
export namespace AlbumResource {
/**
@ -18,6 +18,7 @@ export namespace AlbumResource {
restModel: {
endPoint: "/album/{id}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
@ -83,6 +84,42 @@ export namespace AlbumResource {
data,
}, isAlbum);
};
/**
* Get all the available Albums
*/
export function gets({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<Album[]> {
return RESTRequestJsonArray({
restModel: {
endPoint: "/album",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isAlbum);
};
/**
* Add a Track on a specific album
*/
export function addTrack({ restConfig, params, }: {
restConfig: RESTConfig,
params: {
trackId: Long,
id: Long,
},
}): Promise<Album> {
return RESTRequestJson({
restModel: {
endPoint: "/album/{id}/track/{trackId}",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isAlbum);
};
/**
* Remove a Track on a specific album
*/
@ -97,6 +134,7 @@ export namespace AlbumResource {
restModel: {
endPoint: "/album/{id}/track/{trackId}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
@ -142,42 +180,7 @@ export namespace AlbumResource {
restModel: {
endPoint: "/album/{id}/cover/{coverId}",
requestType: HTTPRequestModel.DELETE,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isAlbum);
};
/**
* Get all the available Albums
*/
export function gets({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<Album[]> {
return RESTRequestJsonArray({
restModel: {
endPoint: "/album",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isAlbum);
};
/**
* Add a Track on a specific album
*/
export function addTrack({ restConfig, params, }: {
restConfig: RESTConfig,
params: {
trackId: Long,
id: Long,
},
}): Promise<Album> {
return RESTRequestJson({
restModel: {
endPoint: "/album/{id}/track/{trackId}",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,

View File

@ -2,7 +2,7 @@
* API of the server (auto-generated code)
*/
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {Artist, Long, UUID, isArtist, } from "./model"
import {Artist, UUID, Long, isArtist, } from "./model"
export namespace ArtistResource {
export function remove({ restConfig, params, }: {
@ -15,6 +15,7 @@ export namespace ArtistResource {
restModel: {
endPoint: "/artist/{id}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
@ -71,6 +72,18 @@ export namespace ArtistResource {
data,
}, isArtist);
};
export function gets({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<Artist[]> {
return RESTRequestJsonArray({
restModel: {
endPoint: "/artist",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isArtist);
};
export function uploadCover({ restConfig, params, data, }: {
restConfig: RESTConfig,
params: {
@ -104,22 +117,11 @@ export namespace ArtistResource {
restModel: {
endPoint: "/artist/{id}/cover/{coverId}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isArtist);
};
export function gets({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<Artist[]> {
return RESTRequestJsonArray({
restModel: {
endPoint: "/artist",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isArtist);
};
}

View File

@ -2,7 +2,7 @@
* API of the server (auto-generated code)
*/
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {Long, Gender, UUID, isGender, } from "./model"
import {UUID, Long, Gender, isGender, } from "./model"
export namespace GenderResource {
export function remove({ restConfig, params, }: {
@ -15,6 +15,7 @@ export namespace GenderResource {
restModel: {
endPoint: "/gender/{id}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
@ -71,6 +72,18 @@ export namespace GenderResource {
data,
}, isGender);
};
export function gets({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<Gender[]> {
return RESTRequestJsonArray({
restModel: {
endPoint: "/gender",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isGender);
};
export function uploadCover({ restConfig, params, data, }: {
restConfig: RESTConfig,
params: {
@ -104,22 +117,11 @@ export namespace GenderResource {
restModel: {
endPoint: "/gender/{id}/cover/{coverId}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isGender);
};
export function gets({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<Gender[]> {
return RESTRequestJsonArray({
restModel: {
endPoint: "/gender",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isGender);
};
}

View File

@ -2,7 +2,7 @@
* API of the server (auto-generated code)
*/
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {Long, UUID, Playlist, isPlaylist, } from "./model"
import {UUID, Long, Playlist, isPlaylist, } from "./model"
export namespace PlaylistResource {
export function remove({ restConfig, params, }: {
@ -15,6 +15,7 @@ export namespace PlaylistResource {
restModel: {
endPoint: "/playlist/{id}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
@ -71,6 +72,36 @@ export namespace PlaylistResource {
data,
}, isPlaylist);
};
export function gets({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<Playlist[]> {
return RESTRequestJsonArray({
restModel: {
endPoint: "/playlist",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isPlaylist);
};
export function addTrack({ restConfig, params, }: {
restConfig: RESTConfig,
params: {
trackId: Long,
id: Long,
},
}): Promise<Playlist> {
return RESTRequestJson({
restModel: {
endPoint: "/playlist/{id}/track/{trackId}",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isPlaylist);
};
export function removeTrack({ restConfig, params, }: {
restConfig: RESTConfig,
params: {
@ -82,6 +113,7 @@ export namespace PlaylistResource {
restModel: {
endPoint: "/playlist/{id}/track/{trackId}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
@ -121,36 +153,7 @@ export namespace PlaylistResource {
restModel: {
endPoint: "/playlist/{id}/cover/{coverId}",
requestType: HTTPRequestModel.DELETE,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isPlaylist);
};
export function gets({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<Playlist[]> {
return RESTRequestJsonArray({
restModel: {
endPoint: "/playlist",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isPlaylist);
};
export function addTrack({ restConfig, params, }: {
restConfig: RESTConfig,
params: {
trackId: Long,
id: Long,
},
}): Promise<Playlist> {
return RESTRequestJson({
restModel: {
endPoint: "/playlist/{id}/track/{trackId}",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,

View File

@ -15,13 +15,14 @@ export enum HTTPRequestModel {
}
export enum HTTPMimeType {
ALL = '*/*',
CSV = 'text/csv',
IMAGE = 'image/*',
IMAGE_JPEG = 'image/jpeg',
IMAGE_PNG = 'image/png',
JSON = 'application/json',
OCTET_STREAM = 'application/octet-stream',
MULTIPART = 'multipart/form-data',
CSV = 'text/csv',
OCTET_STREAM = 'application/octet-stream',
TEXT_PLAIN = 'text/plain',
}
export interface RESTConfig {

View File

@ -2,7 +2,7 @@
* API of the server (auto-generated code)
*/
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {Long, Track, UUID, isTrack, } from "./model"
import {UUID, Long, Track, isTrack, } from "./model"
export namespace TrackResource {
export function remove({ restConfig, params, }: {
@ -15,6 +15,7 @@ export namespace TrackResource {
restModel: {
endPoint: "/track/{id}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
@ -71,62 +72,6 @@ export namespace TrackResource {
data,
}, isTrack);
};
export function removeTrack({ restConfig, params, }: {
restConfig: RESTConfig,
params: {
artistId: Long,
id: Long,
},
}): Promise<Track> {
return RESTRequestJson({
restModel: {
endPoint: "/track/{id}/artist/{trackId}",
requestType: HTTPRequestModel.DELETE,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isTrack);
};
export function uploadCover({ restConfig, params, data, }: {
restConfig: RESTConfig,
params: {
id: Long,
},
data: {
fileName: string,
file: File,
},
}): Promise<Track> {
return RESTRequestJson({
restModel: {
endPoint: "/track/{id}/cover",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
data,
}, isTrack);
};
export function removeCover({ restConfig, params, }: {
restConfig: RESTConfig,
params: {
coverId: UUID,
id: Long,
},
}): Promise<Track> {
return RESTRequestJson({
restModel: {
endPoint: "/track/{id}/cover/{coverId}",
requestType: HTTPRequestModel.DELETE,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isTrack);
};
export function uploadTrack({ restConfig, data, }: {
restConfig: RESTConfig,
data: {
@ -180,4 +125,62 @@ export namespace TrackResource {
params,
}, isTrack);
};
export function removeTrack({ restConfig, params, }: {
restConfig: RESTConfig,
params: {
artistId: Long,
id: Long,
},
}): Promise<Track> {
return RESTRequestJson({
restModel: {
endPoint: "/track/{id}/artist/{trackId}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isTrack);
};
export function uploadCover({ restConfig, params, data, }: {
restConfig: RESTConfig,
params: {
id: Long,
},
data: {
fileName: string,
file: File,
},
}): Promise<Track> {
return RESTRequestJson({
restModel: {
endPoint: "/track/{id}/cover",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
data,
}, isTrack);
};
export function removeCover({ restConfig, params, }: {
restConfig: RESTConfig,
params: {
coverId: UUID,
id: Long,
},
}): Promise<Track> {
return RESTRequestJson({
restModel: {
endPoint: "/track/{id}/cover/{coverId}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
},
restConfig,
params,
}, isTrack);
};
}

View File

@ -22,19 +22,6 @@ export namespace UserResource {
params,
}, isUserKarusic);
};
export function getMe({ restConfig, produce, }: {
restConfig: RESTConfig,
produce: HTTPMimeType.JSON,
}): Promise<UserOut> {
return RESTRequestJson({
restModel: {
endPoint: "/users/me",
requestType: HTTPRequestModel.GET,
accept: produce,
},
restConfig,
}, isUserOut);
};
export function gets({ restConfig, produce, }: {
restConfig: RESTConfig,
produce: HTTPMimeType.JSON,
@ -48,4 +35,17 @@ export namespace UserResource {
restConfig,
}, isUserKarusic);
};
export function getMe({ restConfig, produce, }: {
restConfig: RESTConfig,
produce: HTTPMimeType.JSON,
}): Promise<UserOut> {
return RESTRequestJson({
restModel: {
endPoint: "/users/me",
requestType: HTTPRequestModel.GET,
accept: produce,
},
restConfig,
}, isUserOut);
};
}

View File

@ -43,6 +43,7 @@ export class ElementSeasonComponent implements OnInit {
this.prefix = this.prefixName ?? "";
this.count = undefined;
this.count2 = undefined;
console.log(`element: ${JSON.stringify(this.element, null, 2)}`);
if (isNullOrUndefined(this.element)) {
this.numberAlbum = undefined;
@ -51,7 +52,9 @@ export class ElementSeasonComponent implements OnInit {
}
this.numberAlbum = this.element.name;
this.description = this.element.description;
console.log(`covers: ${this.element.covers}`);
this.covers = this.dataService.getListThumbnailUrl(this.element.covers);
console.log(`covers >> : ${this.covers}`);
let self = this;
if (!isNullOrUndefined(this.countSubTypeCallBack)) {
this.countSubTypeCallBack(this.element.id)

View File

@ -45,8 +45,7 @@ export class GenericDataService<TYPE> {
key: 'id',
value: ids,
},
],
['name', 'id']);
]);
resolve(data);
return;
}).catch((response) => {
@ -85,8 +84,7 @@ export class GenericDataService<TYPE> {
key: 'id',
value: [undefined, null],
},
],
['name', 'id']);
]);
resolve(data);
}).catch((response) => {
console.log(`[E] ${self.constructor.name}: can not retrieve BDD values`);

@ -1 +1 @@
Subproject commit ae86abe8ca367b91d36c48683fda8cfd82f3ec48
Subproject commit 0fd7c540ea5cdce19533338b3125e88d4ef442ef