obsidian-media-db-sync/src/models/MediaTypeModel.ts
Conor Meyers 39017bfa82 Add more detail to search results
Adds getSummary to the MediaTypeModel.ts abstract class, which allows individual models to give more detail to better allow people to pick the right result
2022-08-23 16:10:14 +01:00

32 lines
675 B
TypeScript

import {MediaType} from '../utils/MediaType';
export abstract class MediaTypeModel {
type: string;
subType: string;
title: string;
englishTitle: string;
year: string;
dataSource: string;
url: string;
id: string;
userData: object;
abstract getMediaType(): MediaType;
//a string that contains enough info to disambiguate from similar media
abstract getSummary(): string;
abstract getTags(): string[];
toMetaDataObject(): object {
return {...this.getWithOutUserData(), ...this.userData, tags: '#' + this.getTags().join('/')};
}
getWithOutUserData(): object {
const copy = JSON.parse(JSON.stringify(this));
delete copy.userData;
return copy;
}
}