From 3d2420343c54135f502a947d23e1ee028bd7dc41 Mon Sep 17 00:00:00 2001 From: James Tombleson Date: Sun, 28 Apr 2024 11:41:55 -0700 Subject: [PATCH] cleaning up the dto's and making new response types --- internal/domain/dto.go | 56 +++++++++++------------------------- internal/domain/responses.go | 23 ++++++++++++++- 2 files changed, 39 insertions(+), 40 deletions(-) diff --git a/internal/domain/dto.go b/internal/domain/dto.go index 4109cab..0a59cd6 100644 --- a/internal/domain/dto.go +++ b/internal/domain/dto.go @@ -3,33 +3,26 @@ package domain import "time" type ArticleDto struct { - ID int64 `json:"id"` - SourceID int64 `json:"sourceId"` - Tags string `json:"tags"` - Title string `json:"title"` - Url string `json:"url"` - PubDate time.Time `json:"pubDate"` - Video string `json:"video"` - VideoHeight uint16 `json:"videoHeight"` - VideoWidth uint16 `json:"videoWidth"` - Thumbnail string `json:"thumbnail"` - Description string `json:"description"` - AuthorName string `json:"authorName"` - AuthorImage string `json:"authorImage"` + ID int64 `json:"id"` + SourceID int64 `json:"sourceId"` + Tags string `json:"tags"` + Title string `json:"title"` + Url string `json:"url"` + PubDate time.Time `json:"pubDate"` + IsVideo bool `json:"isVideo"` + Thumbnail string `json:"thumbnail"` + Description string `json:"description"` + AuthorName string `json:"authorName"` + AuthorImageUrl string `json:"authorImage"` } type DiscordQueueDto struct { - //CreatedAt time.Time `json:"createdAt"` - //UpdatedAt time.Time `json:"updatedAt"` ID int64 `json:"id"` ArticleId int64 `json:"articleId"` SourceId int64 `json:"sourceId"` } type DiscordWebHookDto struct { - //CreatedAt time.Time `json:"CreatedAt"` - //UpdatedAt time.Time `json:"UpdatedAt"` - //DeletedAt time.Time `json:"DeletedAt"` ID uint `json:"id"` Name string `json:"name"` Key string `json:"key"` @@ -40,18 +33,12 @@ type DiscordWebHookDto struct { } type IconDto struct { - //CreatedAt time.Time `json:"CreatedAt"` - //UpdatedAt time.Time `json:"UpdatedAt"` - //DeletedAt time.Time `json:"DeletedAt"` ID int64 `json:"id"` FileName string `json:"fileName"` Site string `json:"site"` } type SettingDto struct { - //CreatedAt time.Time `json:"CreatedAt"` - //UpdatedAt time.Time `json:"UpdatedAt"` - //DeletedAt time.Time `json:"DeletedAt"` ID int64 `json:"id"` Key string `json:"key"` Value string `json:"value"` @@ -59,9 +46,6 @@ type SettingDto struct { } type SubscriptionDto struct { - //CreatedAt time.Time `json:"CreatedAt"` - //UpdatedAt time.Time `json:"UpdatedAt"` - //DeletedAt time.Time `json:"DeletedAt"` ID int64 `json:"id"` SourceID int64 `json:"sourceId"` SourceType string `json:"sourceType"` @@ -71,16 +55,10 @@ type SubscriptionDto struct { } type SourceDto struct { - //CreatedAt time.Time `json:"CreatedAt"` - //UpdatedAt time.Time `json:"UpdatedAt"` - //DeletedAt time.Time `json:"DeletedAt"` - ID int64 `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"` + ID int64 `json:"id"` + Source string `json:"source"` + DisplayName string `json:"name"` + Url string `json:"url"` + Tags string `json:"tags"` + Enabled bool `json:"enabled"` } diff --git a/internal/domain/responses.go b/internal/domain/responses.go index b4805a6..5175940 100644 --- a/internal/domain/responses.go +++ b/internal/domain/responses.go @@ -1,5 +1,26 @@ package domain -type ErrorResponse struct { + +type BaseResponse struct { Message string `json:"message"` +} + +type ArticleResponse struct { + BaseResponse + Payload []ArticleDto `json:"payload"` +} + +type ArticleAndSourceModel struct { + Article ArticleDto `json:"article"` + Source SourceDto `json:"source"` +} + +type ArticleDetailResponse struct { + BaseResponse + Payload ArticleAndSourceModel `json:"payload"` +} + +type DiscordWebhookResponse struct { + BaseResponse + Payload []DiscordWebHookDto `json:"payload"` } \ No newline at end of file