2024-03-08 10:17:27 +01:00
|
|
|
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
|
|
|
package docs
|
|
|
|
|
|
|
|
import "github.com/swaggo/swag"
|
|
|
|
|
|
|
|
const docTemplate = `{
|
|
|
|
"schemes": {{ marshal .Schemes }},
|
|
|
|
"swagger": "2.0",
|
|
|
|
"info": {
|
|
|
|
"description": "{{escape .Description}}",
|
|
|
|
"title": "{{.Title}}",
|
|
|
|
"contact": {},
|
|
|
|
"license": {
|
|
|
|
"name": "AGPL",
|
|
|
|
"url": "https://www.gnu.org/licenses/agpl-3.0.html"
|
|
|
|
},
|
|
|
|
"version": "{{.Version}}"
|
|
|
|
},
|
|
|
|
"host": "{{.Host}}",
|
|
|
|
"basePath": "{{.BasePath}}",
|
|
|
|
"paths": {
|
2024-03-18 22:40:51 +01:00
|
|
|
"/login": {
|
2024-03-08 10:17:27 +01:00
|
|
|
"post": {
|
2024-03-18 22:40:51 +01:00
|
|
|
"description": "logs the user in and returns a jwt token",
|
2024-03-08 10:17:27 +01:00
|
|
|
"consumes": [
|
|
|
|
"application/json"
|
|
|
|
],
|
|
|
|
"produces": [
|
2024-03-18 22:40:51 +01:00
|
|
|
"text/plain"
|
|
|
|
],
|
|
|
|
"tags": [
|
|
|
|
"User"
|
|
|
|
],
|
|
|
|
"summary": "login",
|
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"description": "login info",
|
|
|
|
"name": "NewUser",
|
|
|
|
"in": "body",
|
|
|
|
"required": true,
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/types.NewUser"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "Successfully signed token for user",
|
|
|
|
"schema": {
|
|
|
|
"type": "Token"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"400": {
|
|
|
|
"description": "Bad request",
|
|
|
|
"schema": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"401": {
|
|
|
|
"description": "Unauthorized",
|
|
|
|
"schema": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"500": {
|
|
|
|
"description": "Internal server error",
|
|
|
|
"schema": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"/loginerenew": {
|
|
|
|
"post": {
|
2024-03-19 00:27:31 +01:00
|
|
|
"security": [
|
|
|
|
{
|
|
|
|
"bererToken": []
|
|
|
|
}
|
|
|
|
],
|
2024-03-18 22:40:51 +01:00
|
|
|
"description": "renews the users token",
|
|
|
|
"consumes": [
|
2024-03-08 10:17:27 +01:00
|
|
|
"application/json"
|
|
|
|
],
|
2024-03-18 22:40:51 +01:00
|
|
|
"produces": [
|
|
|
|
"text/plain"
|
|
|
|
],
|
|
|
|
"tags": [
|
|
|
|
"User"
|
|
|
|
],
|
2024-03-19 00:27:31 +01:00
|
|
|
"summary": "LoginRenews",
|
2024-03-18 22:40:51 +01:00
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "Successfully signed token for user",
|
|
|
|
"schema": {
|
|
|
|
"type": "Token"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"401": {
|
|
|
|
"description": "Unauthorized",
|
|
|
|
"schema": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"500": {
|
|
|
|
"description": "Internal server error",
|
|
|
|
"schema": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2024-03-18 23:21:49 +01:00
|
|
|
"/promoteToAdmin": {
|
|
|
|
"post": {
|
|
|
|
"description": "promote chosen user to admin",
|
|
|
|
"consumes": [
|
|
|
|
"application/json"
|
|
|
|
],
|
|
|
|
"produces": [
|
|
|
|
"text/plain"
|
|
|
|
],
|
|
|
|
"tags": [
|
|
|
|
"User"
|
|
|
|
],
|
2024-03-19 00:27:31 +01:00
|
|
|
"summary": "PromoteToAdmin",
|
2024-03-18 23:21:49 +01:00
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"description": "user info",
|
|
|
|
"name": "NewUser",
|
|
|
|
"in": "body",
|
|
|
|
"required": true,
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/types.NewUser"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
2024-03-29 15:59:36 +01:00
|
|
|
"description": "Successfully promoted user",
|
2024-03-18 23:21:49 +01:00
|
|
|
"schema": {
|
|
|
|
"type": "json"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"400": {
|
2024-03-29 15:59:36 +01:00
|
|
|
"description": "Bad request",
|
2024-03-18 23:21:49 +01:00
|
|
|
"schema": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"401": {
|
|
|
|
"description": "Unauthorized",
|
|
|
|
"schema": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"500": {
|
|
|
|
"description": "Internal server error",
|
|
|
|
"schema": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2024-03-18 22:40:51 +01:00
|
|
|
"/register": {
|
|
|
|
"post": {
|
|
|
|
"description": "Register a new user",
|
|
|
|
"consumes": [
|
|
|
|
"application/json"
|
|
|
|
],
|
|
|
|
"produces": [
|
|
|
|
"text/plain"
|
|
|
|
],
|
2024-03-08 10:17:27 +01:00
|
|
|
"tags": [
|
|
|
|
"User"
|
|
|
|
],
|
2024-03-19 00:27:31 +01:00
|
|
|
"summary": "Register",
|
2024-03-18 19:59:14 +01:00
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"description": "User to register",
|
2024-03-18 22:40:51 +01:00
|
|
|
"name": "NewUser",
|
2024-03-18 19:59:14 +01:00
|
|
|
"in": "body",
|
|
|
|
"required": true,
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/types.NewUser"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
2024-03-08 10:17:27 +01:00
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "User added",
|
|
|
|
"schema": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"400": {
|
|
|
|
"description": "Bad request",
|
|
|
|
"schema": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"500": {
|
|
|
|
"description": "Internal server error",
|
|
|
|
"schema": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
2024-03-18 22:40:51 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"/userdelete/{username}": {
|
|
|
|
"delete": {
|
|
|
|
"description": "UserDelete deletes a user from the database",
|
|
|
|
"consumes": [
|
|
|
|
"application/json"
|
|
|
|
],
|
|
|
|
"produces": [
|
|
|
|
"text/plain"
|
|
|
|
],
|
|
|
|
"tags": [
|
|
|
|
"User"
|
|
|
|
],
|
2024-03-19 00:27:31 +01:00
|
|
|
"summary": "UserDelete",
|
2024-03-18 22:40:51 +01:00
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "User deleted",
|
|
|
|
"schema": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"401": {
|
|
|
|
"description": "Unauthorized",
|
|
|
|
"schema": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"403": {
|
|
|
|
"description": "You can only delete yourself",
|
|
|
|
"schema": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"500": {
|
|
|
|
"description": "Internal server error",
|
|
|
|
"schema": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
2024-03-18 23:21:49 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"/users/all": {
|
|
|
|
"get": {
|
|
|
|
"description": "lists all users",
|
|
|
|
"consumes": [
|
|
|
|
"application/json"
|
|
|
|
],
|
|
|
|
"produces": [
|
|
|
|
"text/plain"
|
|
|
|
],
|
|
|
|
"tags": [
|
|
|
|
"User"
|
|
|
|
],
|
2024-03-19 00:27:31 +01:00
|
|
|
"summary": "ListsAllUsers",
|
2024-03-18 23:21:49 +01:00
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "Successfully signed token for user",
|
|
|
|
"schema": {
|
|
|
|
"type": "json"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"401": {
|
|
|
|
"description": "Unauthorized",
|
|
|
|
"schema": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"500": {
|
|
|
|
"description": "Internal server error",
|
|
|
|
"schema": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
2024-03-08 10:17:27 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2024-03-18 19:59:14 +01:00
|
|
|
"definitions": {
|
|
|
|
"types.NewUser": {
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"password": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"username": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2024-03-19 00:27:31 +01:00
|
|
|
"securityDefinitions": {
|
|
|
|
"bererToken": {
|
|
|
|
"type": "apiKey",
|
|
|
|
"name": "Authorization",
|
|
|
|
"in": "header"
|
|
|
|
}
|
|
|
|
},
|
2024-03-08 10:17:27 +01:00
|
|
|
"externalDocs": {
|
|
|
|
"description": "OpenAPI",
|
|
|
|
"url": "https://swagger.io/resources/open-api/"
|
|
|
|
}
|
|
|
|
}`
|
|
|
|
|
|
|
|
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
|
|
|
var SwaggerInfo = &swag.Spec{
|
|
|
|
Version: "0.0.1",
|
|
|
|
Host: "localhost:8080",
|
|
|
|
BasePath: "/api",
|
|
|
|
Schemes: []string{},
|
|
|
|
Title: "TTime API",
|
|
|
|
Description: "This is the API for TTime, a time tracking application.",
|
|
|
|
InfoInstanceName: "swagger",
|
|
|
|
SwaggerTemplate: docTemplate,
|
|
|
|
LeftDelim: "{{",
|
|
|
|
RightDelim: "}}",
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
|
|
|
}
|