Files
backend/docs/swagger.yaml
2026-04-07 10:51:12 +02:00

1234 lines
30 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.CategoryLocalizedResponse:
properties:
id:
type: integer
language:
type: string
name:
type: string
translation:
items:
$ref: '#/definitions/models.CategoryTranslation'
type: array
required:
- id
- language
- name
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
models.Ressource:
properties:
category:
$ref: '#/definitions/models.Category'
createdAt:
type: string
deletedAt:
$ref: '#/definitions/gorm.DeletedAt'
feedback:
items:
$ref: '#/definitions/models.RessourceFeedback'
type: array
id:
type: integer
image:
type: string
region:
type: string
spokenLanguages:
type: string
tag:
type: string
translations:
items:
$ref: '#/definitions/models.RessourceTranslation'
type: array
updatedAt:
type: string
type: object
models.RessourceFeedback:
properties:
createdAt:
type: string
deletedAt:
$ref: '#/definitions/gorm.DeletedAt'
id:
type: integer
name:
type: string
ressourceID:
type: integer
text:
type: string
updatedAt:
type: string
type: object
models.RessourceLocalizedResponse:
properties:
category:
$ref: '#/definitions/models.Category'
categoryName:
type: string
id:
type: integer
image:
type: string
language:
type: string
metadata:
type: string
name:
type: string
region:
type: string
spokenLanguages:
type: string
tag:
type: string
text:
type: string
translations:
items:
$ref: '#/definitions/models.RessourceTranslation'
type: array
required:
- categoryName
- id
- language
- name
- region
- text
type: object
models.RessourceRequest:
properties:
categoryId:
type: integer
image:
type: string
region:
type: string
spokenLanguages:
type: string
tag:
type: string
translations:
items:
$ref: '#/definitions/models.RessourceTranslationRequest'
type: array
required:
- categoryId
- region
- translations
type: object
models.RessourceTranslation:
properties:
createdAt:
type: string
deletedAt:
$ref: '#/definitions/gorm.DeletedAt'
id:
type: integer
languageID:
type: integer
metadata:
type: string
name:
type: string
ressourceID:
type: integer
text:
type: string
updatedAt:
type: string
type: object
models.RessourceTranslationRequest:
properties:
languageId:
type: integer
metadata:
type: string
name:
type: string
ressourceId:
type: integer
text:
type: string
required:
- languageId
- name
- ressourceId
- text
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
parameters:
- description: Language code of language that should be returned. Defaults to
'en'
in: query
name: lang
type: string
- description: Comma-separated related resources to include
in: query
name: include
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/models.CategoryLocalizedResponse'
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: Language code of language that should be returned. Defaults to
'en'
in: query
name: lang
type: string
- description: Comma-separated related resources to include
in: query
name: include
type: string
- 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.CategoryLocalizedResponse'
"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
/ressource/:
get:
consumes:
- application/json
parameters:
- description: Language code of language that should be returned. Defaults to
'en'
in: query
name: lang
type: string
- description: Comma-separated related resources to include
in: query
name: include
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/models.RessourceLocalizedResponse'
type: array
"400":
description: Bad Request
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: List all ressources
tags:
- ressource
post:
consumes:
- application/json
parameters:
- description: ressource
in: body
name: ressource
required: true
schema:
$ref: '#/definitions/models.RessourceRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Ressource'
"400":
description: Bad Request
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: Create a ressource
tags:
- ressource
/ressource/{id}:
delete:
consumes:
- application/json
parameters:
- description: A unique integer value identifying this ressource.
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 ressource
tags:
- ressource
get:
consumes:
- application/json
parameters:
- description: Language code of language that should be returned. Defaults to
'en'
in: query
name: lang
type: string
- description: Comma-separated related resources to include
in: query
name: include
type: string
- description: A unique integer value identifying this ressource.
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.RessourceLocalizedResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: Retreive a ressource
tags:
- ressource
patch:
consumes:
- application/json
parameters:
- description: A unique integer value identifying this ressource.
in: path
name: id
required: true
type: integer
- description: partially updated ressource
in: body
name: ressource
required: true
schema:
$ref: '#/definitions/models.RessourceRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Ressource'
"400":
description: Bad Request
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: Partially update an existing ressource
tags:
- ressource
put:
consumes:
- application/json
parameters:
- description: A unique integer value identifying this ressource.
in: path
name: id
required: true
type: integer
- description: updated ressource
in: body
name: ressource
required: true
schema:
$ref: '#/definitions/models.RessourceRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Ressource'
"400":
description: Bad Request
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: Update an existing ressource
tags:
- ressource
/ressource/{id}/translation:
get:
consumes:
- application/json
parameters:
- description: A unique integer value identifying the ressource.
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/models.RessourceTranslation'
type: array
"400":
description: Bad Request
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: List all ressource translations
tags:
- ressource
post:
consumes:
- application/json
parameters:
- description: ressource translation
in: body
name: ressource
required: true
schema:
$ref: '#/definitions/models.RessourceTranslationRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.RessourceTranslation'
"400":
description: Bad Request
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: Create a ressource translation
tags:
- ressource
/ressource/{id}/translation/{id}:
delete:
consumes:
- application/json
parameters:
- description: A unique integer value identifying this ressource.
in: path
name: id
required: true
type: integer
- description: A unique integer value identifying the ressource 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 ressource translation
tags:
- ressource
get:
consumes:
- application/json
parameters:
- description: A unique integer value identifying the ressource.
in: path
name: id
required: true
type: integer
- description: A unique integer value identifying the ressource translation.
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.RessourceTranslation'
"400":
description: Bad Request
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: Retreive a ressource translation
tags:
- ressource
patch:
consumes:
- application/json
parameters:
- description: A unique integer value identifying this ressource.
in: path
name: id
required: true
type: integer
- description: A unique integer value identifying the ressource translation.
in: path
name: id
required: true
type: integer
- description: partially updated ressource translation
in: body
name: ressource
required: true
schema:
$ref: '#/definitions/models.RessourceTranslationRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.RessourceTranslation'
"400":
description: Bad Request
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: Partially update an existing ressource translation
tags:
- ressource
put:
consumes:
- application/json
parameters:
- description: A unique integer value identifying this ressource.
in: path
name: id
required: true
type: integer
- description: A unique integer value identifying the ressource translation.
in: path
name: id
required: true
type: integer
- description: updated ressource translation
in: body
name: ressource
required: true
schema:
$ref: '#/definitions/models.RessourceTranslationRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.RessourceTranslation'
"400":
description: Bad Request
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: Update an existing ressource translation
tags:
- ressource
/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"