Files
backend/docs/swagger.json
2026-04-07 00:44:29 +02:00

1081 lines
35 KiB
JSON

{
"swagger": "2.0",
"info": {
"description": "This is harakat backend server.",
"title": "Harakat Rest-API",
"termsOfService": "TODO",
"contact": {
"name": "TODO",
"url": "TODO",
"email": "TODO"
},
"license": {
"name": "TODO",
"url": "TODO"
},
"version": "0.1"
},
"host": "localhost:8080",
"basePath": "/api/v0",
"paths": {
"/category/": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"category"
],
"summary": "List all categories",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Category"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"category"
],
"summary": "Create a category",
"parameters": [
{
"description": "category",
"name": "category",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.CategoryRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Category"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
},
"/category/{id}": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"category"
],
"summary": "Retreive a category",
"parameters": [
{
"type": "integer",
"description": "A unique integer value identifying this category.",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Category"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
},
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"category"
],
"summary": "Update an existing category",
"parameters": [
{
"type": "integer",
"description": "A unique integer value identifying this category.",
"name": "id",
"in": "path",
"required": true
},
{
"description": "updated category",
"name": "category",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.CategoryRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Category"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"category"
],
"summary": "Delete an existing category",
"parameters": [
{
"type": "integer",
"description": "A unique integer value identifying this category.",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.EmptyResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
},
"patch": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"category"
],
"summary": "Partially update an existing category",
"parameters": [
{
"type": "integer",
"description": "A unique integer value identifying this category.",
"name": "id",
"in": "path",
"required": true
},
{
"description": "partially updated category",
"name": "category",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.CategoryRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Category"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
},
"/category/{id}/translation": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"category"
],
"summary": "List all category translations",
"parameters": [
{
"type": "integer",
"description": "A unique integer value identifying the category.",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.CategoryTranslation"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"category"
],
"summary": "Create a category translation",
"parameters": [
{
"description": "category translation",
"name": "category",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.CategoryTranslationRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.CategoryTranslation"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
},
"/category/{id}/translation/{id}": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"category"
],
"summary": "Retreive a category translation",
"parameters": [
{
"type": "integer",
"description": "A unique integer value identifying the category.",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "A unique integer value identifying the category translation.",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.CategoryTranslation"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
},
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"category"
],
"summary": "Update an existing category translation",
"parameters": [
{
"type": "integer",
"description": "A unique integer value identifying this category.",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "A unique integer value identifying the category translation.",
"name": "id",
"in": "path",
"required": true
},
{
"description": "updated category translation",
"name": "category",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.CategoryTranslationRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.CategoryTranslation"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"category"
],
"summary": "Delete an existing category translation",
"parameters": [
{
"type": "integer",
"description": "A unique integer value identifying this category.",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "A unique integer value identifying the category translation.",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.EmptyResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
},
"patch": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"category"
],
"summary": "Partially update an existing category translation",
"parameters": [
{
"type": "integer",
"description": "A unique integer value identifying this category.",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "A unique integer value identifying the category translation.",
"name": "id",
"in": "path",
"required": true
},
{
"description": "partially updated category translation",
"name": "category",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.CategoryTranslationRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.CategoryTranslation"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
},
"/lang/": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"lang"
],
"summary": "List all languages",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Language"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"lang"
],
"summary": "Create a language",
"parameters": [
{
"description": "language",
"name": "lang",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.LanguageRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Language"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
},
"/lang/{id}": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"lang"
],
"summary": "Retreive a language",
"parameters": [
{
"type": "integer",
"description": "A unique integer value identifying this language.",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Language"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
},
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"lang"
],
"summary": "Update an existing language",
"parameters": [
{
"type": "integer",
"description": "A unique integer value identifying this language.",
"name": "id",
"in": "path",
"required": true
},
{
"description": "updated language",
"name": "lang",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.LanguageRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Language"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"lang"
],
"summary": "Delete an existing language",
"parameters": [
{
"type": "integer",
"description": "A unique integer value identifying this language.",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.EmptyResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
},
"patch": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"lang"
],
"summary": "Partially update an existing language",
"parameters": [
{
"type": "integer",
"description": "A unique integer value identifying this language.",
"name": "id",
"in": "path",
"required": true
},
{
"description": "partially updated language",
"name": "lang",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.LanguageRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Language"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
},
"/user/login": {
"post": {
"description": "Login user",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Login user",
"parameters": [
{
"description": "user data",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/controllers.LoginRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.EmptyResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
},
"/user/register/{token}": {
"post": {
"description": "register user with invite token",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Register user with invite token",
"parameters": [
{
"type": "string",
"description": "invite token",
"name": "token",
"in": "path"
},
{
"description": "user data",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/controllers.RegisterRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.EmptyResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
},
"/user/status": {
"get": {
"description": "Get user status of current session",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "User Status",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.EmptyResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
}
},
"definitions": {
"controllers.EmptyResponse": {
"type": "object"
},
"controllers.LoginRequest": {
"type": "object",
"required": [
"email",
"password"
],
"properties": {
"email": {
"type": "string"
},
"password": {
"type": "string"
}
}
},
"controllers.RegisterRequest": {
"type": "object",
"required": [
"email",
"name",
"password"
],
"properties": {
"email": {
"type": "string"
},
"name": {
"type": "string"
},
"password": {
"type": "string"
}
}
},
"gorm.DeletedAt": {
"type": "object",
"properties": {
"time": {
"type": "string"
},
"valid": {
"description": "Valid is true if Time is not NULL",
"type": "boolean"
}
}
},
"httputil.HTTPError": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"example": 400
},
"message": {
"type": "string",
"example": "status bad request"
}
}
},
"models.Category": {
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"deletedAt": {
"$ref": "#/definitions/gorm.DeletedAt"
},
"id": {
"type": "integer"
},
"translations": {
"type": "array",
"items": {
"$ref": "#/definitions/models.CategoryTranslation"
}
},
"updatedAt": {
"type": "string"
}
}
},
"models.CategoryRequest": {
"type": "object",
"required": [
"translations"
],
"properties": {
"translations": {
"type": "array",
"items": {
"$ref": "#/definitions/models.CategoryTranslationRequest"
}
}
}
},
"models.CategoryTranslation": {
"type": "object",
"properties": {
"categoryID": {
"type": "integer"
},
"createdAt": {
"type": "string"
},
"deletedAt": {
"$ref": "#/definitions/gorm.DeletedAt"
},
"id": {
"type": "integer"
},
"languageID": {
"type": "integer"
},
"name": {
"type": "string"
},
"updatedAt": {
"type": "string"
}
}
},
"models.CategoryTranslationRequest": {
"type": "object",
"required": [
"languageId",
"name"
],
"properties": {
"languageId": {
"type": "integer"
},
"name": {
"type": "string"
}
}
},
"models.Language": {
"type": "object",
"required": [
"code",
"name"
],
"properties": {
"code": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"deletedAt": {
"$ref": "#/definitions/gorm.DeletedAt"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"updatedAt": {
"type": "string"
}
}
},
"models.LanguageRequest": {
"type": "object",
"required": [
"code",
"name"
],
"properties": {
"code": {
"type": "string"
},
"name": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"BasicAuth": {
"type": "basic"
}
},
"externalDocs": {
"description": "OpenAPI",
"url": "https://swagger.io/resources/open-api/"
}
}