{ "openapi": "3.0.1", "info": { "title": "Animal House", "description": "A single API for the whole Animal House ecosystem", "version": "0.0.0" }, "externalDocs": { "description": "Find out more about our API", "url": "http://luca.tagliavini5.tw.cs.unibo.it/api/hello" }, "servers": [ { "url": "/api" } ], "tags": [ { "name": "auth", "description": "Endpoints for authentication across all sites" }, { "name": "user", "description": "Endpoints for user management" }, { "name": "image", "description": "Endpoints for image upload and retrieval" }, { "name": "game", "description": "APIs for the game frontend" }, { "name": "community", "description": "Interact with the community through a forum" }, { "name": "store", "description": "Manage orders and products" } ], "paths": { "/images/{id}": { "get": { "tags": [ "image" ], "summary": "Serve the required image", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "image/webp": { "schema": { "type": "string", "format": "binary" } } } }, "404": { "description": "Image not found" }, "500": { "description": "Internal server error" } } } }, "/images": { "put": { "tags": [ "image" ], "summary": "Upload a picture", "description": "Returns the UUID associated with the uploaded picture or an error if encountered", "requestBody": { "required": true, "content": { "image/*": { "schema": { "type": "string", "format": "binary" } } } }, "parameters": [ { "name": "quality", "in": "query", "schema": { "type": "number", "minimum": 0, "maximum": 100 } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" } } } } } }, "500": { "description": "Internal server error" } } } }, "/auth/id": { "get": { "tags": [ "auth" ], "summary": "Get a new UUID for a device", "description": "Returns an UUID for the current unauthorized session", "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" } } } } } } } } }, "/auth/register": { "post": { "tags": [ "auth" ], "summary": "Register a new account with username, password, and first name", "description": "Lets a user register a new account with the minimum data required, but allows to provide extra fields such as lastName and city. Returns a bearer JWT token", "requestBody": { "required": true, "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/User" }, { "type": "object", "properties": { "password": { "type": "string" } } }, { "type": "object", "properties": { "fromuuid": { "type": "string" } } }, { "required": [ "username", "password", "firstName" ] } ] } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "type": "object", "properties": { "token": { "type": "string", "format": "jwt" } } } } } }, "401": { "description": "Authentication is not required, an already logged in user cannot register a new account" }, "500": { "description": "Internal server error" } } } }, "/auth/login": { "post": { "tags": [ "auth" ], "summary": "Login with username and password", "description": "Lets a user login with its credentials and returns a JWT bearer token", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "username": { "type": "string" }, "password": { "type": "string" } } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "type": "object", "properties": { "token": { "type": "string", "format": "jwt" } } } } } }, "401": { "description": "Authentication is not required, an already logged in user cannot re-login" }, "500": { "description": "Internal server error" } } } }, "/auth/password": { "patch": { "tags": [ "auth" ], "summary": "Change the currently logged in user's password", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "password": { "type": "string", "format": "password" } } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "401": { "description": "Authentication required" }, "500": { "description": "Internal server error" } } } }, "/auth/me": { "get": { "tags": [ "auth" ], "summary": "Get the currently logged in user", "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "401": { "description": "Authentication required" }, "500": { "description": "Internal server error" } } }, "delete": { "tags": [ "auth" ], "summary": "Delete the currently logged in user", "responses": { "200": { "description": "Request fulfilled" }, "401": { "description": "Authentication required" }, "500": { "description": "Internal server error" } } }, "patch": { "tags": [ "auth" ], "summary": "Update your profile information", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "username": { "type": "string" }, "firstName": { "type": "string" }, "lastName": { "type": "string" }, "preferences": { "type": "array", "items": { "$ref": "#/components/schemas/Category" } }, "pets": { "type": "array", "items": { "$ref": "#/components/schemas/OwnedPet" } } } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "400": { "description": "Invalid input" }, "401": { "description": "Authentication required" }, "500": { "description": "Internal server error" } } } }, "/users": { "get": { "tags": [ "user" ], "summary": "Get all registered users", "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/Pagination" }, { "type": "object", "properties": { "docs": { "type": "array", "items": { "$ref": "#/components/schemas/User" } } } } ] } } } }, "401": { "description": "Authentication with high priviledges is required" }, "500": { "description": "Internal server error" } } } }, "/users/{id}": { "get": { "tags": [ "user" ], "summary": "Get a registered user", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "401": { "description": "Authentication with high priviledges is required" }, "500": { "description": "Internal server error" } } }, "patch": { "tags": [ "user" ], "summary": "Update a registered user's informations", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "401": { "description": "Authentication with high priviledges is required" }, "500": { "description": "Internal server error" } } }, "delete": { "tags": [ "user" ], "summary": "Delete a registered user", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled" }, "401": { "description": "Authentication with high priviledges is required" }, "500": { "description": "Internal server error" } } } }, "/game/score/{game}": { "patch": { "tags": [ "game" ], "summary": "Update your score for a given game", "parameters": [ { "name": "game", "in": "path", "required": true, "schema": { "$ref": "#/components/schemas/GameType" } }, { "name": "id", "in": "query", "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "description": "Value increment", "content": { "*/*": { "schema": { "type": "object", "properties": { "score": { "type": "number" } } } } }, "required": true }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GameScore" } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } }, "get": { "tags": [ "game" ], "summary": "Get your score for a given game", "parameters": [ { "name": "game", "in": "path", "required": true, "schema": { "$ref": "#/components/schemas/GameType" } }, { "name": "id", "in": "query", "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GameScore" } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } } }, "/game/leaderboard/{game}": { "get": { "tags": [ "game" ], "summary": "Get the leaderboard of all players for a given game with pagination", "parameters": [ { "name": "game", "in": "path", "required": true, "schema": { "$ref": "#/components/schemas/GameType" } }, { "name": "paginationQuery", "in": "query", "schema": { "$ref": "#/components/schemas/PaginationQuery" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/Pagination" }, { "type": "object", "properties": { "docs": { "type": "array", "items": { "$ref": "#/components/schemas/GameScore" } } } } ] } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } } }, "/community/boards/": { "get": { "tags": [ "community" ], "summary": "Get the forum structure, i.e. a listing of boards (subforums)", "parameters": [ { "name": "paginationQuery", "in": "query", "schema": { "$ref": "#/components/schemas/PaginationQuery" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/Pagination" }, { "type": "object", "properties": { "docs": { "type": "array", "items": { "$ref": "#/components/schemas/Board" } } } } ] } } } }, "500": { "description": "Internal server error" } } }, "put": { "tags": [ "community" ], "summary": "Create a new board for the community to post in", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" } } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Board" } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } } }, "/community/boards/{board}/": { "get": { "tags": [ "community" ], "summary": "Get a specific board, including a paging of its posts", "parameters": [ { "name": "board", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "name": "paginationQuery", "in": "query", "schema": { "$ref": "#/components/schemas/PaginationQuery" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/Pagination" }, { "$ref": "#/components/schemas/Board" }, { "type": "object", "properties": { "docs": { "type": "array", "items": { "$ref": "#/components/schemas/Post" } } } } ] } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } }, "put": { "tags": [ "community" ], "summary": "Post a new message in the specified board", "parameters": [ { "name": "board", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Post" } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Post" } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } }, "delete": { "tags": [ "community" ], "summary": "Delete a whole community board, including all of its posts", "parameters": [ { "name": "board", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled" }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } }, "patch": { "tags": [ "community" ], "summary": "Update an existing board name and description", "parameters": [ { "name": "board", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" } } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Board" } } } }, "400": { "description": "Invalid input" }, "404": { "description": "Board not found" }, "500": { "description": "Internal server error" } } } }, "/community/boards/{board}/{post}": { "delete": { "tags": [ "community" ], "summary": "Delete a single post", "parameters": [ { "name": "board", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "name": "post", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled" }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } }, "patch": { "tags": [ "community" ], "summary": "Edit a previously published post", "parameters": [ { "name": "board", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "name": "post", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Post" } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Post" } } } }, "400": { "description": "Invalid input" }, "404": { "description": "Post not found" }, "500": { "description": "Internal server error" } } } }, "/store/products/": { "get": { "tags": [ "store" ], "summary": "Get the products catalogue, i.e. a listing of every product", "parameters": [ { "name": "paginationQuery", "in": "query", "schema": { "$ref": "#/components/schemas/PaginationQuery" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/Pagination" }, { "type": "object", "properties": { "docs": { "type": "array", "items": { "$ref": "#/components/schemas/Product" } } } } ] } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } }, "put": { "tags": [ "store" ], "summary": "Insert a new product into the store", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "price": { "type": "number" }, "photos": { "type": "array", "items": { "type": "string", "format": "binary" } }, "category": { "type": "string", "format": "uuid" }, "subcategory": { "type": "string", "format": "uuid" } } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Product" } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } } }, "/store/random-products": { "get": { "tags": [ "store" ], "summary": "Get a random sample from the products listing", "parameters": [ { "name": "length", "in": "query", "schema": { "type": "integer", "description": "Number of products to query" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Product" } } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } } }, "/store/products/{product}": { "get": { "tags": [ "store" ], "summary": "Get a single product", "parameters": [ { "name": "product", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Product" } } } }, "400": { "description": "Invalid input" }, "404": { "description": "Product not found" }, "500": { "description": "Internal server error" } } }, "delete": { "tags": [ "store" ], "summary": "Deletes a product from the store", "parameters": [ { "name": "product", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled" }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } }, "patch": { "tags": [ "store" ], "summary": "Update an existing product in the store", "parameters": [ { "name": "product", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "price": { "type": "number" }, "photos": { "type": "array", "items": { "type": "string", "format": "binary" } } } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Product" } } } }, "400": { "description": "Invalid input" }, "404": { "description": "Product not found" }, "500": { "description": "Internal server error" } } } }, "/store/pets/": { "get": { "tags": [ "store" ], "summary": "Get the pets catalogue, i.e. a listing of every pet", "parameters": [ { "name": "paginationQuery", "in": "query", "schema": { "$ref": "#/components/schemas/PaginationQuery" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/Pagination" }, { "type": "object", "properties": { "docs": { "type": "array", "items": { "$ref": "#/components/schemas/StorePet" } } } } ] } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } }, "put": { "tags": [ "store" ], "summary": "Insert a new pet into the store", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "price": { "type": "number" }, "photos": { "type": "array", "items": { "type": "string", "format": "binary" } }, "category": { "type": "string", "format": "uuid" }, "subcategory": { "type": "string", "format": "uuid" } } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/StorePet" } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } } }, "/store/pets/{pet}": { "get": { "tags": [ "store" ], "summary": "Get a single pet from the store", "parameters": [ { "name": "pet", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/StorePet" } } } }, "400": { "description": "Invalid input" }, "404": { "description": "Product not found" }, "500": { "description": "Internal server error" } } }, "delete": { "tags": [ "store" ], "summary": "Remove a pet from the store", "parameters": [ { "name": "pet", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled" }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } }, "patch": { "tags": [ "store" ], "summary": "Update an existing pet in the store", "parameters": [ { "name": "pet", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "price": { "type": "number" }, "photos": { "type": "array", "items": { "type": "string", "format": "binary" } } } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/StorePet" } } } }, "400": { "description": "Invalid input" }, "404": { "description": "Product not found" }, "500": { "description": "Internal server error" } } } }, "/store/orders/": { "get": { "tags": [ "store" ], "summary": "Get a listing of the orders visible to you", "parameters": [ { "name": "paginationQuery", "in": "query", "schema": { "$ref": "#/components/schemas/PaginationQuery" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/Pagination" }, { "type": "object", "properties": { "docs": { "type": "array", "items": { "$ref": "#/components/schemas/Order" } } } } ] } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } }, "put": { "tags": [ "store" ], "summary": "Place a new order", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "array", "items": { "allOf": [ { "type": "string", "format": "uuid" }, { "type": "number", "format": "uint64" } ] } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Order" } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } } }, "/store/services/": { "get": { "tags": [ "store" ], "summary": "Get the services catalogue, i.e. a listing of every service (filtered search is available)", "parameters": [ { "name": "location", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "date", "in": "query", "required": false, "schema": { "type": "string", "format": "date" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/Pagination" }, { "type": "object", "properties": { "docs": { "type": "array", "items": { "$ref": "#/components/schemas/Service" } } } } ] } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } }, "put": { "tags": [ "store" ], "summary": "Insert a new service into the store", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "price": { "type": "number" }, "photos": { "type": "array", "items": { "type": "string", "format": "binary" } }, "more": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/Disponibility" } }, { "type": "object", "properties": { "url": { "type": "string" }, "calendar": { "$ref": "#/components/schemas/Calendar" } } } ] } } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Service" } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } } }, "/store/random-services": { "get": { "tags": [ "store" ], "summary": "Get a random sample from the services listing", "parameters": [ { "name": "length", "in": "query", "schema": { "type": "integer", "description": "Number of services to query" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Service" } } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } } }, "/store/services/{service}": { "get": { "tags": [ "store" ], "summary": "Get a single service", "parameters": [ { "name": "service", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Service" } } } }, "400": { "description": "Invalid input" }, "404": { "description": "Service not found" }, "500": { "description": "Internal server error" } } }, "delete": { "tags": [ "store" ], "summary": "Delete a service from the store", "parameters": [ { "name": "service", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled" }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } }, "patch": { "tags": [ "store" ], "summary": "Update an existing service in the store", "parameters": [ { "name": "service", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "price": { "type": "number" }, "photos": { "type": "array", "items": { "type": "string", "format": "binary" } }, "more": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/Disponibility" } }, { "type": "object", "properties": { "url": { "type": "string" }, "calendar": { "$ref": "#/components/schemas/Calendar" } } } ] } } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Product" } } } }, "400": { "description": "Invalid input" }, "404": { "description": "Product not found" }, "500": { "description": "Internal server error" } } } }, "/store/appointments/": { "get": { "tags": [ "store" ], "summary": "Get a listing of the appointments visible to you", "parameters": [ { "name": "paginationQuery", "in": "query", "schema": { "$ref": "#/components/schemas/PaginationQuery" } }, { "name": "service", "in": "query", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/Pagination" }, { "type": "object", "properties": { "docs": { "type": "array", "items": { "$ref": "#/components/schemas/Appointment" } } } } ] } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } }, "put": { "tags": [ "store" ], "summary": "Make a new appointment", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "service": { "type": "string", "format": "uuid" }, "calendar": { "type": "string" }, "from": { "type": "string", "format": "date-time" } } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Appointment" } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } } }, "/store/appointments/{appointment}": { "delete": { "tags": [ "store" ], "summary": "Cancel an appointment", "parameters": [ { "name": "appointment", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled" }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } } }, "/store/categories/": { "get": { "tags": [ "store" ], "summary": "Get the categories catalogue, i.e. a listing of every category", "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Category" } } } } }, "500": { "description": "Internal server error" } } }, "put": { "tags": [ "store" ], "summary": "Add a category to the catalogue", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" } } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Category" } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } } }, "/store/categories/{category}": { "get": { "tags": [ "store" ], "summary": "Get the specified category", "parameters": [ { "name": "category", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Category" } } } }, "404": { "description": "Category not found" }, "500": { "description": "Internal server error" } } }, "delete": { "tags": [ "store" ], "summary": "Delete a category from the store", "parameters": [ { "name": "category", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled" }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } }, "patch": { "tags": [ "store" ], "summary": "Edit a category in the catalogue", "parameters": [ { "name": "category", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" } } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Category" } } } }, "400": { "description": "Invalid input" }, "404": { "description": "Category not found" }, "500": { "description": "Internal server error" } } } }, "/store/categories/{category}/subcategories/": { "get": { "tags": [ "store" ], "summary": "Get a listing of the subcategories associated to a certain category", "parameters": [ { "name": "category", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Subcategory" } } } } }, "400": { "description": "Invalid input" }, "404": { "description": "Parent category not found" }, "500": { "description": "Internal server error" } } }, "put": { "tags": [ "store" ], "summary": "Add a subcategory to a category", "parameters": [ { "name": "category", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" } } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Subcategory" } } } }, "400": { "description": "Invalid input" }, "404": { "description": "Parent category not found" }, "500": { "description": "Internal server error" } } } }, "/store/subcategories/{subcategory}": { "get": { "tags": [ "store" ], "summary": "Get the specified subcategory", "parameters": [ { "name": "subcategory", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Subcategory" } } } }, "400": { "description": "Invalid input" }, "404": { "description": "Subcategory not found" }, "500": { "description": "Internal server error" } } }, "delete": { "tags": [ "store" ], "summary": "Delete a subcategory from the store", "parameters": [ { "name": "subcategory", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled" }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } }, "patch": { "tags": [ "store" ], "summary": "Edit a subcategory in the catalogue", "parameters": [ { "name": "subcategory", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" } } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Subcategory" } } } }, "400": { "description": "Invalid input" }, "404": { "description": "Subcategory not found" }, "500": { "description": "Internal server error" } } } }, "/store/stores/": { "get": { "tags": [ "store" ], "summary": "Get a listing of every shop location", "parameters": [ { "name": "paginationQuery", "in": "query", "schema": { "$ref": "#/components/schemas/PaginationQuery" } } ], "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/Pagination" }, { "type": "object", "properties": { "docs": { "type": "array", "items": { "$ref": "#/components/schemas/Store" } } } } ] } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } }, "put": { "tags": [ "store" ], "summary": "Register a new location", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "location": { "type": "string" } } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Store" } } } }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } } }, "/store/locations/{id}": { "delete": { "tags": [ "store" ], "summary": "Delete a location", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Request fulfilled" }, "400": { "description": "Invalid input" }, "500": { "description": "Internal server error" } } }, "patch": { "tags": [ "store" ], "summary": "Update an existing location", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "location": { "type": "string" } } } } } }, "responses": { "200": { "description": "Request fulfilled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Store" } } } }, "400": { "description": "Invalid input" }, "404": { "description": "Store not found" }, "500": { "description": "Internal server error" } } } } }, "components": { "schemas": { "Appointment": { "type": "object", "properties": { "_id": { "type": "string", "format": "uuid" }, "customer": { "$ref": "#/components/schemas/User" }, "service": { "$ref": "#/components/schemas/Service" }, "calendar": { "type": "string" }, "minutes": { "type": "number" } } }, "Board": { "type": "object", "properties": { "_id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "author": { "$ref": "#/components/schemas/User" } } }, "Calendar": { "type": "object", "properties": { "name": { "type": "string" }, "intervals": { "type": "array", "items": { "$ref": "#/components/schemas/Interval" } }, "slotDuration": { "type": "integer" }, "reservations": { "type": "array", "items": { "type": "string", "format": "date-time" } } } }, "Category": { "type": "object", "properties": { "_id": { "type": "number" }, "name": { "type": "string" } } }, "Disponibility": { "type": "object", "properties": { "_id": { "type": "string", "format": "uuid" }, "location": { "$ref": "#/components/schemas/Store" } } }, "GameScore": { "type": "object", "properties": { "_id": { "type": "string", "format": "uuid" }, "user": { "type": "string", "format": "uuid" }, "game": { "$ref": "#/components/schemas/GameType" }, "score": { "type": "number" } } }, "GameType": { "type": "string", "enum": [ "quiz" ] }, "Interval": { "type": "object", "properties": { "dayOfWeek": { "type": "number" }, "from": { "type": "array", "items": { "type": "number" } }, "to": { "type": "array", "items": { "type": "number" } } } }, "Order": { "type": "object", "properties": { "_id": { "type": "string", "format": "uuid" }, "entries": { "type": "array", "items": { "$ref": "#/components/schemas/OrderEntry" } }, "shipDate": { "type": "string", "format": "date-time" }, "status": { "type": "string", "enum": [ "placed", "approved", "rejected", "delivered" ] } } }, "OrderEntry": { "type": "object", "properties": { "product": { "$ref": "#/components/schemas/Product" }, "quantity": { "type": "number", "format": "uint64" } } }, "OwnedPet": { "type": "object", "properties": { "_id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "category": { "$ref": "#/components/schemas/Category" }, "subcategory": { "$ref": "#/components/schemas/Subcategory" } } }, "Pagination": { "type": "object", "properties": { "total": { "type": "number", "minimum": 0 }, "limit": { "type": "number", "minimum": 1 }, "page": { "type": "number", "minimum": 1 }, "pages": { "type": "number", "minimum": 1 } } }, "PaginationQuery": { "type": "object", "properties": { "limit": { "type": "integer", "minimum": 1, "maximum": 60, "default": 20 }, "page": { "type": "integer", "minimum": 1, "default": 1 }, "sort": { "type": "string" }, "order": { "$ref": "#/components/schemas/SortOrder" } } }, "Post": { "type": "object", "properties": { "_id": { "type": "string", "format": "uuid" }, "title": { "type": "string" }, "message": { "type": "string" }, "photos": { "type": "array", "items": { "type": "string", "format": "base64" } }, "author": { "$ref": "#/components/schemas/User" } } }, "Product": { "type": "object", "properties": { "_id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "description": { "type": "string" }, "price": { "type": "number" }, "disponibility": { "type": "number", "format": "uint64" }, "photos": { "type": "array", "items": { "type": "string", "format": "binary" } }, "category": { "$ref": "#/components/schemas/Category" }, "subcategory": { "$ref": "#/components/schemas/Subcategory" } } }, "Service": { "type": "object", "properties": { "_id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "description": { "type": "string" }, "price": { "type": "number" }, "photos": { "type": "array", "items": { "type": "string", "format": "binary" } }, "store": { "$ref": "#/components/schemas/Store" }, "disponibilities": { "type": "array", "items": { "$ref": "#/components/schemas/Calendar" } } } }, "Store": { "type": "object", "properties": { "_id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "online": { "type": "boolean" }, "location": { "type": "array", "items": { "type": "number", "format": "float" } }, "timetable": { "$ref": "#/components/schemas/Calendar" } } }, "StorePet": { "type": "object", "properties": { "_id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "description": { "type": "string" }, "price": { "type": "number" }, "photos": { "type": "array", "items": { "type": "string", "format": "binary" } }, "category": { "$ref": "#/components/schemas/Category" }, "subcategory": { "$ref": "#/components/schemas/Subcategory" } } }, "SortOrder": { "type": "number", "enum": [ -1, 1 ] }, "Subcategory": { "type": "object", "properties": { "_id": { "type": "number", "format": "uint64" }, "name": { "type": "string" } } }, "User": { "type": "object", "properties": { "_id": { "type": "string", "format": "uuid" }, "username": { "type": "string" }, "firstName": { "type": "string" }, "lastName": { "type": "string" }, "level": { "type": "integer", "description": "User subscription or role", "enum": [ 0, 1, 2 ] }, "preferences": { "type": "array", "items": { "$ref": "#/components/schemas/Category" } }, "pets": { "type": "array", "items": { "$ref": "#/components/schemas/OwnedPet" } } } } } } }