Skip to content

Commit

Permalink
Merge pull request #508 from leepeuker/add-played-rest-api
Browse files Browse the repository at this point in the history
 Add played api enpdoints
  • Loading branch information
leepeuker authored Sep 14, 2023
2 parents 251d8e2 + 4509a80 commit 9e44d02
Show file tree
Hide file tree
Showing 16 changed files with 993 additions and 46 deletions.
344 changes: 344 additions & 0 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,350 @@
}
]
}
},
"\/users\/{username}\/played\/movies": {
"get": {
"tags": [
"Played"
],
"summary": "Get played movies of user",
"description": "Get all played movies and their watch dates.",
"parameters": [
{
"name": "username",
"in": "path",
"description": "Name of user",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "search",
"in": "query",
"description": "Search term",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "page",
"in": "query",
"description": "Page",
"required": false,
"schema": {
"type": "integer",
"default": 1
}
},
{
"name": "limit",
"in": "query",
"description": "Limit",
"required": false,
"schema": {
"type": "integer",
"default": 24
}
},
{
"name": "sortBy",
"in": "query",
"description": "Sort by",
"required": false,
"schema": {
"type": "string",
"default": "title",
"enum": [
"addedAt",
"rating",
"releaseDate",
"runtime",
"title"
]
}
},
{
"name": "sortOrder",
"in": "query",
"description": "Sort order",
"required": false,
"schema": {
"type": "string",
"default": "asc",
"enum": [
"asc",
"desc"
]
}
},
{
"name": "releaseYear",
"in": "query",
"description": "Release year",
"required": false,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application\/json": {
"schema": {
"type": "object",
"properties": {
"played": {
"type": "array",
"items": {
"type": "object",
"properties": {
"movie": {
"$ref": "#/components/schemas/movie"
},
"watchedDates": {
"type": "array",
"items": {
"type": "object",
"properties": {
"date": {
"$ref": "#/components/schemas/dateNullable"
},
"plays": {
"$ref": "#/components/schemas/plays"
},
"comment": {
"$ref": "#/components/schemas/comment"
}
}
}
}
}
}
},
"currentPage": {
"type": "integer",
"example": 1
},
"maxPage": {
"type": "integer",
"example": 10
}
}
}
}
}
},
"403": {
"$ref": "#/components/responses/403"
},
"404": {
"$ref": "#/components/responses/404"
}
},
"security": [
{
"authToken": []
}
]
},
"post": {
"tags": [
"Played"
],
"summary": "Add movie plays to user",
"description": "Create or update the provided watch dates for the specified movies.",
"parameters": [
{
"name": "username",
"in": "path",
"description": "Name of user",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application\/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"movaryId": {
"$ref": "#/components/schemas/id"
},
"watchDates": {
"type": "array",
"items": {
"type": "object",
"properties": {
"watchedAt": {
"$ref": "#/components/schemas/dateNullable"
},
"plays": {
"$ref": "#/components/schemas/playsOptional"
},
"comment": {
"$ref": "#/components/schemas/commentOptional"
}
}
}
}
}
}
}
}
}
},
"responses": {
"204": {
"$ref": "#/components/responses/204"
},
"403": {
"$ref": "#/components/responses/403"
},
"404": {
"$ref": "#/components/responses/404"
}
},
"security": [
{
"authToken": []
}
]
},
"put": {
"tags": [
"Played"
],
"summary": "Replace movie plays for user",
"description": "Create or replace the provided watch dates for the specified movies.",
"parameters": [
{
"name": "username",
"in": "path",
"description": "Name of user",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application\/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"movaryId": {
"$ref": "#/components/schemas/id"
},
"watchDates": {
"type": "array",
"items": {
"type": "object",
"properties": {
"watchedAt": {
"$ref": "#/components/schemas/dateNullable"
},
"plays": {
"$ref": "#/components/schemas/plays"
},
"comment": {
"$ref": "#/components/schemas/comment"
}
}
}
}
}
}
}
}
}
},
"responses": {
"204": {
"$ref": "#/components/responses/204"
},
"403": {
"$ref": "#/components/responses/403"
},
"404": {
"$ref": "#/components/responses/404"
}
},
"security": [
{
"authToken": []
}
]
},
"delete": {
"tags": [
"Played"
],
"summary": "Delete movie plays from user",
"description": "Delete all watch dates of specified movies if no specific watch dates are provided.",
"parameters": [
{
"name": "username",
"in": "path",
"description": "Name of user",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application\/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"movaryId": {
"$ref": "#/components/schemas/id"
},
"watchDates": {
"type": "array",
"items": {
"$ref": "#/components/schemas/dateNullable"
},
"required": false
}
}
}
}
}
}
},
"responses": {
"204": {
"$ref": "#/components/responses/204"
},
"403": {
"$ref": "#/components/responses/403"
},
"404": {
"$ref": "#/components/responses/404"
}
},
"security": [
{
"authToken": []
}
]
}
}
},
"components": {
Expand Down
Loading

0 comments on commit 9e44d02

Please sign in to comment.