added some govno to postgres
This commit is contained in:
+480
-34
@@ -27,7 +27,7 @@ const docTemplate = `{
|
||||
"tags": [
|
||||
"auth"
|
||||
],
|
||||
"summary": "Epta login",
|
||||
"summary": "Login",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Login credentials",
|
||||
@@ -35,7 +35,7 @@ const docTemplate = `{
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.LoginRequest"
|
||||
"$ref": "#/definitions/auth.LoginRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -43,19 +43,19 @@ const docTemplate = `{
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.AuthResponse"
|
||||
"$ref": "#/definitions/auth.AuthResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.ErrorResponse"
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.ErrorResponse"
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ const docTemplate = `{
|
||||
"tags": [
|
||||
"auth"
|
||||
],
|
||||
"summary": "Logout epta",
|
||||
"summary": "Logout",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Refresh token to invalidate",
|
||||
@@ -81,7 +81,7 @@ const docTemplate = `{
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.LogoutRequest"
|
||||
"$ref": "#/definitions/auth.LogoutRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -98,13 +98,13 @@ const docTemplate = `{
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.ErrorResponse"
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.ErrorResponse"
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,18 +127,121 @@ const docTemplate = `{
|
||||
"tags": [
|
||||
"auth"
|
||||
],
|
||||
"summary": "Epta get current user",
|
||||
"summary": "Get current user",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.UserResponse"
|
||||
"$ref": "#/definitions/auth.UserResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.ErrorResponse"
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Update current user's username",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"auth"
|
||||
],
|
||||
"summary": "Update profile",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Profile update",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.UpdateProfileRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.UserResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/auth/password": {
|
||||
"put": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Change current user's password",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"auth"
|
||||
],
|
||||
"summary": "Change password",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Password change details",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.PasswordChangeRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,7 +259,7 @@ const docTemplate = `{
|
||||
"tags": [
|
||||
"auth"
|
||||
],
|
||||
"summary": "Refresh epta token",
|
||||
"summary": "Refresh token",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Refresh token",
|
||||
@@ -164,7 +267,7 @@ const docTemplate = `{
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.RefreshRequest"
|
||||
"$ref": "#/definitions/auth.RefreshRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -172,19 +275,19 @@ const docTemplate = `{
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.AuthResponse"
|
||||
"$ref": "#/definitions/auth.AuthResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.ErrorResponse"
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.ErrorResponse"
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -202,7 +305,7 @@ const docTemplate = `{
|
||||
"tags": [
|
||||
"auth"
|
||||
],
|
||||
"summary": "Epta registration",
|
||||
"summary": "Register",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Registration details",
|
||||
@@ -210,7 +313,7 @@ const docTemplate = `{
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.RegisterRequest"
|
||||
"$ref": "#/definitions/auth.RegisterRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -218,19 +321,245 @@ const docTemplate = `{
|
||||
"201": {
|
||||
"description": "Created",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.UserResponse"
|
||||
"$ref": "#/definitions/auth.AuthResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.ErrorResponse"
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "Conflict",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.ErrorResponse"
|
||||
"$ref": "#/definitions/auth.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/organizations": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Get all organizations",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"organizations"
|
||||
],
|
||||
"summary": "List organizations",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.OrgListResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Create a new organization",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"organizations"
|
||||
],
|
||||
"summary": "Create organization",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Organization details",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.CreateOrgRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Created",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.OrgResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "Conflict",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/organizations/{id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Get organization details",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"organizations"
|
||||
],
|
||||
"summary": "Get organization by ID",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Organization ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.OrgResponse"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Update organization name",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"organizations"
|
||||
],
|
||||
"summary": "Update organization",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Organization ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "New organization details",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.UpdateOrgRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.OrgResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "Delete an organization",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"organizations"
|
||||
],
|
||||
"summary": "Delete organization",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Organization ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/org.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -238,7 +567,7 @@ const docTemplate = `{
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"internal_auth.AuthResponse": {
|
||||
"auth.AuthResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"refresh_token": {
|
||||
@@ -250,11 +579,11 @@ const docTemplate = `{
|
||||
"example": "eyJhbGciOiJIUzI1NiIs..."
|
||||
},
|
||||
"user": {
|
||||
"$ref": "#/definitions/internal_auth.UserPublic"
|
||||
"$ref": "#/definitions/auth.UserPublic"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_auth.ErrorResponse": {
|
||||
"auth.ErrorResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"error": {
|
||||
@@ -263,7 +592,7 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_auth.LoginRequest": {
|
||||
"auth.LoginRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"email",
|
||||
@@ -280,7 +609,7 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_auth.LogoutRequest": {
|
||||
"auth.LogoutRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"refresh_token"
|
||||
@@ -292,7 +621,25 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_auth.RefreshRequest": {
|
||||
"auth.PasswordChangeRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"new_password",
|
||||
"old_password"
|
||||
],
|
||||
"properties": {
|
||||
"new_password": {
|
||||
"type": "string",
|
||||
"minLength": 8,
|
||||
"example": "NewSecret456!"
|
||||
},
|
||||
"old_password": {
|
||||
"type": "string",
|
||||
"example": "Secret123!"
|
||||
}
|
||||
}
|
||||
},
|
||||
"auth.RefreshRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"refresh_token"
|
||||
@@ -304,7 +651,7 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_auth.RegisterRequest": {
|
||||
"auth.RegisterRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"email",
|
||||
@@ -318,8 +665,8 @@ const docTemplate = `{
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"minLength": 6,
|
||||
"example": "secret123"
|
||||
"minLength": 8,
|
||||
"example": "Secret123!"
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
@@ -329,7 +676,21 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_auth.UserPublic": {
|
||||
"auth.UpdateProfileRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"username"
|
||||
],
|
||||
"properties": {
|
||||
"username": {
|
||||
"type": "string",
|
||||
"maxLength": 30,
|
||||
"minLength": 3,
|
||||
"example": "john_updated"
|
||||
}
|
||||
}
|
||||
},
|
||||
"auth.UserPublic": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"created_at": {
|
||||
@@ -346,11 +707,96 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_auth.UserResponse": {
|
||||
"auth.UserResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"user": {
|
||||
"$ref": "#/definitions/internal_auth.UserPublic"
|
||||
"$ref": "#/definitions/auth.UserPublic"
|
||||
}
|
||||
}
|
||||
},
|
||||
"org.CreateOrgRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"slug"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"maxLength": 100,
|
||||
"minLength": 2,
|
||||
"example": "My Corp"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string",
|
||||
"maxLength": 50,
|
||||
"minLength": 2,
|
||||
"example": "my-corp"
|
||||
}
|
||||
}
|
||||
},
|
||||
"org.ErrorResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"error": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"org.OrgListResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"organizations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/org.Organization"
|
||||
}
|
||||
},
|
||||
"total": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"org.OrgResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"organization": {
|
||||
"$ref": "#/definitions/org.Organization"
|
||||
}
|
||||
}
|
||||
},
|
||||
"org.Organization": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"org.UpdateOrgRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"maxLength": 100,
|
||||
"minLength": 2,
|
||||
"example": "My Corp Updated"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user