merge conflict
This commit is contained in:
commit
da6f1fb54b
45
database/dto.go
Normal file
45
database/dto.go
Normal 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
|
||||
}
|
10
docs/docs.go
10
docs/docs.go
@ -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",
|
||||
|
@ -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
|
||||
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user