[DEV] continue integration

This commit is contained in:
Edouard DUPIN 2024-04-15 00:58:42 +02:00
parent e4831e1a17
commit 334d68ac1f
29 changed files with 363 additions and 251 deletions

View File

@ -69,21 +69,21 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "karideo:build"
"buildTarget": "karideo:build"
},
"configurations": {
"production": {
"browserTarget": "karideo:build:production"
"buildTarget": "karideo:build:production"
},
"develop": {
"browserTarget": "karideo:build:develop"
"buildTarget": "karideo:build:develop"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "karideo:build"
"buildTarget": "karideo:build"
}
},
"test": {

View File

@ -6,6 +6,7 @@
"all": "npm run build && npm run test",
"ng": "ng",
"dev": "ng serve --configuration=develop --watch --port 4202",
"dev-hot-update": "ng serve --configuration=develop --watch --hmr --port 4202",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",

View File

@ -53,7 +53,7 @@ export class AppComponent implements OnInit {
this.updateMainMenu();
let self = this;
this.sessionService.change.subscribe((isConnected) => {
console.log(`receive event from session ...${isConnected}`);
self.isConnected = isConnected;
self.autoConnectedDone = true;
self.updateMainMenu();
@ -68,13 +68,10 @@ export class AppComponent implements OnInit {
});
this.userService.checkAutoConnect().then(() => {
console.log(` ==>>>>> Auto-connect THEN !!!`);
self.autoConnectedDone = true;
}).catch(() => {
console.log(` ==>>>>> Auto-connect CATCH !!!`);
self.autoConnectedDone = true;
}).finally(() => {
console.log(` ==>>>>> Auto-connect FINALLY !!!`);
self.autoConnectedDone = true;
});
this.arianeService.segmentChange.subscribe((_segmentName: string) => {
@ -123,7 +120,6 @@ export class AppComponent implements OnInit {
}
updateMainMenu(): void {
console.log("update main menu :");
if (this.isConnected) {
this.currentMenu = [
{
@ -230,11 +226,9 @@ export class AppComponent implements OnInit {
},
];
}
console.log(" ==> DONE");
}
getSegmentDisplayable(): string {
let segment = this.arianeService.getCurrrentSegment();
let segment = this.arianeService.getCurrentSegment();
if (segment === "type") {
return "Type";
}

View File

@ -5,7 +5,7 @@
*/
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { HttpClientModule } from '@angular/common/http';
import { AppRoutingModule } from './app-routing.module';
@ -20,7 +20,7 @@ import { PopInCreateType } from './popin/create-type/create-type';
import { AppComponent } from './app.component';
import {
HomeScene, HelpScene, TypeScene, SeriesScene, SeasonScene, VideoScene, SettingsScene,
VideoEditScene, SeasonEditScene, SeriesEditScene
VideoEditScene, SeasonEditScene, SeriesEditScene,
} from './scene';
import {
DataService,
@ -35,6 +35,9 @@ import { UploadScene } from './scene/upload/upload';
import { KarCWModule } from '@kangaroo-and-rabbit/kar-cw';
import { environment } from 'environments/environment';
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { CommonModule } from '@angular/common';
@NgModule({
declarations: [
ElementTypeComponent,
@ -58,6 +61,10 @@ import { environment } from 'environments/environment';
UploadScene
],
imports: [
FormsModule,
ReactiveFormsModule,
CommonModule,
BrowserModule,
RouterModule,
AppRoutingModule,
@ -80,10 +87,11 @@ import { environment } from 'environments/environment';
ElementSeriesComponent,
ElementSeasonComponent,
ElementVideoComponent,
PopInCreateType
PopInCreateType,
],
bootstrap: [
AppComponent
]
],
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
})
export class AppModule { }

View File

@ -1,7 +1,7 @@
/**
* API of the server (auto-generated code)
*/
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, ProgressCallback, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {UUID, } from "./model"
export namespace DataResource {
@ -25,6 +25,31 @@ export namespace DataResource {
data,
});
};
/**
* Get back some data from the data environment
*/
// TODO: unmanaged "Response" type: please specify @AsyncType or considered as 'void'.
export function retrieveDataId({ restConfig, queries, params, data, }: {
restConfig: RESTConfig,
queries: {
Authorization: string,
},
params: {
id: UUID,
},
data: string,
}): Promise<void> {
return RESTRequestVoid({
restModel: {
endPoint: "/data/{id}",
requestType: HTTPRequestModel.GET,
},
restConfig,
params,
queries,
data,
});
};
/**
* Get a thumbnail of from the data environment (if resize is possible)
*/
@ -76,29 +101,4 @@ export namespace DataResource {
data,
});
};
/**
* Get back some data from the data environment
*/
// TODO: unmanaged "Response" type: please specify @AsyncType or considered as 'void'.
export function retrieveDataId({ restConfig, queries, params, data, }: {
restConfig: RESTConfig,
queries: {
Authorization: string,
},
params: {
id: UUID,
},
data: string,
}): Promise<void> {
return RESTRequestVoid({
restModel: {
endPoint: "/data/{id}",
requestType: HTTPRequestModel.GET,
},
restConfig,
params,
queries,
data,
});
};
}

View File

@ -1,7 +1,7 @@
/**
* API of the server (auto-generated code)
*/
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, ProgressCallback, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {} from "./model"
export namespace Front {

View File

@ -1,7 +1,7 @@
/**
* API of the server (auto-generated code)
*/
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, ProgressCallback, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {HealthResult, isHealthResult, } from "./model"
export namespace HealthCheck {

View File

@ -1,8 +1,8 @@
/**
* API of the server (auto-generated code)
*/
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {Long, Media, UUID, isMedia, } from "./model"
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, ProgressCallback, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {UUID, Long, Media, isMedia, } from "./model"
export namespace MediaResource {
/**
@ -16,7 +16,7 @@ export namespace MediaResource {
}): Promise<void> {
return RESTRequestVoid({
restModel: {
endPoint: "/video/{id}",
endPoint: "/media/{id}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
@ -36,7 +36,7 @@ export namespace MediaResource {
}): Promise<Media> {
return RESTRequestJson({
restModel: {
endPoint: "/video/{id}",
endPoint: "/media/{id}",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
@ -56,7 +56,7 @@ export namespace MediaResource {
}): Promise<Media> {
return RESTRequestJson({
restModel: {
endPoint: "/video/{id}",
endPoint: "/media/{id}",
requestType: HTTPRequestModel.PATCH,
contentType: HTTPMimeType.JSON,
accept: HTTPMimeType.JSON,
@ -66,37 +66,10 @@ export namespace MediaResource {
data,
}, isMedia);
};
/**
* Create a new Media
*/
export function uploadFile({ restConfig, data, }: {
restConfig: RESTConfig,
data: {
fileName: string,
file: File,
series: string,
universe: string,
season: string,
episode: string,
typeId: string,
title: string,
},
}): Promise<Media> {
return RESTRequestJson({
restModel: {
endPoint: "/video",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
accept: HTTPMimeType.JSON,
},
restConfig,
data,
}, isMedia);
};
/**
* Upload a new season cover media
*/
export function uploadCover({ restConfig, params, data, }: {
export function uploadCover({ restConfig, params, data, progress, }: {
restConfig: RESTConfig,
params: {
id: Long,
@ -105,10 +78,11 @@ export namespace MediaResource {
fileName: string,
file: File,
},
progress?: ProgressCallback,
}): Promise<Media> {
return RESTRequestJson({
restModel: {
endPoint: "/video/{id}/cover",
endPoint: "/media/{id}/cover",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
accept: HTTPMimeType.JSON,
@ -116,6 +90,22 @@ export namespace MediaResource {
restConfig,
params,
data,
progress,
}, isMedia);
};
/**
* Get all Media
*/
export function gets({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<Media[]> {
return RESTRequestJsonArray({
restModel: {
endPoint: "/media",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isMedia);
};
/**
@ -130,7 +120,7 @@ export namespace MediaResource {
}): Promise<Media> {
return RESTRequestJson({
restModel: {
endPoint: "/video/{id}/cover/{coverId}",
endPoint: "/media/{id}/cover/{coverId}",
requestType: HTTPRequestModel.DELETE,
contentType: HTTPMimeType.TEXT_PLAIN,
accept: HTTPMimeType.JSON,
@ -140,18 +130,32 @@ export namespace MediaResource {
}, isMedia);
};
/**
* Get all Media
* Create a new Media
*/
export function gets({ restConfig, }: {
export function uploadFile({ restConfig, data, progress, }: {
restConfig: RESTConfig,
}): Promise<Media[]> {
return RESTRequestJsonArray({
data: {
fileName: string,
file: File,
series: string,
universe: string,
season: string,
episode: string,
typeId: string,
title: string,
},
progress?: ProgressCallback,
}): Promise<Media> {
return RESTRequestJson({
restModel: {
endPoint: "/video",
requestType: HTTPRequestModel.GET,
endPoint: "/media",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
accept: HTTPMimeType.JSON,
},
restConfig,
data,
progress,
}, isMedia);
};
}

View File

@ -270,15 +270,15 @@ export function isType(data: any): data is Type {
export const ZodUserMediaAdvancement = ZodGenericDataSoftDelete.extend({
// Foreign Key Id of the user
userId: ZodLong,
userId: ZodLong.optional(),
// Id of the media
mediaId: ZodLong,
mediaId: ZodLong.optional(),
// Percent of advancement in the media
percent: ZodFloat,
percent: ZodFloat.optional(),
// Number of second of advancement in the media
time: ZodInteger,
time: ZodInteger.optional(),
// Number of time this media has been read
count: ZodInteger
count: ZodInteger.optional()
});
export type UserMediaAdvancement = zod.infer<typeof ZodUserMediaAdvancement>;
export function isUserMediaAdvancement(data: any): data is UserMediaAdvancement {

View File

@ -67,22 +67,33 @@ export function isArrayOf<TYPE>(
return true;
}
function isNullOrUndefined(data: any): data is undefined | null {
return data === undefined || data === null;
}
export type RESTRequestType = {
restModel: RESTModel,
restConfig: RESTConfig,
data?: any,
params?: object,
queries?: object,
progress?: ProgressCallback,
};
function removeTrailingSlashes(input: string): string {
if (isNullOrUndefined(input)) {
return "undefined";
}
return input.replace(/\/+$/, '');
}
function removeLeadingSlashes(input: string): string {
if (isNullOrUndefined(input)) {
return "";
}
return input.replace(/^\/+/, '');
}
export function RESTUrl({ restModel, restConfig, data, params, queries }: RESTRequestType): string {
export function RESTUrl({ restModel, restConfig, params, queries }: RESTRequestType): string {
// Create the URL PATH:
let generateUrl = `${removeTrailingSlashes(restConfig.server)}/${removeLeadingSlashes(restModel.endPoint)}`;
if (params !== undefined) {
@ -112,7 +123,64 @@ export function RESTUrl({ restModel, restConfig, data, params, queries }: RESTRe
return generateUrl + "?" + searchParams.toString();
}
export function RESTRequest({ restModel, restConfig, data, params, queries }: RESTRequestType): Promise<ModelResponseHttp> {
export type ProgressCallback = (count: number, total: number) => void;
// input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
export function fetchProgress<TYPE>(generateUrl: string, { method, headers, body }: {
method: HTTPRequestModel,
headers: any,
body: any,
}, progress: ProgressCallback): Promise<Response> {
//async function fetchForm(form, options = {}) {
const action = generateUrl;
const data = body;
const xhr = new XMLHttpRequest();
console.log(`call fetch progress ...`);
return new Promise((resolve, reject) => {
xhr.responseType = 'blob';
xhr.onreadystatechange = () => {
if (xhr.readyState != 4) {
console.log(` ==> READY state`);
// done
return;
}
console.log(` ==> has finish ...`);
const response = new Response(xhr.response, {
status: xhr.status,
statusText: xhr.statusText
});
resolve(response);
}
// If fail:
xhr.addEventListener('error', () => {
console.log(` ==> IS REJECTED`);
reject(new TypeError('Failed to fetch'))
});
// Link the progression callback
if (progress) {
xhr.addEventListener('progress', (dataEvent) => {
console.log(` ==> has a progress event: ${dataEvent.loaded} / ${dataEvent.total}`);
progress(dataEvent.loaded, dataEvent.total);
});
}
console.log(` ==> open`);
// open the socket
xhr.open(method, action, true);
console.log(` ==> set header`);
// configure the header
if (!isNullOrUndefined(headers)) {
for (const [key, value] of Object.entries(headers)) {
xhr.setRequestHeader(key, value as string);
}
}
console.log(` ==> send`);
xhr.send(data);
console.log(` ==> send done`);
});
}
export function RESTRequest({ restModel, restConfig, data, params, queries, progress }: RESTRequestType): Promise<ModelResponseHttp> {
// Create the URL PATH:
let generateUrl = RESTUrl({ restModel, restConfig, data, params, queries });
let headers: any = {};
@ -141,11 +209,21 @@ export function RESTRequest({ restModel, restConfig, data, params, queries }: RE
}
console.log(`Call ${generateUrl}`)
return new Promise((resolve, reject) => {
fetch(generateUrl, {
let action: Promise<Response> = undefined;
if (isNullOrUndefined(progress)) {
action = fetch(generateUrl, {
method: restModel.requestType,
headers,
body,
}).then((response: Response) => {
});
} else {
action = fetchProgress(generateUrl, {
method: restModel.requestType,
headers,
body,
}, progress);
}
action.then((response: Response) => {
if (response.status >= 200 && response.status <= 299) {
const contentType = response.headers.get('Content-Type');
if (restModel.accept !== contentType) {
@ -196,6 +274,8 @@ export function RESTRequest({ restModel, restConfig, data, params, queries }: RE
});
}
export function RESTRequestJson<TYPE>(request: RESTRequestType, checker: (data: any) => data is TYPE): Promise<TYPE> {
return new Promise((resolve, reject) => {
RESTRequest(request).then((value: ModelResponseHttp) => {

View File

@ -1,8 +1,8 @@
/**
* API of the server (auto-generated code)
*/
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {Long, Season, UUID, isSeason, } from "./model"
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, ProgressCallback, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {UUID, Long, Season, isSeason, } from "./model"
export namespace SeasonResource {
/**
@ -88,7 +88,7 @@ export namespace SeasonResource {
/**
* Upload a new season cover season
*/
export function uploadCover({ restConfig, params, data, }: {
export function uploadCover({ restConfig, params, data, progress, }: {
restConfig: RESTConfig,
params: {
id: Long,
@ -97,10 +97,11 @@ export namespace SeasonResource {
fileName: string,
file: File,
},
progress?: ProgressCallback,
}): Promise<Season> {
return RESTRequestJson({
restModel: {
endPoint: "/season/{id}/add_cover",
endPoint: "/season/{id}/cover",
requestType: HTTPRequestModel.POST,
contentType: HTTPMimeType.MULTIPART,
accept: HTTPMimeType.JSON,
@ -108,6 +109,22 @@ export namespace SeasonResource {
restConfig,
params,
data,
progress,
}, isSeason);
};
/**
* Get a specific Season with his ID
*/
export function gets({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<Season[]> {
return RESTRequestJsonArray({
restModel: {
endPoint: "/season",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isSeason);
};
/**
@ -131,19 +148,4 @@ export namespace SeasonResource {
params,
}, isSeason);
};
/**
* Get a specific Season with his ID
*/
export function gets({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<Season[]> {
return RESTRequestJsonArray({
restModel: {
endPoint: "/season",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isSeason);
};
}

View File

@ -1,8 +1,8 @@
/**
* API of the server (auto-generated code)
*/
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {Series, Long, UUID, isSeries, } from "./model"
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, ProgressCallback, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import { UUID, Long, Series, isSeries, } from "./model"
export namespace SeriesResource {
/**
@ -88,7 +88,7 @@ export namespace SeriesResource {
/**
* Upload a new season cover Series
*/
export function uploadCover({ restConfig, params, data, }: {
export function uploadCover({ restConfig, params, data, progress, }: {
restConfig: RESTConfig,
params: {
id: Long,
@ -97,6 +97,7 @@ export namespace SeriesResource {
fileName: string,
file: File,
},
progress?: ProgressCallback,
}): Promise<Series> {
return RESTRequestJson({
restModel: {
@ -108,6 +109,22 @@ export namespace SeriesResource {
restConfig,
params,
data,
progress,
}, isSeries);
};
/**
* Get all Series
*/
export function gets({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<Series[]> {
return RESTRequestJsonArray({
restModel: {
endPoint: "/series",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isSeries);
};
/**
@ -131,19 +148,4 @@ export namespace SeriesResource {
params,
}, isSeries);
};
/**
* Get all Series
*/
export function gets({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<Series[]> {
return RESTRequestJsonArray({
restModel: {
endPoint: "/series",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isSeries);
};
}

View File

@ -1,8 +1,8 @@
/**
* API of the server (auto-generated code)
*/
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {Long, Type, UUID, isType, } from "./model"
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, ProgressCallback, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {UUID, Long, Type, isType, } from "./model"
export namespace TypeResource {
/**
@ -88,7 +88,7 @@ export namespace TypeResource {
/**
* Upload a new season cover Type
*/
export function uploadCover({ restConfig, params, data, }: {
export function uploadCover({ restConfig, params, data, progress, }: {
restConfig: RESTConfig,
params: {
id: Long,
@ -97,6 +97,7 @@ export namespace TypeResource {
fileName: string,
file: File,
},
progress?: ProgressCallback,
}): Promise<Type> {
return RESTRequestJson({
restModel: {
@ -108,6 +109,22 @@ export namespace TypeResource {
restConfig,
params,
data,
progress,
}, isType);
};
/**
* Get all Type
*/
export function gets({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<Type[]> {
return RESTRequestJsonArray({
restModel: {
endPoint: "/type",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isType);
};
/**
@ -131,19 +148,4 @@ export namespace TypeResource {
params,
}, isType);
};
/**
* Get all Type
*/
export function gets({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<Type[]> {
return RESTRequestJsonArray({
restModel: {
endPoint: "/type",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isType);
};
}

View File

@ -1,8 +1,8 @@
/**
* API of the server (auto-generated code)
*/
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {MediaInformationsDelta, Long, UserMediaAdvancement, isUserMediaAdvancement, } from "./model"
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, ProgressCallback, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {Long, UserMediaAdvancement, MediaInformationsDelta, isUserMediaAdvancement, } from "./model"
export namespace UserMediaAdvancementResource {
/**

View File

@ -1,8 +1,8 @@
/**
* API of the server (auto-generated code)
*/
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {UserOut, Long, UserKarideo, isUserOut, isUserKarideo, } from "./model"
import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTConfig, ProgressCallback, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools"
import {Long, UserKarideo, UserOut, isUserKarideo, isUserOut, } from "./model"
export namespace UserResource {
/**
@ -24,21 +24,6 @@ export namespace UserResource {
params,
}, isUserKarideo);
};
/**
* Get the user personal data
*/
export function getMe({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<UserOut> {
return RESTRequestJson({
restModel: {
endPoint: "/users/me",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isUserOut);
};
/**
* Get all the users
*/
@ -54,4 +39,19 @@ export namespace UserResource {
restConfig,
}, isUserKarideo);
};
/**
* Get the user personal data
*/
export function getMe({ restConfig, }: {
restConfig: RESTConfig,
}): Promise<UserOut> {
return RESTRequestJson({
restModel: {
endPoint: "/users/me",
requestType: HTTPRequestModel.GET,
accept: HTTPMimeType.JSON,
},
restConfig,
}, isUserOut);
};
}

View File

@ -40,7 +40,6 @@ export class ElementTypeComponent implements OnInit {
return;
}
let self = this;
console.log(" ??? Get element ! " + JSON.stringify(this.element));
self.name = this.element.name;
self.description = this.element.description;
self.covers = self.dataService.getListThumbnailUrl(this.element.covers);

View File

@ -28,10 +28,8 @@ export class HomeScene implements OnInit {
.then((response) => {
self.error = '';
self.dataList = response;
console.log(`Get response: ${JSON.stringify(response, null, 2)}`);
}).catch((response) => {
self.error = 'Wrong e-mail/login or password';
console.log(`[E] ${self.constructor.name}: Does not get a correct response from the server ...`);
self.dataList = [];
});
this.arianeService.reset();

View File

@ -64,17 +64,18 @@ export class SeriesScene implements OnInit {
self.name = '???';
self.cover = null;
self.covers = [];
// no check just ==> an error occured on season
// no check just ==> an error occurred on season
});
//console.log(`get parameter id: ${ this.idSeries}`);
console.log(`this.seriesService.getSeason(${this.idSeries})`);
this.seriesService.getSeason(this.idSeries)
.then((response: Season[]) => {
//console.log(`>>>> get season : ${JSON.stringify(response)}`)
console.log(`>>>> get season : ${JSON.stringify(response)}`)
self.seasonsError = '';
self.seasons = response;
updateEnded.subSaison = true;
self.checkIfJumpIsNeeded(updateEnded);
}).catch((response) => {
console.log(`>>>> get season (FAIL) : ${JSON.stringify(response)}`)
self.seasonsError = 'Can not get the list of season in this series';
self.seasons = [];
updateEnded.subSaison = true;
@ -82,12 +83,13 @@ export class SeriesScene implements OnInit {
});
this.seriesService.getVideo(this.idSeries)
.then((response: Season[]) => {
//console.log(`>>>> get video : ${JSON.stringify(response)}`)
console.log(`>>>> get video : ${JSON.stringify(response)}`)
self.videosError = '';
self.videos = response;
updateEnded.subVideo = true;
self.checkIfJumpIsNeeded(updateEnded);
}).catch((response) => {
console.log(`>>>> get video (FAIL): ${JSON.stringify(response)}`)
self.videosError = 'Can not get the List of video without season';
self.videos = [];
updateEnded.subVideo = true;

View File

@ -5,8 +5,9 @@
*/
import { Component, OnInit } from '@angular/core';
import { Series } from 'app/back-api';
import { TypeService, DataService, ArianeService, AdvancementService } from 'app/service';
import { TypeService, DataService, ArianeService, AdvancementService, SeriesService } from 'app/service';
@Component({
selector: 'app-type',
@ -27,6 +28,7 @@ export class TypeScene implements OnInit {
constructor(
private dataService: DataService,
private typeService: TypeService,
private seriesService: SeriesService,
private arianeService: ArianeService,
private advancementService: AdvancementService) {
@ -43,12 +45,12 @@ export class TypeScene implements OnInit {
ngOnInit() {
this.typeId = this.arianeService.getTypeId();
let self = this;
console.log(`get type global id: ${this.typeId}`);
//console.log(`get type global id: ${this.typeId}`);
this.typeService.get(this.typeId)
.then((response) => {
self.name = response.name;
self.description = response.description;
console.log(` ==> get answer type detail: ${JSON.stringify(response)}`);
//console.log(` ==> get answer type detail: ${JSON.stringify(response)}`);
if (response.covers === undefined || response.covers === null || response.covers.length === 0) {
self.cover = null;
self.covers = [];
@ -64,23 +66,23 @@ export class TypeScene implements OnInit {
self.covers = [];
self.cover = null;
});
this.typeService.getSubSeries(this.typeId)
.then((response) => {
console.log(` ==> get answer sub-series: ${JSON.stringify(response)}`);
this.seriesService.getSeriesWithType(this.typeId)
.then((response: Series[]) => {
//console.log(` ==> get answer sub-series: ${JSON.stringify(response)}`);
self.seriessError = '';
self.series = response;
}).catch((response) => {
console.log(` ==> get answer sub-series (ERROR): ${JSON.stringify(response)}`);
//console.log(` ==> get answer sub-series (ERROR): ${JSON.stringify(response)}`);
self.seriessError = 'Wrong e-mail/login or password';
self.series = [];
});
this.typeService.getSubVideo(this.typeId)
.then((response) => {
console.log(` ==> get answer sub-video: ${JSON.stringify(response)}`);
//console.log(` ==> get answer sub-video: ${JSON.stringify(response)}`);
self.videosError = '';
self.videos = response;
}).catch((response) => {
console.log(` ==> get answer sub-video (ERROR): ${JSON.stringify(response)}`);
//console.log(` ==> get answer sub-video (ERROR): ${JSON.stringify(response)}`);
self.videosError = 'Wrong e-mail/login or password';
self.videos = [];
});

View File

@ -6,6 +6,7 @@
import { Component, OnInit } from '@angular/core';
import { PopInService, UploadProgress } from '@kangaroo-and-rabbit/kar-cw';
import { Series } from 'app/back-api';
import { TypeService, SeriesService, MediaService, SeasonService } from 'app/service';
@ -151,8 +152,8 @@ export class UploadScene implements OnInit {
let self = this;
this.updateNeedSend();
if (this.typeId !== null) {
self.typeService.getSubSeries(this.typeId)
.then((response2) => {
self.seriesService.getSeriesWithType(this.typeId)
.then((response2: Series[]) => {
for (let iii = 0; iii < response2.length; iii++) {
self.listSeries.push({ value: response2[iii].id, label: response2[iii].name });
}

View File

@ -211,7 +211,7 @@ export class VideoEditScene implements OnInit {
let self = this;
this.updateNeedSend();
if (this.data.typeId !== undefined) {
self.typeService.getSubSeries(this.data.typeId)
self.seriesService.getSeriesWithType(this.data.typeId)
.then((response2: Series[]) => {
for (let iii = 0; iii < response2.length; iii++) {
self.listSeries.push({ value: response2[iii].id, label: response2[iii].name });

View File

@ -83,7 +83,7 @@ export class ArianeService {
this.setType(undefined);
}
}
getCurrrentSegment(): string | undefined {
getCurrentSegment(): string | undefined {
return this.segment;
}

View File

@ -7,7 +7,7 @@
import { Injectable } from '@angular/core';
import { SessionService, DataStore } from '@kangaroo-and-rabbit/kar-cw';
import { Media, MediaResource, UUID } from 'app/back-api';
import { RESTConfig } from 'app/back-api/rest-tools';
import { ProgressCallback, RESTConfig } from 'app/back-api/rest-tools';
import { environment } from 'environments/environment';
import { GenericDataService } from './GenericDataService';
@ -37,7 +37,7 @@ export class MediaService extends GenericDataService<Media> {
episode?: number,
title?: string,
typeId?: number,
progress: any = null) {
progress: ProgressCallback | undefined = undefined) {
const formData = {
fileName: file.name,
file,
@ -52,7 +52,7 @@ export class MediaService extends GenericDataService<Media> {
return MediaResource.uploadFile({
restConfig: this.getRestConfig(),
data: formData,
//progress
progress
});
}
@ -110,7 +110,7 @@ export class MediaService extends GenericDataService<Media> {
}
uploadCover(id: number,
file: File,
progress: any = null): Promise<Media> {
progress: ProgressCallback | undefined = undefined): Promise<Media> {
let self = this;
return new Promise((resolve, reject) => {
MediaResource.uploadCover({
@ -122,7 +122,7 @@ export class MediaService extends GenericDataService<Media> {
file,
fileName: file.name
},
//progress
progress
}).then((value) => {
self.dataStore.updateValue(value);
resolve(value);

View File

@ -7,7 +7,7 @@
import { Injectable } from '@angular/core';
import { DataStore, SessionService, TypeCheck } from '@kangaroo-and-rabbit/kar-cw';
import { Media, Season, SeasonResource, UUID } from 'app/back-api';
import { RESTConfig } from 'app/back-api/rest-tools';
import { ProgressCallback, RESTConfig } from 'app/back-api/rest-tools';
import { environment } from 'environments/environment';
import { GenericDataService } from './GenericDataService';
import { MediaService } from './media';
@ -19,7 +19,7 @@ export class SeasonService extends GenericDataService<Season> {
getRestConfig(): RESTConfig {
return {
server: environment.server.karusic,
server: environment.server.karideo,
token: this.session.getToken()
}
}
@ -141,7 +141,7 @@ export class SeasonService extends GenericDataService<Season> {
}
uploadCover(id: number,
file: File,
progress: any = null): Promise<Season> {
progress: ProgressCallback | undefined = undefined): Promise<Season> {
let self = this;
return new Promise((resolve, reject) => {
SeasonResource.uploadCover({
@ -153,7 +153,7 @@ export class SeasonService extends GenericDataService<Season> {
file,
fileName: file.name
},
//progress
progress
}).then((value) => {
self.dataStore.updateValue(value);
resolve(value);

View File

@ -8,7 +8,7 @@ import { Injectable } from '@angular/core';
import { SessionService, DataStore, TypeCheck } from '@kangaroo-and-rabbit/kar-cw';
import { Media, Season, Series, SeriesResource, UUID } from 'app/back-api';
import { RESTConfig } from 'app/back-api/rest-tools';
import { ProgressCallback, RESTConfig } from 'app/back-api/rest-tools';
import { environment } from 'environments/environment';
import { GenericDataService } from './GenericDataService';
import { SeasonService, MediaService } from '.';
@ -117,6 +117,24 @@ export class SeriesService extends GenericDataService<Series> {
});
}
getSeriesWithType(typeId: number): Promise<Series[]> {
let self = this;
return new Promise((resolve, reject) => {
self.getsWhere([
{
check: TypeCheck.EQUAL,
key: 'parentId',
value: typeId,
}],
['name'])
.then((data: Series[]) => {
resolve(data);
})
.catch((response) => {
reject(response);
});
});
}
patch(id: number, data: Series): Promise<Series> {
const self = this;
@ -178,7 +196,7 @@ export class SeriesService extends GenericDataService<Series> {
}
uploadCover(id: number,
file: File,
progress: any = null): Promise<Media> {
progress: ProgressCallback | undefined = undefined): Promise<Media> {
let self = this;
return new Promise((resolve, reject) => {
SeriesResource.uploadCover({
@ -190,7 +208,7 @@ export class SeriesService extends GenericDataService<Series> {
file,
fileName: file.name
},
//progress
progress
}).then((value) => {
self.dataStore.updateValue(value);
resolve(value);

View File

@ -34,7 +34,7 @@ export class TypeService extends GenericDataService<Type> {
constructor(private session: SessionService,
private MediaService: MediaService,
private seriesService: SeriesService,
//private seriesService: SeriesService,
) {
super();
console.log('Start TypeService');
@ -87,28 +87,6 @@ export class TypeService extends GenericDataService<Type> {
});
}
getSubSeries(id: number): Promise<Series[]> {
let self = this;
return new Promise((resolve, reject) => {
resolve([]);
/*
self.seriesService.getsWhere([
{
check: TypeCheck.EQUAL,
key: 'parentId',
value: id,
}],
['name'])
.then((data: Series[]) => {
resolve(data);
})
.catch((response) => {
reject(response);
});
*/
});
}
getSubUniverse(id: number): Promise<any[]> {
let self = this;
return new Promise((resolve, reject) => {

View File

@ -2,29 +2,33 @@
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="256"
height="256"
viewBox="0 0 67.733333 67.733333"
version="1.1"
id="svg8"
inkscape:version="0.92.4 5da689c313, 2019-01-14"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
sodipodi:docname="ikon_gray.svg"
inkscape:export-filename="/home/heero/dev/perso/appl_pro/NoKomment/plugin/chrome/ikon.png"
inkscape:export-xdpi="7.1250005"
inkscape:export-ydpi="7.1250005">
inkscape:export-ydpi="7.1250005"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs2">
<filter
style="color-interpolation-filters:sRGB;"
inkscape:label="Drop Shadow"
id="filter5338">
id="filter5338"
x="-0.12319682"
y="-0.081815216"
width="1.2463936"
height="1.1636304">
<feFlood
flood-opacity="1"
flood-color="rgb(255,255,255)"
@ -74,22 +78,31 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.8"
inkscape:cx="60.215971"
inkscape:cy="128.86947"
inkscape:zoom="7.9195959"
inkscape:cx="100.06824"
inkscape:cy="115.66247"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="true"
units="px"
inkscape:snap-text-baseline="false"
inkscape:window-width="1918"
inkscape:window-height="1038"
inkscape:window-width="3838"
inkscape:window-height="2118"
inkscape:window-x="0"
inkscape:window-y="20"
inkscape:window-maximized="1">
inkscape:window-maximized="1"
inkscape:showpageshadow="2"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1">
<inkscape:grid
type="xygrid"
id="grid4504" />
id="grid4504"
originx="0"
originy="0"
spacingy="1"
spacingx="1"
units="px"
visible="true" />
</sodipodi:namedview>
<metadata
id="metadata5">
@ -115,11 +128,11 @@
transform="matrix(0.8407653,0,0,0.83753055,-37.28971,3.4402954)"
aria-label="K">
<path
sodipodi:nodetypes="ccccccccccccc"
sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccssccccssscccccccccccccccsscccccsssccccccccccccccssscsscsss"
inkscape:connector-curvature="0"
id="path823-5"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:84.55024719px;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;opacity:0.775;fill:#2b3137;fill-opacity:1;stroke-width:2.11376619;filter:url(#filter5338)"
d="m 65.200546,279.9533 h 8.949095 v 27.37877 l 25.568842,-27.37877 6.392207,6.84469 -20.455071,21.90302 20.455071,27.37876 -6.392207,5.47576 -19.176632,-27.37877 -6.39221,6.84469 v 20.53408 h -8.949095 z" />
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:84.5502px;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;opacity:0.775;fill:#2b3137;fill-opacity:1;stroke-width:2.11377;filter:url(#filter5338)"
d="m 65.200546,279.9533 h 8.949095 v 27.37877 l 25.568842,-27.37877 6.392207,6.84469 -20.455071,21.90302 20.455071,27.37876 -6.392207,5.47576 -19.176632,-27.37877 -6.39221,6.84469 v 20.53408 h -8.949095 z m 3.913007,39.48974 c -0.26846,-0.43226 -0.592093,-0.92734 -0.887692,-1.37494 l 0.02075,-0.022 c 0.456433,0.27687 0.977308,0.56258 1.422211,0.80755 l 0.407045,0.22999 -0.710959,0.75468 z m 0.591316,3.01367 0.778423,-0.82629 -0.642969,-1.02783 1.022328,-1.08519 1.052938,0.59264 0.80956,-0.85934 -4.631256,-2.27837 -0.913349,0.96952 z m 6.54394,-6.94635 0.762854,-0.80977 -1.289542,-1.22424 0.399591,-0.42416 1.938227,0.53566 0.856265,-0.90892 -2.195068,-0.54992 c 0.187965,-0.54159 0.09714,-1.11827 -0.429654,-1.61839 -0.850547,-0.80747 -1.705543,-0.42955 -2.421693,0.33064 l -1.198771,1.27249 z m -1.168715,-2.64352 -1.004195,-0.95334 0.373643,-0.39662 c 0.40478,-0.42967 0.738271,-0.54092 1.089465,-0.20751 0.351195,0.33341 0.31951,0.73118 -0.08527,1.16085 z m 7.416862,-3.98885 2.345648,-2.48989 -0.68044,-0.64598 -0.788801,0.83731 -2.216914,-2.10465 0.788802,-0.83731 -0.680439,-0.64598 -2.345647,2.48989 0.680439,0.64598 0.788802,-0.83731 2.216913,2.10465 -0.788801,0.83731 z m 6.206624,-6.58829 0.980813,-1.04113 c 0.939292,-0.99705 1.006613,-2.22712 -0.222565,-3.39405 -1.229181,-1.16694 -2.41593,-0.99961 -3.401932,0.047 l -0.934107,0.99155 z m 0.115038,-1.43521 -2.271787,-2.15674 0.124547,-0.13221 c 0.52932,-0.56189 1.150798,-0.69191 2.006834,0.12078 0.856035,0.81268 0.794297,1.47411 0.264954,2.03597 z m 6.226516,-5.29631 2.293753,-2.4348 -0.68044,-0.64599 -1.525707,1.61953 -0.823112,-0.78143 1.250665,-1.32757 -0.674951,-0.64077 -1.250666,1.32757 -0.71885,-0.68245 1.473813,-1.56444 -0.680438,-0.64598 -2.241858,2.37972 z m 7.372646,-7.6936 c 0.80437,-0.85384 0.71213,-2.05798 -0.51156,-3.2197 -1.19626,-1.13568 -2.393561,-1.15578 -3.197932,-0.30194 -0.80437,0.85383 -0.717618,2.05277 0.478638,3.18844 1.223694,1.16173 2.426484,1.18703 3.230854,0.3332 z m -0.6969,-0.66161 c -0.35289,0.37458 -0.97662,0.23116 -1.750342,-0.50339 -0.7408,-0.70328 -0.918234,-1.32045 -0.565349,-1.69503 0.352885,-0.37459 0.976611,-0.23116 1.717411,0.47213 0.77373,0.73454 0.95116,1.3517 0.59828,1.72629 z" />
</g>
<g
id="text821"

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">

View File

@ -9,7 +9,7 @@
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2022",
"target": "ES2022",
"typeRoots": [
"node_modules/@types"
],
@ -17,7 +17,7 @@
"ES2022",
"dom"
],
"module": "es2022",
"module": "ES2022",
"baseUrl": "./src",
"paths": {
"@app/*": [
@ -27,5 +27,13 @@
"./src/common/*"
]
}
},
"angularCompilerOptions": {
"_enabledBlockTypes": [
"if",
"switch",
"for",
"defer"
]
}
}