Update jsdoc defs for models

This commit is contained in:
advplyr 2023-08-24 17:55:29 -05:00
parent e0dae44c7d
commit 1187f91063
4 changed files with 50 additions and 17 deletions

View File

@ -1,11 +1,28 @@
const { DataTypes, Model } = require('sequelize') const { DataTypes, Model } = require('sequelize')
const Logger = require('../Logger') 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 { class Book extends Model {
constructor(values, options) { constructor(values, options) {
super(values, options) super(values, options)
/** @type {UUIDV4} */ /** @type {string} */
this.id this.id
/** @type {string} */ /** @type {string} */
this.title this.title
@ -33,17 +50,17 @@ class Book extends Model {
this.coverPath this.coverPath
/** @type {number} */ /** @type {number} */
this.duration this.duration
/** @type {Object} */ /** @type {string[]} */
this.narrators this.narrators
/** @type {Object} */ /** @type {Object} */
this.audioFiles this.audioFiles
/** @type {Object} */ /** @type {EBookFileObject} */
this.ebookFile this.ebookFile
/** @type {Object} */ /** @type {ChapterObject[]} */
this.chapters this.chapters
/** @type {Object} */ /** @type {string[]} */
this.tags this.tags
/** @type {Object} */ /** @type {string[]} */
this.genres this.genres
/** @type {Date} */ /** @type {Date} */
this.updatedAt this.updatedAt

View File

@ -4,12 +4,20 @@ const oldLibraryItem = require('../objects/LibraryItem')
const libraryFilters = require('../utils/queries/libraryFilters') const libraryFilters = require('../utils/queries/libraryFilters')
const { areEquivalent } = require('../utils/index') 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 { class LibraryItem extends Model {
constructor(values, options) { constructor(values, options) {
super(values, options) super(values, options)
/** @type {UUIDV4} */ /** @type {string} */
this.id this.id
/** @type {string} */ /** @type {string} */
this.ino this.ino
@ -17,7 +25,7 @@ class LibraryItem extends Model {
this.path this.path
/** @type {string} */ /** @type {string} */
this.relPath this.relPath
/** @type {UUIDV4} */ /** @type {string} */
this.mediaId this.mediaId
/** @type {string} */ /** @type {string} */
this.mediaType this.mediaType
@ -39,13 +47,13 @@ class LibraryItem extends Model {
this.lastScan this.lastScan
/** @type {string} */ /** @type {string} */
this.lastScanVersion this.lastScanVersion
/** @type {Object} */ /** @type {LibraryFileObject[]} */
this.libraryFiles this.libraryFiles
/** @type {Object} */ /** @type {Object} */
this.extraData this.extraData
/** @type {UUIDV4} */ /** @type {string} */
this.libraryId this.libraryId
/** @type {UUIDV4} */ /** @type {string} */
this.libraryFolderId this.libraryFolderId
/** @type {Date} */ /** @type {Date} */
this.createdAt this.createdAt

View File

@ -4,7 +4,7 @@ class Podcast extends Model {
constructor(values, options) { constructor(values, options) {
super(values, options) super(values, options)
/** @type {UUIDV4} */ /** @type {string} */
this.id this.id
/** @type {string} */ /** @type {string} */
this.title this.title
@ -42,9 +42,9 @@ class Podcast extends Model {
this.maxEpisodesToKeep this.maxEpisodesToKeep
/** @type {string} */ /** @type {string} */
this.coverPath this.coverPath
/** @type {Object} */ /** @type {string[]} */
this.tags this.tags
/** @type {Object} */ /** @type {string[]} */
this.genres this.genres
/** @type {Date} */ /** @type {Date} */
this.createdAt this.createdAt

View File

@ -1,11 +1,19 @@
const { DataTypes, Model } = require('sequelize') const { DataTypes, Model } = require('sequelize')
const oldPodcastEpisode = require('../objects/entities/PodcastEpisode') const oldPodcastEpisode = require('../objects/entities/PodcastEpisode')
/**
* @typedef ChapterObject
* @property {number} id
* @property {number} start
* @property {number} end
* @property {string} title
*/
class PodcastEpisode extends Model { class PodcastEpisode extends Model {
constructor(values, options) { constructor(values, options) {
super(values, options) super(values, options)
/** @type {UUIDV4} */ /** @type {string} */
this.id this.id
/** @type {number} */ /** @type {number} */
this.index this.index
@ -33,11 +41,11 @@ class PodcastEpisode extends Model {
this.publishedAt this.publishedAt
/** @type {Object} */ /** @type {Object} */
this.audioFile this.audioFile
/** @type {Object} */ /** @type {ChapterObject[]} */
this.chapters this.chapters
/** @type {Object} */ /** @type {Object} */
this.extraData this.extraData
/** @type {UUIDV4} */ /** @type {string} */
this.podcastId this.podcastId
/** @type {Date} */ /** @type {Date} */
this.createdAt this.createdAt