1624 lines
51 KiB
Go
1624 lines
51 KiB
Go
// 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": {},
|
||
"version": "{{.Version}}"
|
||
},
|
||
"host": "{{.Host}}",
|
||
"basePath": "{{.BasePath}}",
|
||
"paths": {
|
||
"/admin/users": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Admin - User Management"
|
||
],
|
||
"summary": "Get all users (Admin only)",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"default": 1,
|
||
"description": "Page number",
|
||
"name": "page",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"type": "integer",
|
||
"default": 10,
|
||
"description": "Items per page",
|
||
"name": "limit",
|
||
"in": "query"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"consumes": [
|
||
"multipart/form-data"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Admin - User Management"
|
||
],
|
||
"summary": "Create new user (Admin only)",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "Email",
|
||
"name": "email",
|
||
"in": "formData",
|
||
"required": true
|
||
},
|
||
{
|
||
"type": "string",
|
||
"description": "Password",
|
||
"name": "password",
|
||
"in": "formData",
|
||
"required": true
|
||
},
|
||
{
|
||
"type": "string",
|
||
"description": "Username",
|
||
"name": "user_name",
|
||
"in": "formData",
|
||
"required": true
|
||
},
|
||
{
|
||
"type": "boolean",
|
||
"description": "Email verified",
|
||
"name": "email_verified",
|
||
"in": "formData"
|
||
},
|
||
{
|
||
"type": "string",
|
||
"description": "Roles (comma separated: admin,user)",
|
||
"name": "roles",
|
||
"in": "formData"
|
||
},
|
||
{
|
||
"type": "file",
|
||
"description": "Avatar image",
|
||
"name": "avatar",
|
||
"in": "formData"
|
||
}
|
||
],
|
||
"responses": {
|
||
"201": {
|
||
"description": "Created",
|
||
"schema": {
|
||
"$ref": "#/definitions/models.User"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/admin/users/deleted": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Admin - User Management"
|
||
],
|
||
"summary": "Get all soft deleted users (Admin only)",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"default": 1,
|
||
"description": "Page number",
|
||
"name": "page",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"type": "integer",
|
||
"default": 10,
|
||
"description": "Items per page",
|
||
"name": "limit",
|
||
"in": "query"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/admin/users/search": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Admin - User Management"
|
||
],
|
||
"summary": "Search users (Admin only)",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "Search query",
|
||
"name": "q",
|
||
"in": "query",
|
||
"required": true
|
||
},
|
||
{
|
||
"type": "integer",
|
||
"default": 1,
|
||
"description": "Page number",
|
||
"name": "page",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"type": "integer",
|
||
"default": 10,
|
||
"description": "Items per page",
|
||
"name": "limit",
|
||
"in": "query"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/admin/users/{id}": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Admin - User Management"
|
||
],
|
||
"summary": "Get user by ID (Admin only)",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "User ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/models.User"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"consumes": [
|
||
"multipart/form-data"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Admin - User Management"
|
||
],
|
||
"summary": "Update user (Admin only)",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "User ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"type": "string",
|
||
"description": "Email",
|
||
"name": "email",
|
||
"in": "formData"
|
||
},
|
||
{
|
||
"type": "string",
|
||
"description": "Password",
|
||
"name": "password",
|
||
"in": "formData"
|
||
},
|
||
{
|
||
"type": "string",
|
||
"description": "Username",
|
||
"name": "user_name",
|
||
"in": "formData"
|
||
},
|
||
{
|
||
"type": "boolean",
|
||
"description": "Email verified",
|
||
"name": "email_verified",
|
||
"in": "formData"
|
||
},
|
||
{
|
||
"type": "string",
|
||
"description": "Roles (comma separated: admin,user)",
|
||
"name": "roles",
|
||
"in": "formData"
|
||
},
|
||
{
|
||
"type": "file",
|
||
"description": "Avatar image",
|
||
"name": "avatar",
|
||
"in": "formData"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"tags": [
|
||
"Admin - User Management"
|
||
],
|
||
"summary": "Delete user (Admin only)",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "User ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"type": "boolean",
|
||
"default": false,
|
||
"description": "Hard delete (permanent)",
|
||
"name": "hard",
|
||
"in": "query"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/admin/users/{id}/avatar": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"consumes": [
|
||
"multipart/form-data"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Admin - User Management"
|
||
],
|
||
"summary": "Upload avatar for any user (Admin only)",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "User ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"type": "file",
|
||
"description": "Avatar image file",
|
||
"name": "avatar",
|
||
"in": "formData",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/admin/users/{id}/restore": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"tags": [
|
||
"Admin - User Management"
|
||
],
|
||
"summary": "Restore a soft deleted user (Admin only)",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "User ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/admin/users/{id}/roles": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Admin - User Management"
|
||
],
|
||
"summary": "Assign roles to user (Admin only)",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "User ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "Roles",
|
||
"name": "roles",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/admin/users/{id}/roles/{role}": {
|
||
"delete": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"tags": [
|
||
"Admin - User Management"
|
||
],
|
||
"summary": "Remove role from user (Admin only)",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "User ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"type": "string",
|
||
"description": "Role name",
|
||
"name": "role",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/auth/login": {
|
||
"post": {
|
||
"description": "Login with email and password to get JWT token",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"auth"
|
||
],
|
||
"summary": "Login user",
|
||
"parameters": [
|
||
{
|
||
"description": "Login Request",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/handlers.LoginRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "Unauthorized",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/auth/me": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"description": "Get details of the currently authenticated user",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"auth"
|
||
],
|
||
"summary": "Get Current User Profile",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/models.User"
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "Unauthorized",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/auth/refresh": {
|
||
"post": {
|
||
"description": "usage: send refresh_token to get new access_token",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"auth"
|
||
],
|
||
"summary": "Refresh Access Token",
|
||
"parameters": [
|
||
{
|
||
"description": "Refresh Request",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/handlers.RefreshRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "Unauthorized",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/auth/register": {
|
||
"post": {
|
||
"description": "Register with username, email and password",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"auth"
|
||
],
|
||
"summary": "Register a new user",
|
||
"parameters": [
|
||
{
|
||
"description": "Register Request",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/handlers.RegisterRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"201": {
|
||
"description": "Created",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/auth/verify-email": {
|
||
"get": {
|
||
"description": "Verify email with token sent after email/password registration",
|
||
"tags": [
|
||
"auth"
|
||
],
|
||
"summary": "Verify email address",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "Verification token",
|
||
"name": "token",
|
||
"in": "query",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/auth/{provider}": {
|
||
"get": {
|
||
"description": "Redirect to OAuth2 provider",
|
||
"tags": [
|
||
"oauth"
|
||
],
|
||
"summary": "Start OAuth2 flow",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "Provider (google, github)",
|
||
"name": "provider",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {}
|
||
}
|
||
},
|
||
"/auth/{provider}/callback": {
|
||
"get": {
|
||
"description": "Handle callback from OAuth2 provider",
|
||
"tags": [
|
||
"oauth"
|
||
],
|
||
"summary": "OAuth2 Callback",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "Provider (google, github)",
|
||
"name": "provider",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "Unauthorized",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/profile": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Profile"
|
||
],
|
||
"summary": "Get current user profile",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/models.User"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"consumes": [
|
||
"multipart/form-data"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Profile"
|
||
],
|
||
"summary": "Update current user profile",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "Username",
|
||
"name": "user_name",
|
||
"in": "formData"
|
||
},
|
||
{
|
||
"type": "file",
|
||
"description": "Avatar image",
|
||
"name": "avatar",
|
||
"in": "formData"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/profile/email": {
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Profile"
|
||
],
|
||
"summary": "Change email address",
|
||
"parameters": [
|
||
{
|
||
"description": "Email change request",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/profile/password": {
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Profile"
|
||
],
|
||
"summary": "Change password",
|
||
"parameters": [
|
||
{
|
||
"description": "Password change request",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/settings/cors/blacklist": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Settings"
|
||
],
|
||
"summary": "Get all CORS blacklist entries",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/models.CorsBlacklist"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Settings"
|
||
],
|
||
"summary": "Create CORS blacklist entry",
|
||
"parameters": [
|
||
{
|
||
"description": "Blacklist data",
|
||
"name": "blacklist",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"201": {
|
||
"description": "Created",
|
||
"schema": {
|
||
"$ref": "#/definitions/models.CorsBlacklist"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/settings/cors/blacklist/{id}": {
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Settings"
|
||
],
|
||
"summary": "Update CORS blacklist entry",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "Blacklist ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "Update data",
|
||
"name": "blacklist",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"tags": [
|
||
"Settings"
|
||
],
|
||
"summary": "Delete CORS blacklist entry",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "Blacklist ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/settings/cors/whitelist": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Settings"
|
||
],
|
||
"summary": "Get all CORS whitelist entries",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/models.CorsWhitelist"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Settings"
|
||
],
|
||
"summary": "Create CORS whitelist entry",
|
||
"parameters": [
|
||
{
|
||
"description": "Whitelist data",
|
||
"name": "whitelist",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"201": {
|
||
"description": "Created",
|
||
"schema": {
|
||
"$ref": "#/definitions/models.CorsWhitelist"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/settings/cors/whitelist/{id}": {
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Settings"
|
||
],
|
||
"summary": "Update CORS whitelist entry",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "Whitelist ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "Update data",
|
||
"name": "whitelist",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"tags": [
|
||
"Settings"
|
||
],
|
||
"summary": "Delete CORS whitelist entry",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "Whitelist ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/settings/ratelimit": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Settings"
|
||
],
|
||
"summary": "Get all rate limit settings",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/models.RateLimitSetting"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/settings/ratelimit/{id}": {
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Settings"
|
||
],
|
||
"summary": "Update rate limit setting",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "Setting ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "Update data",
|
||
"name": "setting",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/user/avatar": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"consumes": [
|
||
"multipart/form-data"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"User"
|
||
],
|
||
"summary": "Upload user avatar",
|
||
"parameters": [
|
||
{
|
||
"type": "file",
|
||
"description": "Avatar image file",
|
||
"name": "avatar",
|
||
"in": "formData",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
}
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"User"
|
||
],
|
||
"summary": "Delete user avatar",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"definitions": {
|
||
"handlers.LoginRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"email",
|
||
"password"
|
||
],
|
||
"properties": {
|
||
"email": {
|
||
"type": "string"
|
||
},
|
||
"password": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"handlers.RefreshRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"refresh_token"
|
||
],
|
||
"properties": {
|
||
"refresh_token": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"handlers.RegisterRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"email",
|
||
"password",
|
||
"username"
|
||
],
|
||
"properties": {
|
||
"email": {
|
||
"type": "string"
|
||
},
|
||
"password": {
|
||
"type": "string",
|
||
"minLength": 6
|
||
},
|
||
"username": {
|
||
"type": "string",
|
||
"minLength": 3
|
||
}
|
||
}
|
||
},
|
||
"models.CorsBlacklist": {
|
||
"type": "object",
|
||
"properties": {
|
||
"created_at": {
|
||
"type": "string"
|
||
},
|
||
"created_by": {
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"type": "string"
|
||
},
|
||
"is_active": {
|
||
"type": "boolean"
|
||
},
|
||
"origin": {
|
||
"type": "string"
|
||
},
|
||
"reason": {
|
||
"type": "string"
|
||
},
|
||
"updated_at": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"models.CorsWhitelist": {
|
||
"type": "object",
|
||
"properties": {
|
||
"created_at": {
|
||
"type": "string"
|
||
},
|
||
"created_by": {
|
||
"type": "string"
|
||
},
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"type": "string"
|
||
},
|
||
"is_active": {
|
||
"type": "boolean"
|
||
},
|
||
"origin": {
|
||
"type": "string"
|
||
},
|
||
"updated_at": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"models.Permission": {
|
||
"type": "object",
|
||
"properties": {
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"type": "integer"
|
||
},
|
||
"name": {
|
||
"description": "user:read, user:write",
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"models.RateLimitSetting": {
|
||
"type": "object",
|
||
"properties": {
|
||
"created_at": {
|
||
"type": "string"
|
||
},
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"type": "string"
|
||
},
|
||
"is_active": {
|
||
"type": "boolean"
|
||
},
|
||
"max_requests": {
|
||
"description": "Max istek sayısı",
|
||
"type": "integer"
|
||
},
|
||
"name": {
|
||
"description": "e.g., \"login\", \"register\", \"api\"",
|
||
"type": "string"
|
||
},
|
||
"updated_at": {
|
||
"type": "string"
|
||
},
|
||
"updated_by": {
|
||
"type": "string"
|
||
},
|
||
"window_seconds": {
|
||
"description": "Zaman penceresi (saniye)",
|
||
"type": "integer"
|
||
}
|
||
}
|
||
},
|
||
"models.Role": {
|
||
"type": "object",
|
||
"properties": {
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"type": "integer"
|
||
},
|
||
"name": {
|
||
"description": "admin, user",
|
||
"type": "string"
|
||
},
|
||
"permissions": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/models.Permission"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"models.SocialAccount": {
|
||
"type": "object",
|
||
"properties": {
|
||
"avatar_url": {
|
||
"description": "Avatar URL from provider",
|
||
"type": "string"
|
||
},
|
||
"created_at": {
|
||
"type": "string"
|
||
},
|
||
"email": {
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"description": "Full name from provider",
|
||
"type": "string"
|
||
},
|
||
"provider": {
|
||
"description": "google, github",
|
||
"type": "string"
|
||
},
|
||
"provider_id": {
|
||
"type": "string"
|
||
},
|
||
"updated_at": {
|
||
"type": "string"
|
||
},
|
||
"user_id": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"models.User": {
|
||
"type": "object",
|
||
"properties": {
|
||
"avatar": {
|
||
"description": "Avatar URL from OAuth or uploaded",
|
||
"type": "string"
|
||
},
|
||
"created_at": {
|
||
"type": "string"
|
||
},
|
||
"email": {
|
||
"type": "string"
|
||
},
|
||
"email_verified": {
|
||
"description": "Email verification: only required for email/password registration; OAuth users are treated as verified\nChanged to *bool to handle false values correctly with GORM defaults",
|
||
"type": "boolean"
|
||
},
|
||
"email_verified_at": {
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"type": "string"
|
||
},
|
||
"roles": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/models.Role"
|
||
}
|
||
},
|
||
"social_accounts": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/models.SocialAccount"
|
||
}
|
||
},
|
||
"updated_at": {
|
||
"type": "string"
|
||
},
|
||
"username": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"securityDefinitions": {
|
||
"ApiKeyAuth": {
|
||
"type": "apiKey",
|
||
"name": "Authorization",
|
||
"in": "header"
|
||
}
|
||
}
|
||
}`
|
||
|
||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||
var SwaggerInfo = &swag.Spec{
|
||
Version: "1.0",
|
||
Host: "",
|
||
BasePath: "/v1",
|
||
Schemes: []string{},
|
||
Title: "GAuth-Central API",
|
||
Description: "Centralized Authentication Service",
|
||
InfoInstanceName: "swagger",
|
||
SwaggerTemplate: docTemplate,
|
||
LeftDelim: "{{",
|
||
RightDelim: "}}",
|
||
}
|
||
|
||
func init() {
|
||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||
}
|