From d1a4d10df0e8e9f0e55844d2b045c7969811c3bc Mon Sep 17 00:00:00 2001 From: James Tombleson Date: Fri, 26 Apr 2024 16:02:59 -0700 Subject: [PATCH] cleaned up the dto's and entities to make them more like what I am use to --- internal/domain/dto.go | 87 ++++++++++++++++++++- internal/domain/entity.go | 160 +++++++++++++++++++++----------------- 2 files changed, 175 insertions(+), 72 deletions(-) diff --git a/internal/domain/dto.go b/internal/domain/dto.go index 7d0427a..4109cab 100644 --- a/internal/domain/dto.go +++ b/internal/domain/dto.go @@ -1 +1,86 @@ -package domain \ No newline at end of file +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"` +} + +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"` + Url string `json:"url"` + Server string `json:"server"` + Channel string `json:"channel"` + Enabled bool `json:"enabled"` +} + +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"` + Options string `json:"options"` +} + +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"` + SourceName string `json:"sourceName"` + DiscordID int64 `json:"discordId"` + DiscordName string `json:"discordName"` +} + +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"` +} diff --git a/internal/domain/entity.go b/internal/domain/entity.go index c5dfa9c..ab8ddcc 100644 --- a/internal/domain/entity.go +++ b/internal/domain/entity.go @@ -4,87 +4,105 @@ import ( "time" ) -// Articles represents the model for an Article -type Articles struct { - ID uint `json:"ID"` - SourceID uint `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"` +type ArticleEntity struct { + ID int64 + CreatedAt time.Time + LastUpdated time.Time + DeletedAt time.Time + SourceID int64 + Tags string + Title string + Url string + PubDate time.Time + Thumbnail string + Description string + AuthorName string + AuthorImageUrl string } -type DiscordQueue struct { - ID uint `json:"ID"` - CreatedAt time.Time `json:"CreatedAt"` - UpdatedAt time.Time `json:"UpdatedAt"` - DeletedAt time.Time `json:"DeletedAt"` - ArticleId string `json:"articleId"` +type DiscordQueueEntity struct { + ID int64 + CreatedAt time.Time + LastUpdated time.Time + DeletedAt time.Time + ArticleId int64 + SourceId int64 } -type DiscordWebHooks struct { - ID uint `json:"ID"` - CreatedAt time.Time `json:"CreatedAt"` - UpdatedAt time.Time `json:"UpdatedAt"` - DeletedAt time.Time `json:"DeletedAt"` - - Name string `json:"name"` - Key string `json:"key"` - Url string `json:"url"` - Server string `json:"server"` - Channel string `json:"channel"` - Enabled bool `json:"enabled"` +type DiscordWebHookEntity struct { + ID int64 + CreatedAt time.Time + UpdatedAt time.Time + DeletedAt time.Time + Name string + Key string + Url string + Server string + Channel string + Enabled bool } -type Icons struct { - ID uint `json:"ID"` - CreatedAt time.Time `json:"CreatedAt"` - UpdatedAt time.Time `json:"UpdatedAt"` - DeletedAt time.Time `json:"DeletedAt"` - - FileName string `json:"fileName"` - Site string `json:"site"` +type IconEntity struct { + ID int64 + CreatedAt time.Time + UpdatedAt time.Time + DeletedAt time.Time + FileName string + Site string } -type Settings struct { - ID uint `json:"ID"` - CreatedAt time.Time `json:"CreatedAt"` - UpdatedAt time.Time `json:"UpdatedAt"` - DeletedAt time.Time `json:"DeletedAt"` - - Key string `json:"key"` - Value string `json:"value"` - Options string `json:"options"` +type SettingEntity struct { + ID int64 + CreatedAt time.Time + UpdatedAt time.Time + DeletedAt time.Time + Key string + Value string + Options string } -type Sources struct { - ID uint `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"` +type SourceEntity struct { + ID int64 + CreatedAt time.Time + UpdatedAt time.Time + DeletedAt time.Time + Site string + Name string + Source string + Type string + Value string + Enabled bool + Url string + Tags string } -type SourceLinks struct { - ID uint `json:"ID"` - CreatedAt time.Time `json:"CreatedAt"` - UpdatedAt time.Time `json:"UpdatedAt"` - DeletedAt time.Time `json:"DeletedAt"` - - SourceID uint `json:"sourceId"` - SourceType string `json:"sourceType"` - SourceName string `json:"sourceName"` - DiscordID uint `json:"discordId"` - DiscordName string `json:"discordName"` +type SubscriptionEntity struct { + ID int64 + CreatedAt time.Time + UpdatedAt time.Time + DeletedAt time.Time + SourceID int64 + SourceType string + SourceName string + DiscordID int64 + DiscordName string +} + +type UserEntity struct { + ID int64 + CreatedAt time.Time + UpdatedAt time.Time + DeletedAt time.Time + Username string + Hash string + Scopes string +} + +type RefreshTokenEntity struct { + ID int64 + CreatedAt time.Time + UpdatedAt time.Time + DeletedAt time.Time + Username string + Token string }