{"openapi":"3.1.0","info":{"title":"AAF - ReadBooks Online","version":"1.0.0","description":"This is the backend API for ReadBooks Online ordering system","contact":{"name":"Conor Grocock","url":"https://grocock.email","email":"Conor.Grocock@students.shu.ac.uk"}},"servers":[{"url":"http://localhost:3000/"}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-token"},"JwtAuthentication":{"type":"apiKey","in":"header","name":"x-access-token"}},"responses":{"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"UnauthorizedError":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","properties":{"message":{"type":"string"}}},"ApiKey":{"type":"object","properties":{"user":{"type":"object","$ref":"#/components/schemas/User"},"key":{"type":"string","format":"uuid"},"lastUsed":{"type":"string","format":"date-time"}}},"Group":{"type":"object","properties":{"id":{"type":"integer","description":"The group ID.","example":0},"name":{"type":"string","description":"The group name.","example":"Standard Group"},"permissions":{"type":"array","items":{"$ref":"#/components/schemas/Permission"}}}},"Permission":{"type":"object","properties":{"name":{"type":"string","description":"The name of the permission, that can be shown to the user.","example":"Ticket","required":true},"key":{"type":"string","description":"The key of the permission, used internally to refer to it","example":"ticket","required":true},"parent":{"type":"object","description":"The key of the parent permission, used internally to refer to it","schema":{"$ref":"#/components/schemas/Permission"}}}},"Status":{"type":"string","description":"Status of the operation.","enum":["OPEN","NOT_STARTED","IN_PROGRESS","ON_HOLD","CANCELLED","COMPLETED"]},"Ticket":{"type":"object","properties":{"name":{"type":"string","example":"Ticket 1","description":"The name of the ticket","required":true},"description":{"type":"string","example":"This is the first ticket","description":"The description of the ticket","required":true},"status":{"type":"string","example":"OPEN","description":"The status of the ticket","required":true,"schema":{"$ref":"#/components/schemas/Status"}}}},"User":{"type":"object","properties":{"username":{"type":"string","description":"The name of user","example":"Conor Grocock","required":true},"password":{"type":"string","description":"The password of user"},"groups":{"type":"array","items":{"$ref":"#/components/schemas/Group"}}}}},"requests":{"GetAllRequest":{"parameters":[{"in":"query","name":"limit","required":false,"description":"The maximum number of results to return.","schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"skip","required":false,"description":"The number of results to skip.","schema":{"type":"integer","minimum":1}}]}}},"security":[{"ApiKeyAuth":[]}],"paths":{"/":{"get":{"description":"Returns details about the server, with a health check.","security":[],"responses":{"200":{"description":"Server is up and running."},"500":{"description":"Server is having issues"}}}},"/ticket/":{"get":{"summary":"Get All tickets","tags":["Ticket"],"security":[{"ApiKeyAuth":[]},{"JwtAuthentication":[]}],"parameters":[{"name":"skip","description":"Tickets to skip for pagination.","in":"query","required":true,"schema":{"type":"integer"}},{"name":"limit","description":"Number of tickets to return.","in":"query","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Test","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ticket"}}}}},"$ref":"#/components/requests/GetAllRequest"},"post":{"summary":"Create a ticket","tags":["Ticket"],"security":[{"ApiKeyAuth":[]},{"JwtAuthentication":[]}],"requestBody":{"description":"Ticket object","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ticket"}}}},"responses":{"201":{"description":"Ticket created"},"401":{"description":"Unauthorized"}}}},"/ticket/{id}":{"get":{"summary":"Get a ticket","tags":["Ticket"],"security":[{"ApiKeyAuth":[]},{"JwtAuthentication":[]}],"parameters":[{"name":"id","description":"Ticket's id.","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Ticket information returned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ticket"}}}},"401":{"description":"Unauthorized"}}},"put":{"summary":"Update a Ticket","tags":["Ticket"],"security":[{"ApiKeyAuth":[]},{"JwtAuthentication":[]}],"parameters":[{"name":"id","description":"Ticket's id.","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"description":"Ticket object","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ticket"}}}},"responses":{"204":{"description":"User updated"},"401":{"description":"Unauthorized"}}},"delete":{"summary":"Delete a Ticket","tags":["Ticket"],"security":[{"ApiKeyAuth":[]},{"JwtAuthentication":[]}],"parameters":[{"name":"id","description":"Ticket's id.","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"204":{"description":"Ticket Deleted"},"401":{"description":"Unauthorized"}}}},"/user/":{"get":{"summary":"Get All users","tags":["User"],"security":[{"ApiKeyAuth":["user.read.all"]},{"JwtAuthentication":[]}],"parameters":[{"name":"skip","description":"Users to skip for pagination.","in":"query","required":true,"schema":{"type":"integer"}},{"name":"limit","description":"Number of users to return.","in":"query","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Test","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}}}},"post":{"summary":"Create a user","tags":["User"],"security":[{"ApiKeyAuth":["user.create"]},{"JwtAuthentication":[]}],"requestBody":{"description":"User object","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"responses":{"201":{"description":"User created"},"401":{"$ref":"#/components/responses/UnauthorizedError","description":"Unauthorized"}}}},"/user/{id}":{"get":{"summary":"Get a user","tags":["User"],"security":[{"ApiKeyAuth":["user.read.one"]},{"JwtAuthentication":[]}],"parameters":[{"name":"id","description":"User's id.","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Users information returned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError","description":"Unauthorized"}}},"put":{"summary":"Update a user","tags":["User"],"security":[{"ApiKeyAuth":["user.updaate.one"]},{"JwtAuthentication":[]}],"parameters":[{"name":"id","description":"User's id.","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"description":"User object","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"responses":{"204":{"description":"User updated"},"401":{"$ref":"#/components/responses/UnauthorizedError","description":"Unauthorized"}}},"delete":{"summary":"Delete a user","tags":["User"],"security":[{"ApiKeyAuth":["user.delete.one"]},{"JwtAuthentication":[]}],"parameters":[{"name":"id","description":"User's id.","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"204":{"description":"User Deleted"},"401":{"$ref":"#/components/responses/UnauthorizedError","description":"Unauthorized"}}}},"/user/login":{"post":{"summary":"Login","tags":["User"],"security":[],"requestBody":{"description":"User object","content":{"application/json":{"schema":{"type":"object","example":{"username":"ConorGrocock","password":"password"},"required":["email","password"],"properties":{"email":{"type":"string"},"password":{"type":"string"}}}}}},"responses":{"200":{"description":"A user logged in successfully"},"401":{"description":"Unauthorized"},"404":{"description":"User not found"}}}},"/user/me":{"get":{"summary":"Get information about the logged in user","tags":["User"],"security":[{"ApiKeyAuth":[]},{"JwtAuthentication":[]}],"responses":{"200":{"description":"A users details"},"401":{"$ref":"#/components/responses/UnauthorizedError","description":"Unauthorized"},"404":{"description":"User not found"}}}}},"tags":[]}