Moved schemas into objects/ definitions

This commit is contained in:
Nicholas Wallace 2024-02-25 18:32:04 +00:00
parent cc37c3d41f
commit cc53f16185
30 changed files with 3380 additions and 3241 deletions

View file

@ -2,6 +2,106 @@ const { AudioMimeType } = require('../../utils/constants')
const AudioMetaTags = require('../metadata/AudioMetaTags')
const FileMetadata = require('../metadata/FileMetadata')
/**
* @openapi
* components:
* schemas:
* audioFile:
* type: object
* properties:
* index:
* description: The index of the audio file.
* type: integer
* example: 1
* ino:
* description: The inode of the audio file.
* type: string
* example: '649644248522215260'
* metadata:
* $ref: '#/components/schemas/fileMetadata'
* addedAt:
* description: The time (in ms since POSIX epoch) when the audio file was added to the library.
* type: integer
* example: 1650621074131
* updatedAt:
* description: The time (in ms since POSIX epoch) when the audio file last updated. (Read Only)
* type: integer
* example: 1651830828023
* trackNumFromMeta:
* description: The track number of the audio file as pulled from the file's metadata. Will be null if unknown.
* type: [integer, 'null']
* example: 1
* discNumFromMeta:
* description: The disc number of the audio file as pulled from the file's metadata. Will be null if unknown.
* type: [string, 'null']
* trackNumFromFilename:
* description: The track number of the audio file as determined from the file's name. Will be null if unknown.
* type: [integer, 'null']
* example: 1
* discNumFromFilename:
* description: The track number of the audio file as determined from the file's name. Will be null if unknown.
* type: [string, 'null']
* manuallyVerified:
* description: Whether the audio file has been manually verified by a user.
* type: boolean
* example: false
* invalid:
* description: Whether the audio file is missing from the server.
* type: boolean
* example: false
* exclude:
* description: Whether the audio file has been marked for exclusion.
* type: boolean
* example: false
* error:
* description: Any error with the audio file. Will be null if there is none.
* type: [string, 'null']
* format:
* description: The format of the audio file.
* type: string
* example: MP2/3 (MPEG audio layer 2/3)
* duration:
* description: The total length (in seconds) of the audio file.
* type: number
* example: 6004.6675
* bitRate:
* description: The bit rate (in bit/s) of the audio file.
* type: integer
* example: 64000
* language:
* description: The language of the audio file.
* type: [string, 'null']
* codec:
* description: The codec of the audio file.
* type: string
* example: mp3
* timeBase:
* description: The time base of the audio file.
* type: string
* example: 1/14112000
* channels:
* description: The number of channels the audio file has.
* type: integer
* example: 2
* channelLayout:
* description: The layout of the audio file's channels.
* type: string
* example: stereo
* chapters:
* description: If the audio file is part of an audiobook, the chapters the file contains.
* type: array
* items:
* $ref: '#/components/schemas/bookChapter'
* embeddedCoverArt:
* description: The type of embedded cover art in the audio file. Will be null if none exists.
* type: [string, 'null']
* metaTags:
* $ref: '#/components/schemas/audioMetaTags'
* mimeType:
* description: The MIME type of the audio file.
* type: string
* example: audio/mpeg
*/
class AudioFile {
constructor(data) {
this.index = null

View file

@ -1,3 +1,39 @@
/**
* @openapi
* components:
* schemas:
* audioTrack:
* type: object
* properties:
* index:
* description: The index of the audio track.
* type: integer
* example: 1
* startOffset:
* description: When in the audio file (in seconds) the track starts.
* type: number
* example: 0
* duration:
* description: The length (in seconds) of the audio track.
* type: number
* example: 33854.905
* title:
* description: The filename of the audio file the audio track belongs to.
* type: string
* example: Wizards First Rule 01.mp3
* contentUrl:
* description: The URL path of the audio file.
* type: string
* example: >-
* /s/item/li_8gch9ve09orgn4fdz8/Terry Goodkind - SOT Bk01 - Wizards First
* Rule 01.mp3
* mimeType:
* description: The MIME type of the audio file.
* type: string
* example: audio/mpeg
* metadata:
* $ref: '#/components/schemas/fileMetadata'
*/
class AudioTrack {
constructor() {
this.index = null

View file

@ -1,5 +1,32 @@
const FileMetadata = require('../metadata/FileMetadata')
/**
* @openapi
* components:
* schemas:
* ebookFile:
* type: [object, 'null']
* properties:
* ino:
* description: The inode of the ebook file.
* type: string
* example: '9463162'
* metadata:
* $ref: '#/components/schemas/fileMetadata'
* ebookFormat:
* description: The ebook format of the ebook file.
* type: string
* example: epub
* addedAt:
* description: The time (in ms since POSIX epoch) when the library file was added.
* type: integer
* example: 1650621073750
* updatedAt:
* description: The time (in ms since POSIX epoch) when the library file was last updated.
* type: integer
* example: 1650621110769
*/
class EBookFile {
constructor(file) {
this.ino = null

View file

@ -3,6 +3,32 @@ const { getFileTimestampsWithIno, filePathToPOSIX } = require('../../utils/fileU
const globals = require('../../utils/globals')
const FileMetadata = require('../metadata/FileMetadata')
/**
* @openapi
* components:
* schemas:
* libraryFile:
* type: object
* properties:
* ino:
* description: The inode of the library file.
* type: string
* example: '649644248522215260'
* metadata:
* $ref: '#/components/schemas/fileMetadata'
* addedAt:
* description: The time (in ms since POSIX epoch) when the library file was added.
* type: integer
* example: 1650621052494
* updatedAt:
* description: The time (in ms since POSIX epoch) when the library file was last updated.
* type: integer
* example: 1650621052494
* fileType:
* description: The type of file that the library file is (audio, image, etc.).
* type: string
* example: audio
*/
class LibraryFile {
constructor(file) {
this.ino = null