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 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);