Added comic book support
- Created a new model for comic books - Added comic vine support
This commit is contained in:
parent
9a81d70876
commit
3befc82b87
5 changed files with 174 additions and 0 deletions
67
src/models/ComicBookModel.ts
Normal file
67
src/models/ComicBookModel.ts
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
import { MediaType } from '../utils/MediaType';
|
||||
import type { ModelToData } from '../utils/Utils';
|
||||
import { mediaDbTag, migrateObject } from '../utils/Utils';
|
||||
import { MediaTypeModel } from './MediaTypeModel';
|
||||
|
||||
export type ComicBookData = ModelToData<ComicBookModel>;
|
||||
|
||||
export class ComicBookModel extends MediaTypeModel {
|
||||
creators: string[];
|
||||
publisher: string;
|
||||
plot: string;
|
||||
issues: number;
|
||||
image: string;
|
||||
onlineRating: number;
|
||||
status: string;
|
||||
released: boolean;
|
||||
publishedFrom: string;
|
||||
publishedTo: string;
|
||||
|
||||
userData: {
|
||||
read: boolean;
|
||||
lastRead: string;
|
||||
personalRating: number;
|
||||
};
|
||||
|
||||
constructor(obj: ComicBookData) {
|
||||
super();
|
||||
|
||||
this.creators = [];
|
||||
this.publisher = '';
|
||||
this.plot = '';
|
||||
this.issues = 0;
|
||||
this.image = '';
|
||||
this.onlineRating = 0;
|
||||
|
||||
this.released = false;
|
||||
this.status = '';
|
||||
this.publishedFrom = '';
|
||||
this.publishedTo = '';
|
||||
|
||||
this.userData = {
|
||||
read: false,
|
||||
lastRead: '',
|
||||
personalRating: 0,
|
||||
};
|
||||
|
||||
migrateObject(this, obj, this);
|
||||
|
||||
if (!obj.hasOwnProperty('userData')) {
|
||||
migrateObject(this.userData, obj, this.userData);
|
||||
}
|
||||
|
||||
this.type = this.getMediaType();
|
||||
}
|
||||
|
||||
getTags(): string[] {
|
||||
return [mediaDbTag, 'comicbook'];
|
||||
}
|
||||
|
||||
getMediaType(): MediaType {
|
||||
return MediaType.ComicBook;
|
||||
}
|
||||
|
||||
getSummary(): string {
|
||||
return this.englishTitle + ' (' + this.year + ') - ' + this.publisher;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue