{ "openapi" : "3.0.3", "info" : { "title" : "joglog api", "version" : "0.0.1-dev", "description" : "JogLog API documentation" }, "servers" : [ { "url" : "http://localhost:8081" } ], "paths" : { "/times" : { "get" : { "description" : "List all times", "responses" : { "200" : { "description" : "List of all times (for specific user if not admin)", "content" : { "application/json" : { "schema" : { "type" : "array", "items" : { "$ref" : "#/components/schemas/NmJoglogApiV0ModelsTime" } } } } }, "403" : { "description" : "Forbidden error if user is not authenticated", "content" : { "application/json" : { "schema" : { "type" : "string" } } } } } }, "post" : { "description" : "Create a time entry", "requestBody" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/TimeMinimal" } } }, "required" : true }, "responses" : { "201" : { "description" : "Created time entry", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/NmJoglogApiV0ModelsTime" } } } }, "400" : { "description" : "Bad request error", "content" : { "application/json" : { "schema" : { "type" : "string" } } } }, "403" : { "description" : "Forbidden error if user is not authenticated", "content" : { "application/json" : { "schema" : { "type" : "string" } } } } } }, "patch" : { "description" : "Patch a time entry", "requestBody" : { "content" : { "application/json" : { "schema" : { "type" : "array", "items" : { "$ref" : "#/components/schemas/TimePatchEntry" } } } }, "required" : true }, "responses" : { "200" : { "description" : "Updated time entry", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/NmJoglogApiV0ModelsTime" } } } }, "403" : { "description" : "Forbidden error if user role is not admin or himself", "content" : { "application/json" : { "schema" : { "type" : "string" } } } } } } }, "/times/{id}" : { "get" : { "description" : "Get a specific time entry", "parameters" : [ { "name" : "id", "in" : "path", "description" : "Time entry ID", "required" : true, "schema" : { "type" : "integer", "format" : "int32" } } ], "responses" : { "200" : { "description" : "Selected User", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/NmJoglogApiV0ModelsTime" } } } }, "403" : { "description" : "Forbidden error if user role is not admin or user doesn't own this time entry", "content" : { "application/json" : { "schema" : { "type" : "string" } } } }, "404" : { "description" : "Not found error", "content" : { "application/json" : { "schema" : { "type" : "string" } } } } } }, "delete" : { "description" : "Remove a specific time entry", "parameters" : [ { "name" : "id", "in" : "path", "description" : "Time ID", "required" : true, "schema" : { "type" : "integer", "format" : "int32" } } ], "responses" : { "200" : { "description" : "Removed Time entry", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/NmJoglogApiV0ModelsTime" } } } }, "403" : { "description" : "Forbidden error if user role is not admin or himself", "content" : { "application/json" : { "schema" : { "type" : "string" } } } }, "404" : { "description" : "Not found error", "content" : { "application/json" : { "schema" : { "type" : "string" } } } } } } }, "/users" : { "get" : { "description" : "List all users", "responses" : { "200" : { "description" : "List of all users", "content" : { "application/json" : { "schema" : { "type" : "array", "items" : { "$ref" : "#/components/schemas/NmJoglogApiV0ModelsUser" } } } } }, "403" : { "description" : "Forbidden error if user role is not admin or manager", "content" : { "application/json" : { "schema" : { "type" : "string" } } } } } }, "post" : { "description" : "Create a user", "requestBody" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/UserMinimal" } } }, "required" : true }, "responses" : { "201" : { "description" : "Created user", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/NmJoglogApiV0ModelsUser" } } } }, "400" : { "description" : "Bad request error (username exists or doesn't pass regexp test)", "content" : { "application/json" : { "schema" : { "type" : "string" } } } }, "403" : { "description" : "Forbidden error if user is authenticated", "content" : { "application/json" : { "schema" : { "type" : "string" } } } } } }, "patch" : { "description" : "Patch a user", "requestBody" : { "content" : { "application/json" : { "schema" : { "type" : "array", "items" : { "$ref" : "#/components/schemas/UserPatchEntry" } } } }, "required" : true }, "responses" : { "200" : { "description" : "Updated user", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/NmJoglogApiV0ModelsUser" } } } }, "403" : { "description" : "Forbidden error if user role is not admin, manager or himself", "content" : { "application/json" : { "schema" : { "type" : "string" } } } } } } }, "/users/authenticate" : { "post" : { "description" : "Authentication", "requestBody" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/UserMinimal" } } }, "required" : true }, "responses" : { "201" : { "description" : "JWT Token", "content" : { "application/json" : { "schema" : { "type" : "string" } } } }, "403" : { "description" : "Forbidden error if authentication failed", "content" : { "application/json" : { "schema" : { "type" : "string" } } } } } } }, "/users/{id}" : { "get" : { "description" : "Get a specific user", "parameters" : [ { "name" : "id", "in" : "path", "description" : "User ID", "required" : true, "schema" : { "type" : "integer", "format" : "int32" } } ], "responses" : { "200" : { "description" : "Selected User", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/NmJoglogApiV0ModelsUser" } } } }, "403" : { "description" : "Forbidden error if user role is not admin, manager or himself", "content" : { "application/json" : { "schema" : { "type" : "string" } } } }, "404" : { "description" : "Not found error", "content" : { "application/json" : { "schema" : { "type" : "string" } } } } } }, "delete" : { "description" : "Remove a specific user", "parameters" : [ { "name" : "id", "in" : "path", "description" : "User ID", "required" : true, "schema" : { "type" : "integer", "format" : "int32" } } ], "responses" : { "200" : { "description" : "Removed User", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/NmJoglogApiV0ModelsUser" } } } }, "403" : { "description" : "Forbidden error if user role is not admin, manager or himself", "content" : { "application/json" : { "schema" : { "type" : "string" } } } }, "404" : { "description" : "Not found error", "content" : { "application/json" : { "schema" : { "type" : "string" } } } } } } } }, "components" : { "schemas" : { "NmJoglogApiV0ModelsUser" : { "description" : "User", "type" : "object", "required" : [ "id", "username", "role", "createdAt", "updatedAt" ], "properties" : { "id" : { "description" : "Unique user id", "type" : "integer", "format" : "int32" }, "username" : { "description" : "Username", "type" : "string" }, "role" : { "$ref" : "#/components/schemas/UserRole", "description" : "User Role" }, "createdAt" : { "description" : "Creation date-time", "type" : "string", "format" : "date-time" }, "updatedAt" : { "description" : "Last update date-time", "type" : "string", "format" : "date-time" } } }, "NmJoglogApiV0ModelsTime" : { "description" : "Time entry", "type" : "object", "required" : [ "id", "distance", "time", "createdAt", "updatedAt" ], "properties" : { "id" : { "description" : "Unique time id", "type" : "integer", "format" : "int32" }, "distance" : { "description" : "Distance in meters", "type" : "integer", "format" : "int32" }, "time" : { "description" : "Time in seconds", "type" : "integer", "format" : "int32" }, "createdAt" : { "description" : "Creation date-time", "type" : "string", "format" : "date-time" }, "updatedAt" : { "description" : "Last update date-time", "type" : "string", "format" : "date-time" } } }, "NmJoglogApiV0EnumsStringOrInteger" : { "description" : "Integer for ID or string for any other", "type" : "string", "enum" : [ "string", "integer" ] } }, "securitySchemes" : { "bearerAuth" : { "type" : "http", "description" : "A base64-encoded JWT token looking like 'Authorization : Bearer {token}'", "scheme" : "bearer" } } }, "security" : [ { "bearerAuth" : [ ] } ] }