This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"kontor-api-gin/internal/helpers"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Issue struct {
|
||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||
@@ -26,16 +29,19 @@ func (issue *Issue) TableName() string {
|
||||
}
|
||||
|
||||
type IssueDTO struct {
|
||||
ID string `json:"id" binding:"required"`
|
||||
CreatedAt time.Time `json:"created_date"`
|
||||
UpdatedAt time.Time `json:"last_modified_date"`
|
||||
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
||||
Version int `json:"version"`
|
||||
Title string `json:"title"`
|
||||
PublishedOn time.Time `json:"published_on"`
|
||||
ComicID *string `json:"comic_id"`
|
||||
StoryArcID *string `json:"story_arc_id"`
|
||||
VolumeID *string `json:"volume_id"`
|
||||
ID string `json:"id" binding:"required"`
|
||||
CreatedAt helpers.KontorTime `json:"created_date"`
|
||||
UpdatedAt helpers.KontorTime `json:"last_modified_date"`
|
||||
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
||||
Version int `json:"version"`
|
||||
IssueNumber string `json:"issue_number"`
|
||||
Title string `json:"title"`
|
||||
PublishedOn helpers.DateOnly `json:"published_on"`
|
||||
InStock bool `json:"in_stock"`
|
||||
IsRead bool `json:"is_read"`
|
||||
ComicID *string `json:"comic_id"`
|
||||
VolumeID *string `json:"volume_id"`
|
||||
StoryArcID *string `json:"story_arc_id"`
|
||||
}
|
||||
|
||||
func ConvertIssuesToDtos(issues []Issue) []IssueDTO {
|
||||
@@ -43,15 +49,18 @@ func ConvertIssuesToDtos(issues []Issue) []IssueDTO {
|
||||
for i, issue := range issues {
|
||||
dtos[i] = IssueDTO{
|
||||
ID: issue.ID,
|
||||
CreatedAt: issue.CreatedAt,
|
||||
UpdatedAt: issue.UpdatedAt,
|
||||
CreatedAt: helpers.KontorTime{Time: issue.CreatedAt},
|
||||
UpdatedAt: helpers.KontorTime{Time: issue.UpdatedAt},
|
||||
DeletedAt: issue.DeletedAt,
|
||||
Version: issue.Version,
|
||||
IssueNumber: issue.IssueNumber,
|
||||
Title: issue.Title,
|
||||
PublishedOn: issue.PublishedOn,
|
||||
PublishedOn: helpers.DateOnly{Time: issue.PublishedOn},
|
||||
InStock: issue.InStock,
|
||||
IsRead: issue.IsRead,
|
||||
ComicID: issue.ComicID,
|
||||
StoryArcID: issue.StoryArcID,
|
||||
VolumeID: issue.VolumeID,
|
||||
StoryArcID: issue.StoryArcID,
|
||||
}
|
||||
}
|
||||
return dtos
|
||||
|
||||
Reference in New Issue
Block a user