feat: initialized all controllers for release 1;

feat: authentication added to swagger
This commit is contained in:
2025-06-18 18:27:12 +03:00
parent 582c0f15d8
commit b1ef3e06f6
7 changed files with 434 additions and 7 deletions

View File

@@ -10,11 +10,34 @@ const docTemplate = `{
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {},
"license": {
"name": "GPL 3.0"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/account/changePassword": {
"put": {
"security": [
{
"JWT": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Account"
],
"summary": "Change account password",
"responses": {}
}
},
"/auth/login": {
"post": {
"consumes": [
@@ -105,6 +128,93 @@ const docTemplate = `{
"responses": {}
}
},
"/profile/me": {
"get": {
"security": [
{
"JWT": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Profile"
],
"summary": "Get own profile when authorized",
"responses": {}
}
},
"/profile/privacy": {
"get": {
"security": [
{
"JWT": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Profile"
],
"summary": "Get profile privacy settings",
"responses": {}
},
"patch": {
"security": [
{
"JWT": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Profile"
],
"summary": "Update profile privacy settings",
"responses": {}
}
},
"/profile/{username}": {
"get": {
"security": [
{
"JWT": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Profile"
],
"summary": "Get someone's profile details",
"parameters": [
{
"type": "string",
"description": "Username",
"name": "username",
"in": "path",
"required": true
}
],
"responses": {}
}
},
"/service/health": {
"get": {
"description": "Used internally for checking service health",
@@ -138,17 +248,24 @@ const docTemplate = `{
}
}
}
},
"securityDefinitions": {
"JWT": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "",
Version: "1.0",
Host: "",
BasePath: "",
Schemes: []string{},
Title: "",
Description: "",
BasePath: "/api/",
Schemes: []string{"http"},
Title: "Easywish client API",
Description: "Easy and feature-rich wishlist.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",

View File

@@ -1,9 +1,39 @@
{
"schemes": [
"http"
],
"swagger": "2.0",
"info": {
"contact": {}
"description": "Easy and feature-rich wishlist.",
"title": "Easywish client API",
"contact": {},
"license": {
"name": "GPL 3.0"
},
"version": "1.0"
},
"basePath": "/api/",
"paths": {
"/account/changePassword": {
"put": {
"security": [
{
"JWT": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Account"
],
"summary": "Change account password",
"responses": {}
}
},
"/auth/login": {
"post": {
"consumes": [
@@ -94,6 +124,93 @@
"responses": {}
}
},
"/profile/me": {
"get": {
"security": [
{
"JWT": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Profile"
],
"summary": "Get own profile when authorized",
"responses": {}
}
},
"/profile/privacy": {
"get": {
"security": [
{
"JWT": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Profile"
],
"summary": "Get profile privacy settings",
"responses": {}
},
"patch": {
"security": [
{
"JWT": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Profile"
],
"summary": "Update profile privacy settings",
"responses": {}
}
},
"/profile/{username}": {
"get": {
"security": [
{
"JWT": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Profile"
],
"summary": "Get someone's profile details",
"parameters": [
{
"type": "string",
"description": "Username",
"name": "username",
"in": "path",
"required": true
}
],
"responses": {}
}
},
"/service/health": {
"get": {
"description": "Used internally for checking service health",
@@ -127,5 +244,12 @@
}
}
}
},
"securityDefinitions": {
"JWT": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}

View File

@@ -1,3 +1,4 @@
basePath: /api/
definitions:
controllers.HealthStatus:
properties:
@@ -6,7 +7,24 @@ definitions:
type: object
info:
contact: {}
description: Easy and feature-rich wishlist.
license:
name: GPL 3.0
title: Easywish client API
version: "1.0"
paths:
/account/changePassword:
put:
consumes:
- application/json
produces:
- application/json
responses: {}
security:
- JWT: []
summary: Change account password
tags:
- Account
/auth/login:
post:
consumes:
@@ -68,6 +86,59 @@ paths:
summary: Confirm with code, finish creating the account
tags:
- Auth
/profile/{username}:
get:
consumes:
- application/json
parameters:
- description: Username
in: path
name: username
required: true
type: string
produces:
- application/json
responses: {}
security:
- JWT: []
summary: Get someone's profile details
tags:
- Profile
/profile/me:
get:
consumes:
- application/json
produces:
- application/json
responses: {}
security:
- JWT: []
summary: Get own profile when authorized
tags:
- Profile
/profile/privacy:
get:
consumes:
- application/json
produces:
- application/json
responses: {}
security:
- JWT: []
summary: Get profile privacy settings
tags:
- Profile
patch:
consumes:
- application/json
produces:
- application/json
responses: {}
security:
- JWT: []
summary: Update profile privacy settings
tags:
- Profile
/service/health:
get:
consumes:
@@ -83,4 +154,11 @@ paths:
summary: Get health status
tags:
- Service
schemes:
- http
securityDefinitions:
JWT:
in: header
name: Authorization
type: apiKey
swagger: "2.0"