more changes for #48, the UI now works \o/

This commit is contained in:
mProjectsCode 2022-09-24 20:33:06 +02:00
parent e00c5ce2c2
commit 14719efa22
17 changed files with 381 additions and 165 deletions

View file

@ -19,6 +19,15 @@ export class BoardGameModel extends MediaTypeModel {
constructor(obj: any = {}) {
super();
this.genres = undefined;
this.onlineRating = undefined;
this.image = undefined;
this.released = undefined;
this.userData = {
played: undefined,
personalRating: undefined,
};
Object.assign(this, obj);
this.type = this.getMediaType();

View file

@ -4,15 +4,6 @@ import {MediaType} from '../utils/MediaType';
export class GameModel extends MediaTypeModel {
type: string;
subType: string;
title: string;
englishTitle: string;
year: string;
dataSource: string;
url: string;
id: string;
genres: string[];
onlineRating: number;
image: string;
@ -29,6 +20,16 @@ export class GameModel extends MediaTypeModel {
constructor(obj: any = {}) {
super();
this.genres = undefined;
this.onlineRating = undefined;
this.image = undefined;
this.released = undefined;
this.releaseDate = undefined;
this.userData = {
played: undefined,
personalRating: undefined,
};
Object.assign(this, obj);
this.type = this.getMediaType();

View file

@ -12,6 +12,19 @@ export abstract class MediaTypeModel {
userData: object;
constructor() {
this.type = undefined;
this.subType = undefined;
this.title = undefined;
this.englishTitle = undefined;
this.year = undefined;
this.dataSource = undefined;
this.url = undefined;
this.id = undefined;
this.userData = {};
}
abstract getMediaType(): MediaType;
//a string that contains enough info to disambiguate from similar media
@ -24,7 +37,7 @@ export abstract class MediaTypeModel {
}
getWithOutUserData(): object {
const copy = JSON.parse(JSON.stringify(this));
const copy = Object.assign({}, this);
delete copy.userData;
return copy;
}

View file

@ -4,15 +4,6 @@ import {MediaType} from '../utils/MediaType';
export class MovieModel extends MediaTypeModel {
type: string;
subType: string;
title: string;
englishTitle: string;
year: string;
dataSource: string;
url: string;
id: string;
genres: string[];
producer: string;
duration: string;
@ -31,6 +22,19 @@ export class MovieModel extends MediaTypeModel {
constructor(obj: any = {}) {
super();
this.genres = undefined;
this.producer = undefined;
this.duration = undefined;
this.onlineRating = undefined;
this.image = undefined;
this.released = undefined;
this.premiere = undefined;
this.userData = {
watched: undefined,
lastWatched: undefined,
personalRating: undefined,
};
Object.assign(this, obj);
this.type = this.getMediaType();

View file

@ -24,6 +24,13 @@ export class MusicReleaseModel extends MediaTypeModel {
constructor(obj: any = {}) {
super();
this.genres = undefined;
this.artists = undefined;
this.rating = undefined;
this.userData = {
personalRating: undefined,
};
Object.assign(this, obj);
this.type = this.getMediaType();

View file

@ -34,6 +34,22 @@ export class SeriesModel extends MediaTypeModel {
constructor(obj: any = {}) {
super();
this.genres = undefined;
this.studios = undefined;
this.episodes = undefined;
this.duration = undefined;
this.onlineRating = undefined;
this.image = undefined;
this.released = undefined;
this.airing = undefined;
this.airedFrom = undefined;
this.airedTo = undefined;
this.userData = {
watched: undefined,
lastWatched: undefined,
personalRating: undefined,
};
Object.assign(this, obj);
this.type = this.getMediaType();

View file

@ -23,6 +23,12 @@ export class WikiModel extends MediaTypeModel {
constructor(obj: any = {}) {
super();
this.wikiUrl = undefined;
this.lastUpdated = undefined;
this.length = undefined;
this.article = undefined;
this.userData = {};
Object.assign(this, obj);
this.type = this.getMediaType();
@ -37,7 +43,7 @@ export class WikiModel extends MediaTypeModel {
}
override getWithOutUserData(): object {
const copy = JSON.parse(JSON.stringify(this));
const copy = Object.assign({}, this);
delete copy.userData;
delete copy.article;
return copy;