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

713 lines
17 KiB
YAML

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