Created collectionBase schema

This commit is contained in:
Nicholas Wallace 2024-02-20 01:41:27 +00:00
parent 0d89076d42
commit a90e79657b
2 changed files with 52 additions and 80 deletions

View file

@ -331,9 +331,9 @@
},
"components": {
"schemas": {
"collection": {
"collectionBase": {
"type": "object",
"description": "A public collection of library items which can be ordered and has a description.",
"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.",
@ -354,13 +354,6 @@
null
]
},
"books": {
"description": "The books that belong to the collection.",
"type": "array",
"items": {
"$ref": "#/components/schemas/libraryItem"
}
},
"lastUpdate": {
"description": "The time (in ms since POSIX epoch) when the collection was last updated.",
"type": "integer"
@ -371,48 +364,41 @@
}
}
},
"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",
"properties": {
"id": {
"description": "The ID of the collection.",
"type": "string"
"description": "A public collection of library items which can be ordered and has a description. Replaces `libraryItem` with `libraryItemExtended`.",
"allOf": [
{
"$ref": "#/components/schemas/collectionBase"
},
"libraryId": {
"description": "The ID of the library the collection belongs to.",
"type": "string"
},
"userId": {
"description": "The ID of the user that created the collection.",
"type": "string"
},
"name": {
"description": "The name of the collection.",
"type": "string"
},
"description": {
"description": "The name of the collection.",
"type": [
"string",
"null"
]
},
"books": {
"description": "The books that belong to the collection.",
"type": "array",
"items": {
"$ref": "#/components/schemas/libraryItemExpanded"
{
"books": {
"description": "The books that belong to the collection.",
"type": "array",
"items": {
"$ref": "#/components/schemas/libraryItemExpanded"
}
}
},
"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"
}
}
]
},
"oldLibraryId": {
"type": "string",

View file

@ -6,9 +6,9 @@ const oldCollection = require('../objects/Collection')
* @openapi
* components:
* schemas:
* collection:
* collectionBase:
* type: object
* description: A public collection of library items which can be ordered and has a description.
* 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.
@ -22,46 +22,32 @@ const oldCollection = require('../objects/Collection')
* description:
* description: The description of the collection.
* type: [string, null]
* books:
* description: The books that belong to the collection.
* type: array
* items:
* $ref: '#/components/schemas/libraryItem'
* 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
* properties:
* id:
* description: The ID of the collection.
* type: string
* libraryId:
* description: The ID of the library the collection belongs to.
* type: string
* userId:
* description: The ID of the user that created the collection.
* type: string
* name:
* description: The name of the collection.
* type: string
* description:
* description: The name of the collection.
* type: [string, 'null']
* books:
* description: The books that belong to the collection.
* type: array
* items:
* $ref: '#/components/schemas/libraryItemExpanded'
* 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
* 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) {