diff --git a/server/models/Book.js b/server/models/Book.js index 415064de..d478587c 100644 --- a/server/models/Book.js +++ b/server/models/Book.js @@ -1,11 +1,28 @@ const { DataTypes, Model } = require('sequelize') const Logger = require('../Logger') +/** + * @typedef EBookFileObject + * @property {string} ino + * @property {string} ebookFormat + * @property {number} addedAt + * @property {number} updatedAt + * @property {{filename:string, ext:string, path:string, relPath:string, size:number, mtimeMs:number, ctimeMs:number, birthtimeMs:number}} metadata + */ + +/** + * @typedef ChapterObject + * @property {number} id + * @property {number} start + * @property {number} end + * @property {string} title + */ + class Book extends Model { constructor(values, options) { super(values, options) - /** @type {UUIDV4} */ + /** @type {string} */ this.id /** @type {string} */ this.title @@ -33,17 +50,17 @@ class Book extends Model { this.coverPath /** @type {number} */ this.duration - /** @type {Object} */ + /** @type {string[]} */ this.narrators /** @type {Object} */ this.audioFiles - /** @type {Object} */ + /** @type {EBookFileObject} */ this.ebookFile - /** @type {Object} */ + /** @type {ChapterObject[]} */ this.chapters - /** @type {Object} */ + /** @type {string[]} */ this.tags - /** @type {Object} */ + /** @type {string[]} */ this.genres /** @type {Date} */ this.updatedAt diff --git a/server/models/LibraryItem.js b/server/models/LibraryItem.js index 12e87448..c9bded99 100644 --- a/server/models/LibraryItem.js +++ b/server/models/LibraryItem.js @@ -4,12 +4,20 @@ const oldLibraryItem = require('../objects/LibraryItem') const libraryFilters = require('../utils/queries/libraryFilters') const { areEquivalent } = require('../utils/index') +/** + * @typedef LibraryFileObject + * @property {string} ino + * @property {boolean} isSupplementary + * @property {number} addedAt + * @property {number} updatedAt + * @property {{filename:string, ext:string, path:string, relPath:string, size:number, mtimeMs:number, ctimeMs:number, birthtimeMs:number}} metadata + */ class LibraryItem extends Model { constructor(values, options) { super(values, options) - /** @type {UUIDV4} */ + /** @type {string} */ this.id /** @type {string} */ this.ino @@ -17,7 +25,7 @@ class LibraryItem extends Model { this.path /** @type {string} */ this.relPath - /** @type {UUIDV4} */ + /** @type {string} */ this.mediaId /** @type {string} */ this.mediaType @@ -39,13 +47,13 @@ class LibraryItem extends Model { this.lastScan /** @type {string} */ this.lastScanVersion - /** @type {Object} */ + /** @type {LibraryFileObject[]} */ this.libraryFiles /** @type {Object} */ this.extraData - /** @type {UUIDV4} */ + /** @type {string} */ this.libraryId - /** @type {UUIDV4} */ + /** @type {string} */ this.libraryFolderId /** @type {Date} */ this.createdAt diff --git a/server/models/Podcast.js b/server/models/Podcast.js index 06b410cf..60311bfd 100644 --- a/server/models/Podcast.js +++ b/server/models/Podcast.js @@ -4,7 +4,7 @@ class Podcast extends Model { constructor(values, options) { super(values, options) - /** @type {UUIDV4} */ + /** @type {string} */ this.id /** @type {string} */ this.title @@ -42,9 +42,9 @@ class Podcast extends Model { this.maxEpisodesToKeep /** @type {string} */ this.coverPath - /** @type {Object} */ + /** @type {string[]} */ this.tags - /** @type {Object} */ + /** @type {string[]} */ this.genres /** @type {Date} */ this.createdAt diff --git a/server/models/PodcastEpisode.js b/server/models/PodcastEpisode.js index 2626ee0f..31fda60f 100644 --- a/server/models/PodcastEpisode.js +++ b/server/models/PodcastEpisode.js @@ -1,11 +1,19 @@ const { DataTypes, Model } = require('sequelize') const oldPodcastEpisode = require('../objects/entities/PodcastEpisode') +/** + * @typedef ChapterObject + * @property {number} id + * @property {number} start + * @property {number} end + * @property {string} title + */ + class PodcastEpisode extends Model { constructor(values, options) { super(values, options) - /** @type {UUIDV4} */ + /** @type {string} */ this.id /** @type {number} */ this.index @@ -33,11 +41,11 @@ class PodcastEpisode extends Model { this.publishedAt /** @type {Object} */ this.audioFile - /** @type {Object} */ + /** @type {ChapterObject[]} */ this.chapters /** @type {Object} */ this.extraData - /** @type {UUIDV4} */ + /** @type {string} */ this.podcastId /** @type {Date} */ this.createdAt