[DEV] Add some types
This commit is contained in:
parent
3c98b6f4bb
commit
edcac1a386
@ -113,7 +113,6 @@ public class DataResource {
|
||||
}
|
||||
entry.disconnect();
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public static Data createNewData(long tmpUID, String originalFileName, String sha512) throws IOException, SQLException {
|
||||
|
@ -260,35 +260,35 @@ public class VideoResource {
|
||||
@POST
|
||||
@Path("/upload/")
|
||||
@Consumes({MediaType.MULTIPART_FORM_DATA})
|
||||
public Response uploadFile(@FormDataParam("file_name") String file_name,
|
||||
public Response uploadFile(@FormDataParam("fileName") String fileName,
|
||||
@FormDataParam("universe") String universe,
|
||||
@FormDataParam("series") String series,
|
||||
@FormDataParam("season") String season,
|
||||
@FormDataParam("episode") String episode,
|
||||
@FormDataParam("title") String title,
|
||||
@FormDataParam("type_id") String type_id,
|
||||
@FormDataParam("typeId") String typeId,
|
||||
@FormDataParam("file") InputStream fileInputStream,
|
||||
@FormDataParam("file") FormDataContentDisposition fileMetaData
|
||||
) {
|
||||
try {
|
||||
// correct input string stream :
|
||||
file_name = multipartCorrection(file_name);
|
||||
fileName = multipartCorrection(fileName);
|
||||
universe = multipartCorrection(universe);
|
||||
series = multipartCorrection(series);
|
||||
season = multipartCorrection(season);
|
||||
episode = multipartCorrection(episode);
|
||||
title = multipartCorrection(title);
|
||||
type_id = multipartCorrection(type_id);
|
||||
typeId = multipartCorrection(typeId);
|
||||
|
||||
//public NodeSmall uploadFile(final FormDataMultiPart form) {
|
||||
System.out.println("Upload media file: " + fileMetaData);
|
||||
System.out.println(" - file_name: " + file_name);
|
||||
System.out.println(" - fileName: " + fileName);
|
||||
System.out.println(" - universe: " + universe);
|
||||
System.out.println(" - series: " + series);
|
||||
System.out.println(" - season: " + season);
|
||||
System.out.println(" - episode: " + episode);
|
||||
System.out.println(" - title: " + title);
|
||||
System.out.println(" - type_id: " + type_id);
|
||||
System.out.println(" - typeId: " + typeId);
|
||||
System.out.println(" - fileInputStream: " + fileInputStream);
|
||||
System.out.println(" - fileMetaData: " + fileMetaData);
|
||||
System.out.flush();
|
||||
@ -301,7 +301,7 @@ public class VideoResource {
|
||||
System.out.println("Need to add the data in the BDD ... ");
|
||||
System.out.flush();
|
||||
try {
|
||||
data = DataResource.createNewData(tmpUID, file_name, sha512);
|
||||
data = DataResource.createNewData(tmpUID, fileName, sha512);
|
||||
} catch (IOException ex) {
|
||||
DataResource.removeTemporaryFile(tmpUID);
|
||||
ex.printStackTrace();
|
||||
@ -323,7 +323,7 @@ public class VideoResource {
|
||||
// Fist step: retive all the Id of each parents:...
|
||||
System.out.println("Find typeNode");
|
||||
// check if id of type exist:
|
||||
NodeSmall typeNode = TypeResource.getWithId(Long.parseLong(type_id));
|
||||
NodeSmall typeNode = TypeResource.getWithId(Long.parseLong(typeId));
|
||||
if (typeNode == null) {
|
||||
DataResource.removeTemporaryFile(tmpUID);
|
||||
return Response.notModified("TypeId does not exist ...").build();
|
||||
@ -422,18 +422,18 @@ public class VideoResource {
|
||||
@Path("{id}/add_cover")
|
||||
@Consumes({MediaType.MULTIPART_FORM_DATA})
|
||||
public Response uploadCover(@PathParam("id") Long id,
|
||||
@FormDataParam("file_name") String file_name,
|
||||
@FormDataParam("fileName") String fileName,
|
||||
@FormDataParam("file") InputStream fileInputStream,
|
||||
@FormDataParam("file") FormDataContentDisposition fileMetaData
|
||||
) {
|
||||
try {
|
||||
// correct input string stream :
|
||||
file_name = multipartCorrection(file_name);
|
||||
fileName = multipartCorrection(fileName);
|
||||
|
||||
//public NodeSmall uploadFile(final FormDataMultiPart form) {
|
||||
System.out.println("Upload media file: " + fileMetaData);
|
||||
System.out.println(" - id: " + id);
|
||||
System.out.println(" - file_name: " + file_name);
|
||||
System.out.println(" - fileName: " + fileName);
|
||||
System.out.println(" - fileInputStream: " + fileInputStream);
|
||||
System.out.println(" - fileMetaData: " + fileMetaData);
|
||||
System.out.flush();
|
||||
@ -449,7 +449,7 @@ public class VideoResource {
|
||||
System.out.println("Need to add the data in the BDD ... ");
|
||||
System.out.flush();
|
||||
try {
|
||||
data = DataResource.createNewData(tmpUID, file_name, sha512);
|
||||
data = DataResource.createNewData(tmpUID, fileName, sha512);
|
||||
} catch (IOException ex) {
|
||||
DataResource.removeTemporaryFile(tmpUID);
|
||||
ex.printStackTrace();
|
||||
|
@ -3,6 +3,7 @@
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router'; // CLI imports router
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
|
@ -3,13 +3,9 @@
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
|
||||
import { Injectable, Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||
|
||||
// import { AppRoutingModule } from "../app-routing.module";
|
||||
|
||||
import { Router } from '@angular/router';
|
||||
import { ActivatedRoute, Params } from '@angular/router';
|
||||
import { TypeService } from '../../service/type';
|
||||
import { PopInService } from '../../service/popin';
|
||||
|
||||
@Component({
|
||||
@ -27,8 +23,7 @@ export class PopInDeleteConfirm implements OnInit {
|
||||
public closeButtonTitle: string = 'Cancel';
|
||||
public validateButtonTitle: string = 'Validate';
|
||||
|
||||
constructor(private router: Router,
|
||||
private popInService: PopInService) {
|
||||
constructor(private popInService: PopInService) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -3,11 +3,10 @@
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
|
||||
import { Injectable, Component, OnInit, Input, SimpleChanges } from '@angular/core';
|
||||
|
||||
// import { AppRoutingModule } from "../app-routing.module";
|
||||
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
import { PopInService } from '../../service/popin';
|
||||
|
||||
@Component({
|
||||
|
@ -1,3 +1,9 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ArianeService } from '../../service/ariane';
|
||||
|
@ -58,7 +58,7 @@ export class UploadScene implements OnInit {
|
||||
selectedFiles: FileList;
|
||||
typeId: number = null;
|
||||
seriesId: number = null;
|
||||
saisonId: number = null;
|
||||
saisonId: number = null;v
|
||||
needSend: boolean = false;
|
||||
|
||||
// list of all files already registered in the bdd to compare with the curent list of files.
|
||||
|
@ -1,3 +1,9 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ArianeService } from '../../service/ariane';
|
||||
|
@ -25,14 +25,14 @@ export interface ElementList {
|
||||
class DataToSend {
|
||||
name:string = '';
|
||||
description:string = '';
|
||||
episode:number = undefined;
|
||||
episode?:number;
|
||||
universeId:number = null;
|
||||
seriesId:number = null;
|
||||
seasonId:number = null;
|
||||
dataId:number = -1;
|
||||
time:number = undefined;
|
||||
time?:number;
|
||||
typeId:number = null;
|
||||
covers:Array<any> = [];
|
||||
covers:number[] = [];
|
||||
generatedName:string = '';
|
||||
clone() {
|
||||
let tmp = new DataToSend();
|
||||
|
@ -1,6 +1,12 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpWrapperService } from './http-wrapper';
|
||||
import { DataInterface } from './dataInterface';
|
||||
import { DataInterface, MediaSmall } from './dataInterface';
|
||||
|
||||
|
||||
@Injectable()
|
||||
@ -71,7 +77,7 @@ export class BddService {
|
||||
});
|
||||
}
|
||||
|
||||
get(name: string): any {
|
||||
get(name: string): Promise<DataInterface> {
|
||||
let self = this;
|
||||
console.log(`Try to get DB '${ name }'`);
|
||||
if(this.bdd[name] === undefined) {
|
||||
@ -143,23 +149,23 @@ export class BddService {
|
||||
});
|
||||
}
|
||||
|
||||
getType():any {
|
||||
getType(): Promise<DataInterface> {
|
||||
return this.get('type');
|
||||
}
|
||||
|
||||
getSeries():any {
|
||||
getSeries(): Promise<DataInterface> {
|
||||
return this.get('series');
|
||||
}
|
||||
|
||||
getSeason():any {
|
||||
getSeason(): Promise<DataInterface> {
|
||||
return this.get('season');
|
||||
}
|
||||
|
||||
getUniverse():any {
|
||||
getUniverse(): Promise<DataInterface> {
|
||||
return this.get('universe');
|
||||
}
|
||||
|
||||
getVideo():any {
|
||||
getVideo(): Promise<DataInterface> {
|
||||
return this.get('video');
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,14 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { HttpWrapperService } from './http-wrapper';
|
||||
import { DataInterface } from './dataInterface';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class DataService {
|
||||
// 0: Not hide password; 1 hide password;
|
||||
|
@ -1,18 +1,32 @@
|
||||
/**
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2019, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license MPL v2.0 (see license file)
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
|
||||
export interface MediaSmall {
|
||||
id: number;
|
||||
name: string;
|
||||
description?: string;
|
||||
dataId?: number;
|
||||
typeId?: number;
|
||||
universeId?: number;
|
||||
seriesId?: number;
|
||||
seasonId?: number;
|
||||
episode?: number;
|
||||
date?: number;
|
||||
time?: number;
|
||||
ageLimit?: string;
|
||||
covers: number[];
|
||||
};
|
||||
|
||||
/**
|
||||
* @breif Generic interface to access to the BDD (no BDD, direct file IO)
|
||||
*/
|
||||
export class DataInterface {
|
||||
constructor(
|
||||
private name: string,
|
||||
private bdd: any) {
|
||||
private bdd: MediaSmall[] ) {
|
||||
}
|
||||
|
||||
public getTableIndex(id: number) {
|
||||
@ -32,7 +46,7 @@ export class DataInterface {
|
||||
return this.filterObjectValues(this.bdd, filter);
|
||||
}
|
||||
|
||||
public getsWhere(select, filter = undefined, orderBy = undefined) {
|
||||
public getsWhere(select, filter?: string[], orderBy?: string[]) {
|
||||
// console.log("[I] gets_where " + this.name + " select " + _select);
|
||||
let tmpList = this.getSubList(this.bdd, select);
|
||||
tmpList = this.orderBy(tmpList, orderBy);
|
||||
@ -75,7 +89,7 @@ export class DataInterface {
|
||||
return out;
|
||||
}
|
||||
|
||||
public set(id: number, value: any) {
|
||||
public set(id: number, value: any): void {
|
||||
console.log(`[I] Set ${ this.name } ${ id}`);
|
||||
for(let iii = 0; iii < this.bdd.length; iii++) {
|
||||
console.log(` check: ${ this.bdd[iii].id}`);
|
||||
@ -86,7 +100,7 @@ export class DataInterface {
|
||||
}
|
||||
}
|
||||
|
||||
public delete(id: number) {
|
||||
public delete(id: number): void {
|
||||
console.log(`[I] delete ${ this.name } ${ id}`);
|
||||
for(let iii = 0; iii < this.bdd.length; iii++) {
|
||||
if(this.bdd[iii].id === id) {
|
||||
@ -129,7 +143,7 @@ export class DataInterface {
|
||||
return false;
|
||||
}
|
||||
|
||||
public getSubList(values, select) {
|
||||
public getSubList(values: MediaSmall[], select: any[][] ) {
|
||||
let out = [];
|
||||
for(let iiiElem = 0; iiiElem < values.length; iiiElem++) {
|
||||
let find = true;
|
||||
@ -219,7 +233,7 @@ export class DataInterface {
|
||||
return out;
|
||||
}
|
||||
|
||||
public orderBy(values, order) {
|
||||
public orderBy(values: any[], order: string[]): any[] {
|
||||
if(order === undefined) {
|
||||
return values;
|
||||
}
|
||||
@ -274,8 +288,8 @@ export class DataInterface {
|
||||
return out;
|
||||
}
|
||||
|
||||
public filterObjectValues(values, filter) {
|
||||
let out = [];
|
||||
public filterObjectValues(values: MediaSmall[], filter: string[]): any[] {
|
||||
let out: MediaSmall[] = [];
|
||||
if(filter === undefined) {
|
||||
return values;
|
||||
}
|
||||
@ -292,7 +306,7 @@ export class DataInterface {
|
||||
return out;
|
||||
}
|
||||
for(let iii = 0; iii < values.length; iii++) {
|
||||
let elementOut = {};
|
||||
let elementOut: any = {};
|
||||
for(let jjj = 0; jjj < filter.length; jjj++) {
|
||||
if(values[iii][filter[jjj]] === undefined) {
|
||||
continue;
|
||||
|
@ -1,5 +1,10 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
|
||||
import { environment } from '../../environments/environment';
|
||||
|
@ -1,8 +1,14 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpEventType } from '@angular/common/http';
|
||||
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
import { SessionService } from './session';
|
||||
|
||||
@Injectable()
|
||||
|
@ -1,3 +1,9 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
|
@ -1,4 +1,11 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { HttpWrapperService } from './http-wrapper';
|
||||
import { DataInterface } from './dataInterface';
|
||||
import { BddService } from './bdd';
|
||||
@ -19,7 +26,7 @@ export class SeasonService {
|
||||
let self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
self.bdd.getSeason()
|
||||
.then((response) => {
|
||||
.then((response: DataInterface) => {
|
||||
let data = response.get(id);
|
||||
if(data === null || data === undefined) {
|
||||
reject('Data does not exist in the local BDD');
|
||||
@ -41,7 +48,7 @@ export class SeasonService {
|
||||
let self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
self.bdd.getVideo()
|
||||
.then((response) => {
|
||||
.then((response: DataInterface) => {
|
||||
// let data = response.getsWhere([["==", "seasonId", id]], ["id", "name", "episode"], ["episode", "name"])
|
||||
let data = response.getsWhere([ [ '==', 'seasonId', id ] ], undefined, [ 'episode', 'name' ]);
|
||||
resolve(data);
|
||||
@ -60,7 +67,7 @@ export class SeasonService {
|
||||
let self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
self.bdd.getVideo()
|
||||
.then((response) => {
|
||||
.then((response: DataInterface) => {
|
||||
// let data = response.getsWhere([["==", "seasonId", _id]], ["id", "name", "episode"], ["episode", "name"])
|
||||
let data = response.getsWhere([ [ '==', 'seasonId', id ] ], undefined, [ 'episode', 'name' ]);
|
||||
resolve(data.length);
|
||||
|
@ -1,4 +1,11 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { HttpWrapperService } from './http-wrapper';
|
||||
import { DataInterface } from './dataInterface';
|
||||
import { BddService } from './bdd';
|
||||
|
@ -1,6 +1,14 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { HttpWrapperService } from './http-wrapper';
|
||||
import { BddService } from './bdd';
|
||||
import { DataInterface } from './dataInterface';
|
||||
|
||||
|
||||
export interface MessageLogIn {
|
||||
@ -28,7 +36,7 @@ export class TypeService {
|
||||
let self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
self.bdd.getType()
|
||||
.then((response) => {
|
||||
.then((response: DataInterface) => {
|
||||
let data = response.gets();
|
||||
resolve(data);
|
||||
}).catch((response) => {
|
||||
@ -42,7 +50,7 @@ export class TypeService {
|
||||
let self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
self.bdd.getType()
|
||||
.then((response) => {
|
||||
.then((response: DataInterface) => {
|
||||
let data = response.get(_id);
|
||||
if(data === null || data === undefined) {
|
||||
reject('Data does not exist in the local BDD');
|
||||
@ -59,7 +67,7 @@ export class TypeService {
|
||||
let self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
self.bdd.getVideo()
|
||||
.then((response) => {
|
||||
.then((response: DataInterface) => {
|
||||
let data = response.getsWhere([ [ '==', 'typeId', _id ] ], undefined, undefined);
|
||||
resolve(data.length);
|
||||
}).catch((response) => {
|
||||
@ -72,7 +80,7 @@ export class TypeService {
|
||||
let self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
self.bdd.getVideo()
|
||||
.then((response) => {
|
||||
.then((response: DataInterface) => {
|
||||
if(_select.length === 0) {
|
||||
let data = response.getsWhere([ [ '==', 'typeId', _id ], [ '==', 'seriesId', null ], [ '==', 'universeId', null ] ], undefined, [ 'name' ]);
|
||||
resolve(data);
|
||||
@ -98,14 +106,14 @@ export class TypeService {
|
||||
/*
|
||||
return new Promise((resolve, reject) => {
|
||||
self.bdd.getVideo()
|
||||
.then(function(response) {
|
||||
.then(function(response: DataInterface) {
|
||||
let data = response.getsWhere([["==", "typeId", _id], ["!=", "seriesId", null], ["==", "universeId", null]], ["seriesId"], ["name"]);
|
||||
if (_select.length == 0) {
|
||||
resolve(data);
|
||||
return;
|
||||
}
|
||||
self.bdd.getSeries()
|
||||
.then(function(response2) {
|
||||
.then(function(response2: DataInterface) {
|
||||
if (_select[0] == "*") {
|
||||
let data2 = response2.getsWhere([["==", "id", data]], undefined, ["name"]);
|
||||
resolve(data2);
|
||||
@ -124,7 +132,7 @@ export class TypeService {
|
||||
*/
|
||||
return new Promise((resolve, reject) => {
|
||||
self.bdd.getSeries()
|
||||
.then((response) => {
|
||||
.then((response: DataInterface) => {
|
||||
let data = response.getsWhere([ [ '==', 'parentId', id ] ], undefined, [ 'name' ]);
|
||||
resolve(data);
|
||||
}).catch((response) => {
|
||||
@ -137,14 +145,14 @@ export class TypeService {
|
||||
let self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
self.bdd.getVideo()
|
||||
.then((response) => {
|
||||
let data = response.data.getsWhere([ [ '==', 'typeId', id ], [ '==', 'seriesId', null ], [ '==', 'universeId', null ] ], [ 'universId' ], [ 'name' ]);
|
||||
.then((response: DataInterface) => {
|
||||
let data = response.getsWhere([ [ '==', 'typeId', id ], [ '==', 'seriesId', null ], [ '==', 'universeId', null ] ], [ 'universId' ], [ 'name' ]);
|
||||
if(select.length === 0) {
|
||||
resolve(data);
|
||||
return;
|
||||
}
|
||||
self.bdd.getUniverse()
|
||||
.then((response2) => {
|
||||
.then((response2: DataInterface) => {
|
||||
if(select[0] === '*') {
|
||||
let data2 = response2.getsWhere([ [ '==', 'id', data ] ], undefined, [ 'name' ]);
|
||||
resolve(data2);
|
||||
@ -156,7 +164,7 @@ export class TypeService {
|
||||
}).catch((response2) => {
|
||||
reject(response2);
|
||||
});
|
||||
}).catch((response) => {
|
||||
}).catch((response: any) => {
|
||||
reject(response);
|
||||
});
|
||||
});
|
||||
|
@ -1,6 +1,12 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { HttpWrapperService } from './http-wrapper';
|
||||
import { DataInterface } from './dataInterface';
|
||||
import { BddService } from './bdd';
|
||||
|
||||
@Injectable()
|
||||
|
@ -1,4 +1,11 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { HttpOAuthWrapperService } from './http-oauth-wrapper';
|
||||
import { HttpWrapperService } from './http-wrapper';
|
||||
|
||||
|
@ -1,6 +1,14 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { HttpWrapperService } from './http-wrapper';
|
||||
import { BddService } from './bdd';
|
||||
import { DataInterface } from './dataInterface';
|
||||
|
||||
@Injectable()
|
||||
export class VideoService {
|
||||
@ -18,7 +26,7 @@ export class VideoService {
|
||||
let self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
self.bdd.get(this.serviceName)
|
||||
.then((response) => {
|
||||
.then((response: DataInterface) => {
|
||||
let data = response.get(id);
|
||||
if(data === null || data === undefined) {
|
||||
reject('Data does not exist in the local BDD');
|
||||
|
Loading…
Reference in New Issue
Block a user