diff --git a/server/models/Collection.js b/server/models/Collection.js index 8c97b143f..0e1f70227 100644 --- a/server/models/Collection.js +++ b/server/models/Collection.js @@ -2,53 +2,6 @@ const { DataTypes, Model, Sequelize } = require('sequelize') const oldCollection = require('../objects/Collection') -/** - * @openapi - * components: - * schemas: - * collectionBase: - * type: object - * description: A public collection of library items which can be ordered and has a description, base schema. - * properties: - * id: - * description: The ID of the collection. - * type: string - * libraryId: - * description: The ID of the library the collection belongs to. - * type: string - * name: - * description: The name of the collection. - * type: string - * description: - * description: The description of the collection. - * type: [string, null] - * lastUpdate: - * description: The time (in ms since POSIX epoch) when the collection was last updated. - * type: integer - * createdAt: - * description: The time (in ms since POSIX epoch) when the collection was created. - * type: integer - * collection: - * type: object - * description: A public collection of library items which can be ordered and has a description. - * allOf: - * - $ref: '#/components/schemas/collectionBase' - * - books: - * description: The books that belong to the collection. - * type: array - * items: - * $ref: '#/components/schemas/libraryItem' - * collectionExpanded: - * type: object - * description: A public collection of library items which can be ordered and has a description. Replaces `libraryItem` with `libraryItemExtended`. - * allOf: - * - $ref: '#/components/schemas/collectionBase' - * - books: - * description: The books that belong to the collection. - * type: array - * items: - * $ref: '#/components/schemas/libraryItemExpanded' - */ class Collection extends Model { constructor(values, options) { super(values, options) diff --git a/server/objects/Collection.js b/server/objects/Collection.js index 970d714b8..f5d6dc52f 100644 --- a/server/objects/Collection.js +++ b/server/objects/Collection.js @@ -1,5 +1,52 @@ const uuidv4 = require("uuid").v4 +/** + * @openapi + * components: + * schemas: + * collectionBase: + * type: object + * description: A public collection of library items which can be ordered and has a description, base schema. + * properties: + * id: + * description: The ID of the collection. + * type: string + * libraryId: + * description: The ID of the library the collection belongs to. + * type: string + * name: + * description: The name of the collection. + * type: string + * description: + * description: The description of the collection. + * type: [string, null] + * lastUpdate: + * description: The time (in ms since POSIX epoch) when the collection was last updated. + * type: integer + * createdAt: + * description: The time (in ms since POSIX epoch) when the collection was created. + * type: integer + * collection: + * type: object + * description: A public collection of library items which can be ordered and has a description. + * allOf: + * - $ref: '#/components/schemas/collectionBase' + * - books: + * description: The books that belong to the collection. + * type: array + * items: + * $ref: '#/components/schemas/libraryItem' + * collectionExpanded: + * type: object + * description: A public collection of library items which can be ordered and has a description. Replaces `libraryItem` with `libraryItemExtended`. + * allOf: + * - $ref: '#/components/schemas/collectionBase' + * - books: + * description: The books that belong to the collection. + * type: array + * items: + * $ref: '#/components/schemas/libraryItemExpanded' + */ class Collection { constructor(collection) { this.id = null