merge conflict

This commit is contained in:
James Tombleson 2023-01-22 10:11:10 -08:00
commit da6f1fb54b
4 changed files with 55 additions and 9 deletions

45
database/dto.go Normal file
View File

@ -0,0 +1,45 @@
package database
import (
"strings"
"github.com/google/uuid"
)
type SourceDto struct {
ID uuid.UUID `json:"id"`
Site string `json:"site"`
Name string `json:"name"`
Source string `json:"source"`
Type string `json:"type"`
Value string `json:"value"`
Enabled bool `json:"enabled"`
Url string `json:"url"`
Tags []string `json:"tags"`
Deleted bool `json:"deleted"`
}
func ConvertToSourceDto(i Source) SourceDto {
var deleted bool
if !i.Deleted.Valid {
deleted = true
}
return SourceDto{
ID: i.ID,
Site: i.Site,
Name: i.Name,
Source: i.Source,
Type: i.Type,
Value: i.Value.String,
Enabled: i.Enabled,
Url: i.Url,
Tags: splitTags(i.Tags),
Deleted: deleted,
}
}
func splitTags(t string) []string {
items := strings.Split(t, ", ")
return items
}

View File

@ -237,15 +237,13 @@ const docTemplate = `{
} }
], ],
"responses": {} "responses": {}
} },
}, "delete": {
"/discord/webhooks/{ID}/enable": {
"post": {
"tags": [ "tags": [
"Discord", "Config",
"Webhook" "Source"
], ],
"summary": "Enables a source to continue processing.", "summary": "Deletes a record by ID.",
"parameters": [ "parameters": [
{ {
"type": "string", "type": "string",

View File

@ -318,13 +318,15 @@ paths:
/discord/webhooks/{ID}: /discord/webhooks/{ID}:
delete: delete:
parameters: parameters:
- description: id - description: uuid
in: path in: path
name: id name: id
required: true required: true
type: string type: string
produces:
- application/json
responses: {} responses: {}
summary: Deletes a record by ID. summary: Returns a single entity by ID
tags: tags:
- Discord - Discord
- Webhook - Webhook

View File

@ -383,6 +383,7 @@ func (s *Server) newTwitchSource(w http.ResponseWriter, r *http.Request) {
// DeleteSource // DeleteSource
// @Summary Marks a source as deleted based on its ID value. // @Summary Marks a source as deleted based on its ID value.
// @Summary Marks a source as deleted based on its ID value.
// @Param id path string true "id" // @Param id path string true "id"
// @Tags Source // @Tags Source
// @Router /sources/{id} [POST] // @Router /sources/{id} [POST]