Skip to content

Commit

Permalink
feat(about): load at startup service from file into db and give about…
Browse files Browse the repository at this point in the history
….json as templated
  • Loading branch information
Djangss committed Dec 5, 2024
1 parent 21068ba commit 4978bbc
Show file tree
Hide file tree
Showing 11 changed files with 520 additions and 53 deletions.
131 changes: 123 additions & 8 deletions server/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ const docTemplate = `{
"paths": {
"/about.json": {
"get": {
"description": "about",
"security": [
{
"Bearer": []
}
],
"description": "Get information about the server",
"consumes": [
"application/json"
],
Expand All @@ -36,12 +41,13 @@ const docTemplate = `{
"tags": [
"about"
],
"summary": "About",
"summary": "Get information about the server",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "msg"
"type": "object",
"additionalProperties": true
}
}
}
Expand Down Expand Up @@ -240,6 +246,11 @@ const docTemplate = `{
},
"/workflow/create": {
"post": {
"security": [
{
"Bearer": []
}
],
"description": "Create a new workflow",
"consumes": [
"application/json"
Expand All @@ -258,15 +269,15 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.Workflow"
"$ref": "#/definitions/models.WorkflowDTO"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Workflow"
"$ref": "#/definitions/models.WorkflowDTO"
}
},
"400": {
Expand All @@ -283,6 +294,11 @@ const docTemplate = `{
},
"/workflow/delete/{id}": {
"delete": {
"security": [
{
"Bearer": []
}
],
"description": "Delete a workflow by ID",
"consumes": [
"application/json"
Expand Down Expand Up @@ -345,6 +361,11 @@ const docTemplate = `{
},
"/workflow/list": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "List all workflows",
"consumes": [
"application/json"
Expand All @@ -362,7 +383,7 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Workflow"
"$ref": "#/definitions/models.WorkflowDTO"
}
}
}
Expand All @@ -371,6 +392,40 @@ const docTemplate = `{
}
},
"definitions": {
"models.EventDTO": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"name": {
"type": "string"
},
"parameters": {
"type": "array",
"items": {
"$ref": "#/definitions/models.ParametersDTO"
}
},
"service_id": {
"type": "integer"
},
"type": {
"$ref": "#/definitions/models.EventType"
}
}
},
"models.EventType": {
"type": "string",
"enum": [
"action",
"reaction"
],
"x-enum-varnames": [
"ActionEventType",
"ReactionEventType"
]
},
"models.LoginRequest": {
"type": "object",
"required": [
Expand All @@ -386,6 +441,23 @@ const docTemplate = `{
}
}
},
"models.ParametersDTO": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"event_id": {
"type": "integer"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"models.RegisterRequest": {
"type": "object",
"required": [
Expand All @@ -405,8 +477,51 @@ const docTemplate = `{
}
}
},
"models.Workflow": {
"type": "object"
"models.WorkflowDTO": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"events": {
"type": "array",
"items": {
"$ref": "#/definitions/models.EventDTO"
}
},
"is_active": {
"type": "boolean"
},
"name": {
"type": "string"
},
"status": {
"$ref": "#/definitions/models.WorkflowStatus"
},
"user_id": {
"type": "integer"
}
}
},
"models.WorkflowStatus": {
"type": "string",
"enum": [
"pending",
"processed",
"failed"
],
"x-enum-varnames": [
"WorkflowStatusPending",
"WorkflowStatusProcessed",
"WorkflowStatusFailed"
]
}
},
"securityDefinitions": {
"BearerAuth": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}`
Expand Down
Loading

0 comments on commit 4978bbc

Please sign in to comment.