big changes; we have a good TS config now

This commit is contained in:
Moritz Jung 2025-01-14 22:30:28 +01:00
parent cbbaf54b33
commit 4497991344
54 changed files with 750 additions and 671 deletions

View file

@ -1,6 +1,8 @@
import { MediaTypeModel } from './MediaTypeModel';
import { mediaDbTag, migrateObject } from '../utils/Utils';
import { MediaType } from '../utils/MediaType';
import { mediaDbTag, migrateObject, type ModelToData } from '../utils/Utils';
import { MediaTypeModel } from './MediaTypeModel';
export type BoardGameData = ModelToData<BoardGameModel>;
export class BoardGameModel extends MediaTypeModel {
genres: string[];
@ -19,23 +21,23 @@ export class BoardGameModel extends MediaTypeModel {
personalRating: number;
};
constructor(obj: any = {}) {
constructor(obj: BoardGameData) {
super();
this.genres = undefined;
this.onlineRating = undefined;
this.minPlayers = undefined;
this.maxPlayers = undefined;
this.playtime = undefined;
this.publishers = undefined;
this.complexityRating = undefined;
this.image = undefined;
this.genres = [];
this.onlineRating = 0;
this.complexityRating = 0;
this.minPlayers = 0;
this.maxPlayers = 0;
this.playtime = '';
this.publishers = [];
this.image = '';
this.released = undefined;
this.released = false;
this.userData = {
played: undefined,
personalRating: undefined,
played: false,
personalRating: 0,
};
migrateObject(this, obj, this);

View file

@ -1,6 +1,8 @@
import { MediaTypeModel } from './MediaTypeModel';
import { mediaDbTag, migrateObject } from '../utils/Utils';
import { MediaType } from '../utils/MediaType';
import { mediaDbTag, migrateObject, type ModelToData } from '../utils/Utils';
import { MediaTypeModel } from './MediaTypeModel';
export type BookData = ModelToData<BookModel>;
export class BookModel extends MediaTypeModel {
author: string;
@ -8,7 +10,6 @@ export class BookModel extends MediaTypeModel {
pages: number;
image: string;
onlineRating: number;
english_title: string;
isbn: number;
isbn13: number;
@ -20,22 +21,23 @@ export class BookModel extends MediaTypeModel {
personalRating: number;
};
constructor(obj: any = {}) {
constructor(obj: BookData) {
super();
this.author = undefined;
this.pages = undefined;
this.image = undefined;
this.onlineRating = undefined;
this.isbn = undefined;
this.isbn13 = undefined;
this.author = '';
this.plot = '';
this.pages = 0;
this.image = '';
this.onlineRating = 0;
this.isbn = 0;
this.isbn13 = 0;
this.released = undefined;
this.released = false;
this.userData = {
read: undefined,
lastRead: undefined,
personalRating: undefined,
read: false,
lastRead: '',
personalRating: 0,
};
migrateObject(this, obj, this);

View file

@ -1,6 +1,8 @@
import { MediaTypeModel } from './MediaTypeModel';
import { mediaDbTag, migrateObject } from '../utils/Utils';
import { MediaType } from '../utils/MediaType';
import { mediaDbTag, migrateObject, type ModelToData } from '../utils/Utils';
import { MediaTypeModel } from './MediaTypeModel';
export type GameData = ModelToData<GameModel>;
export class GameModel extends MediaTypeModel {
developers: string[];
@ -17,19 +19,21 @@ export class GameModel extends MediaTypeModel {
personalRating: number;
};
constructor(obj: any = {}) {
constructor(obj: GameData) {
super();
this.developers = undefined;
this.publishers = undefined;
this.genres = undefined;
this.onlineRating = undefined;
this.image = undefined;
this.released = undefined;
this.releaseDate = undefined;
this.developers = [];
this.publishers = [];
this.genres = [];
this.onlineRating = 0;
this.image = '';
this.released = false;
this.releaseDate = '';
this.userData = {
played: undefined,
personalRating: undefined,
played: false,
personalRating: 0,
};
migrateObject(this, obj, this);

View file

@ -1,19 +1,12 @@
import { MediaTypeModel } from './MediaTypeModel';
import { mediaDbTag, migrateObject } from '../utils/Utils';
import { MediaType } from '../utils/MediaType';
import { mediaDbTag, migrateObject, type ModelToData } from '../utils/Utils';
import { MediaTypeModel } from './MediaTypeModel';
export type MangaData = ModelToData<MangaModel>;
export class MangaModel extends MediaTypeModel {
type: string;
subType: string;
title: string;
plot: string;
englishTitle: string;
alternateTitles: string[];
year: string;
dataSource: string;
url: string;
id: string;
genres: string[];
authors: string[];
chapters: number;
@ -32,27 +25,27 @@ export class MangaModel extends MediaTypeModel {
personalRating: number;
};
constructor(obj: any = {}) {
constructor(obj: MangaData) {
super();
this.plot = undefined;
this.genres = undefined;
this.authors = undefined;
this.alternateTitles = undefined;
this.chapters = undefined;
this.volumes = undefined;
this.onlineRating = undefined;
this.image = undefined;
this.plot = '';
this.alternateTitles = [];
this.genres = [];
this.authors = [];
this.chapters = 0;
this.volumes = 0;
this.onlineRating = 0;
this.image = '';
this.released = undefined;
this.status = undefined;
this.publishedFrom = undefined;
this.publishedTo = undefined;
this.released = false;
this.status = '';
this.publishedFrom = '';
this.publishedTo = '';
this.userData = {
watched: undefined,
lastWatched: undefined,
personalRating: undefined,
watched: false,
lastWatched: '',
personalRating: 0,
};
migrateObject(this, obj, this);

View file

@ -1,4 +1,4 @@
import { MediaType } from '../utils/MediaType';
import type { MediaType } from '../utils/MediaType';
export abstract class MediaTypeModel {
type: string;
@ -13,14 +13,14 @@ export abstract class MediaTypeModel {
userData: object;
protected 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.type = '';
this.subType = '';
this.title = '';
this.englishTitle = '';
this.year = '';
this.dataSource = '';
this.url = '';
this.id = '';
this.userData = {};
}

View file

@ -1,6 +1,8 @@
import { MediaTypeModel } from './MediaTypeModel';
import { mediaDbTag, migrateObject } from '../utils/Utils';
import { MediaType } from '../utils/MediaType';
import { mediaDbTag, migrateObject, type ModelToData } from '../utils/Utils';
import { MediaTypeModel } from './MediaTypeModel';
export type MovieData = ModelToData<MovieModel>;
export class MovieModel extends MediaTypeModel {
plot: string;
@ -23,27 +25,27 @@ export class MovieModel extends MediaTypeModel {
personalRating: number;
};
constructor(obj: any = {}) {
constructor(obj: MovieData) {
super();
this.plot = undefined;
this.genres = undefined;
this.director = undefined;
this.writer = undefined;
this.studio = undefined;
this.duration = undefined;
this.onlineRating = undefined;
this.actors = undefined;
this.image = undefined;
this.plot = '';
this.genres = [];
this.director = [];
this.writer = [];
this.studio = [];
this.duration = '';
this.onlineRating = 0;
this.actors = [];
this.image = '';
this.released = undefined;
this.streamingServices = undefined;
this.premiere = undefined;
this.released = false;
this.streamingServices = [];
this.premiere = '';
this.userData = {
watched: undefined,
lastWatched: undefined,
personalRating: undefined,
watched: false,
lastWatched: '',
personalRating: 0,
};
migrateObject(this, obj, this);

View file

@ -1,35 +1,28 @@
import { MediaTypeModel } from './MediaTypeModel';
import { mediaDbTag, migrateObject } from '../utils/Utils';
import { MediaType } from '../utils/MediaType';
import { mediaDbTag, migrateObject, type ModelToData } from '../utils/Utils';
import { MediaTypeModel } from './MediaTypeModel';
export type MusicReleaseData = ModelToData<MusicReleaseModel>;
export class MusicReleaseModel extends MediaTypeModel {
type: string;
subType: string;
title: string;
englishTitle: string;
year: string;
dataSource: string;
url: string;
id: string;
image: string;
genres: string[];
artists: string[];
image: string;
rating: number;
userData: {
personalRating: number;
};
constructor(obj: any = {}) {
constructor(obj: MusicReleaseData) {
super();
this.genres = undefined;
this.artists = undefined;
this.image = undefined;
this.rating = undefined;
this.genres = [];
this.artists = [];
this.image = '';
this.rating = 0;
this.userData = {
personalRating: undefined,
personalRating: 0,
};
migrateObject(this, obj, this);

View file

@ -1,17 +1,10 @@
import { MediaTypeModel } from './MediaTypeModel';
import { mediaDbTag, migrateObject } from '../utils/Utils';
import { MediaType } from '../utils/MediaType';
import { mediaDbTag, migrateObject, type ModelToData } from '../utils/Utils';
import { MediaTypeModel } from './MediaTypeModel';
export type SeriesData = ModelToData<SeriesModel>;
export class SeriesModel extends MediaTypeModel {
type: string;
subType: string;
title: string;
englishTitle: string;
year: string;
dataSource: string;
url: string;
id: string;
plot: string;
genres: string[];
writer: string[];
@ -34,29 +27,29 @@ export class SeriesModel extends MediaTypeModel {
personalRating: number;
};
constructor(obj: any = {}) {
constructor(obj: SeriesData) {
super();
this.plot = undefined;
this.genres = undefined;
this.writer = undefined;
this.studio = undefined;
this.episodes = undefined;
this.duration = undefined;
this.onlineRating = undefined;
this.actors = undefined;
this.image = undefined;
this.plot = '';
this.genres = [];
this.writer = [];
this.studio = [];
this.episodes = 0;
this.duration = '';
this.onlineRating = 0;
this.actors = [];
this.image = '';
this.released = undefined;
this.streamingServices = undefined;
this.airing = undefined;
this.airedFrom = undefined;
this.airedTo = undefined;
this.released = false;
this.streamingServices = [];
this.airing = false;
this.airedFrom = '';
this.airedTo = '';
this.userData = {
watched: undefined,
lastWatched: undefined,
personalRating: undefined,
watched: false,
lastWatched: '',
personalRating: 0,
};
migrateObject(this, obj, this);

View file

@ -1,17 +1,10 @@
import { MediaTypeModel } from './MediaTypeModel';
import { mediaDbTag, migrateObject } from '../utils/Utils';
import { MediaType } from '../utils/MediaType';
import { mediaDbTag, migrateObject, type ModelToData } from '../utils/Utils';
import { MediaTypeModel } from './MediaTypeModel';
export type WikiData = ModelToData<WikiModel>;
export class WikiModel extends MediaTypeModel {
type: string;
subType: string;
title: string;
englishTitle: string;
year: string;
dataSource: string;
url: string;
id: string;
wikiUrl: string;
lastUpdated: string;
length: number;
@ -19,13 +12,13 @@ export class WikiModel extends MediaTypeModel {
userData: Record<string, unknown>;
constructor(obj: any = {}) {
constructor(obj: WikiData) {
super();
this.wikiUrl = undefined;
this.lastUpdated = undefined;
this.length = undefined;
this.article = undefined;
this.wikiUrl = '';
this.lastUpdated = '';
this.length = 0;
this.article = '';
this.userData = {};
migrateObject(this, obj, this);