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": {}
}
},
"/discord/webhooks/{ID}/enable": {
"post": {
"delete": {
"tags": [
"Discord",
"Webhook"
"Config",
"Source"
],
"summary": "Enables a source to continue processing.",
"summary": "Deletes a record by ID.",
"parameters": [
{
"type": "string",

View File

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

View File

@ -383,6 +383,7 @@ func (s *Server) newTwitchSource(w http.ResponseWriter, r *http.Request) {
// DeleteSource
// @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"
// @Tags Source
// @Router /sources/{id} [POST]