added some govno to postgres

This commit is contained in:
Mephimeow
2026-06-13 18:31:22 +00:00
committed by zero@thinky
parent 56ab583223
commit 57ce3dea5f
20 changed files with 2174 additions and 163 deletions
+480 -34
View File
@@ -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"
}
}
}
+480 -34
View File
@@ -22,7 +22,7 @@
"tags": [
"auth"
],
"summary": "Epta login",
"summary": "Login",
"parameters": [
{
"description": "Login credentials",
@@ -30,7 +30,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/internal_auth.LoginRequest"
"$ref": "#/definitions/auth.LoginRequest"
}
}
],
@@ -38,19 +38,19 @@
"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"
}
}
}
@@ -68,7 +68,7 @@
"tags": [
"auth"
],
"summary": "Logout epta",
"summary": "Logout",
"parameters": [
{
"description": "Refresh token to invalidate",
@@ -76,7 +76,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/internal_auth.LogoutRequest"
"$ref": "#/definitions/auth.LogoutRequest"
}
}
],
@@ -93,13 +93,13 @@
"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"
}
}
}
@@ -122,18 +122,121 @@
"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"
}
}
}
@@ -151,7 +254,7 @@
"tags": [
"auth"
],
"summary": "Refresh epta token",
"summary": "Refresh token",
"parameters": [
{
"description": "Refresh token",
@@ -159,7 +262,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/internal_auth.RefreshRequest"
"$ref": "#/definitions/auth.RefreshRequest"
}
}
],
@@ -167,19 +270,19 @@
"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"
}
}
}
@@ -197,7 +300,7 @@
"tags": [
"auth"
],
"summary": "Epta registration",
"summary": "Register",
"parameters": [
{
"description": "Registration details",
@@ -205,7 +308,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/internal_auth.RegisterRequest"
"$ref": "#/definitions/auth.RegisterRequest"
}
}
],
@@ -213,19 +316,245 @@
"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"
}
}
}
@@ -233,7 +562,7 @@
}
},
"definitions": {
"internal_auth.AuthResponse": {
"auth.AuthResponse": {
"type": "object",
"properties": {
"refresh_token": {
@@ -245,11 +574,11 @@
"example": "eyJhbGciOiJIUzI1NiIs..."
},
"user": {
"$ref": "#/definitions/internal_auth.UserPublic"
"$ref": "#/definitions/auth.UserPublic"
}
}
},
"internal_auth.ErrorResponse": {
"auth.ErrorResponse": {
"type": "object",
"properties": {
"error": {
@@ -258,7 +587,7 @@
}
}
},
"internal_auth.LoginRequest": {
"auth.LoginRequest": {
"type": "object",
"required": [
"email",
@@ -275,7 +604,7 @@
}
}
},
"internal_auth.LogoutRequest": {
"auth.LogoutRequest": {
"type": "object",
"required": [
"refresh_token"
@@ -287,7 +616,25 @@
}
}
},
"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"
@@ -299,7 +646,7 @@
}
}
},
"internal_auth.RegisterRequest": {
"auth.RegisterRequest": {
"type": "object",
"required": [
"email",
@@ -313,8 +660,8 @@
},
"password": {
"type": "string",
"minLength": 6,
"example": "secret123"
"minLength": 8,
"example": "Secret123!"
},
"username": {
"type": "string",
@@ -324,7 +671,21 @@
}
}
},
"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": {
@@ -341,11 +702,96 @@
}
}
},
"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"
}
}
}
+323 -34
View File
@@ -1,5 +1,5 @@
definitions:
internal_auth.AuthResponse:
auth.AuthResponse:
properties:
refresh_token:
example: dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4=
@@ -8,15 +8,15 @@ definitions:
example: eyJhbGciOiJIUzI1NiIs...
type: string
user:
$ref: '#/definitions/internal_auth.UserPublic'
$ref: '#/definitions/auth.UserPublic'
type: object
internal_auth.ErrorResponse:
auth.ErrorResponse:
properties:
error:
example: invalid email or password
type: string
type: object
internal_auth.LoginRequest:
auth.LoginRequest:
properties:
email:
example: john@example.com
@@ -28,7 +28,7 @@ definitions:
- email
- password
type: object
internal_auth.LogoutRequest:
auth.LogoutRequest:
properties:
refresh_token:
example: dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4=
@@ -36,7 +36,20 @@ definitions:
required:
- refresh_token
type: object
internal_auth.RefreshRequest:
auth.PasswordChangeRequest:
properties:
new_password:
example: NewSecret456!
minLength: 8
type: string
old_password:
example: Secret123!
type: string
required:
- new_password
- old_password
type: object
auth.RefreshRequest:
properties:
refresh_token:
example: dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4=
@@ -44,14 +57,14 @@ definitions:
required:
- refresh_token
type: object
internal_auth.RegisterRequest:
auth.RegisterRequest:
properties:
email:
example: john@example.com
type: string
password:
example: secret123
minLength: 6
example: Secret123!
minLength: 8
type: string
username:
example: john
@@ -63,7 +76,17 @@ definitions:
- password
- username
type: object
internal_auth.UserPublic:
auth.UpdateProfileRequest:
properties:
username:
example: john_updated
maxLength: 30
minLength: 3
type: string
required:
- username
type: object
auth.UserPublic:
properties:
created_at:
type: string
@@ -74,10 +97,68 @@ definitions:
username:
type: string
type: object
internal_auth.UserResponse:
auth.UserResponse:
properties:
user:
$ref: '#/definitions/internal_auth.UserPublic'
$ref: '#/definitions/auth.UserPublic'
type: object
org.CreateOrgRequest:
properties:
name:
example: My Corp
maxLength: 100
minLength: 2
type: string
slug:
example: my-corp
maxLength: 50
minLength: 2
type: string
required:
- name
- slug
type: object
org.ErrorResponse:
properties:
error:
type: string
type: object
org.OrgListResponse:
properties:
organizations:
items:
$ref: '#/definitions/org.Organization'
type: array
total:
type: integer
type: object
org.OrgResponse:
properties:
organization:
$ref: '#/definitions/org.Organization'
type: object
org.Organization:
properties:
created_at:
type: string
id:
type: string
name:
type: string
slug:
type: string
updated_at:
type: string
type: object
org.UpdateOrgRequest:
properties:
name:
example: My Corp Updated
maxLength: 100
minLength: 2
type: string
required:
- name
type: object
info:
contact: {}
@@ -96,23 +177,23 @@ paths:
name: request
required: true
schema:
$ref: '#/definitions/internal_auth.LoginRequest'
$ref: '#/definitions/auth.LoginRequest'
produces:
- application/json
responses:
"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'
summary: Epta login
$ref: '#/definitions/auth.ErrorResponse'
summary: Login
tags:
- auth
/api/auth/logout:
@@ -126,7 +207,7 @@ paths:
name: request
required: true
schema:
$ref: '#/definitions/internal_auth.LogoutRequest'
$ref: '#/definitions/auth.LogoutRequest'
produces:
- application/json
responses:
@@ -139,12 +220,12 @@ paths:
"400":
description: Bad Request
schema:
$ref: '#/definitions/internal_auth.ErrorResponse'
$ref: '#/definitions/auth.ErrorResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/internal_auth.ErrorResponse'
summary: Logout epta
$ref: '#/definitions/auth.ErrorResponse'
summary: Logout
tags:
- auth
/api/auth/me:
@@ -158,14 +239,79 @@ paths:
"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'
security:
- Bearer: []
summary: Epta get current user
summary: Get current user
tags:
- auth
put:
consumes:
- application/json
description: Update current user's username
parameters:
- description: Profile update
in: body
name: request
required: true
schema:
$ref: '#/definitions/auth.UpdateProfileRequest'
produces:
- application/json
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'
security:
- Bearer: []
summary: Update profile
tags:
- auth
/api/auth/password:
put:
consumes:
- application/json
description: Change current user's password
parameters:
- description: Password change details
in: body
name: request
required: true
schema:
$ref: '#/definitions/auth.PasswordChangeRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/auth.ErrorResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/auth.ErrorResponse'
security:
- Bearer: []
summary: Change password
tags:
- auth
/api/auth/refresh:
@@ -179,23 +325,23 @@ paths:
name: request
required: true
schema:
$ref: '#/definitions/internal_auth.RefreshRequest'
$ref: '#/definitions/auth.RefreshRequest'
produces:
- application/json
responses:
"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'
summary: Refresh epta token
$ref: '#/definitions/auth.ErrorResponse'
summary: Refresh token
tags:
- auth
/api/auth/register:
@@ -209,25 +355,168 @@ paths:
name: request
required: true
schema:
$ref: '#/definitions/internal_auth.RegisterRequest'
$ref: '#/definitions/auth.RegisterRequest'
produces:
- application/json
responses:
"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'
summary: Epta registration
$ref: '#/definitions/auth.ErrorResponse'
summary: Register
tags:
- auth
/api/organizations:
get:
consumes:
- application/json
description: Get all organizations
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/org.OrgListResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/org.ErrorResponse'
security:
- Bearer: []
summary: List organizations
tags:
- organizations
post:
consumes:
- application/json
description: Create a new organization
parameters:
- description: Organization details
in: body
name: request
required: true
schema:
$ref: '#/definitions/org.CreateOrgRequest'
produces:
- application/json
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'
security:
- Bearer: []
summary: Create organization
tags:
- organizations
/api/organizations/{id}:
delete:
consumes:
- application/json
description: Delete an organization
parameters:
- description: Organization ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: string
type: object
"404":
description: Not Found
schema:
$ref: '#/definitions/org.ErrorResponse'
security:
- Bearer: []
summary: Delete organization
tags:
- organizations
get:
consumes:
- application/json
description: Get organization details
parameters:
- description: Organization ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/org.OrgResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/org.ErrorResponse'
security:
- Bearer: []
summary: Get organization by ID
tags:
- organizations
put:
consumes:
- application/json
description: Update organization name
parameters:
- description: Organization ID
in: path
name: id
required: true
type: string
- description: New organization details
in: body
name: request
required: true
schema:
$ref: '#/definitions/org.UpdateOrgRequest'
produces:
- application/json
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'
security:
- Bearer: []
summary: Update organization
tags:
- organizations
schemes:
- http
securityDefinitions: