feat: add dataset item images
This commit is contained in:
@@ -40,6 +40,7 @@ type ItemDTO struct {
|
||||
Summary string `json:"summary"`
|
||||
Content string `json:"content"`
|
||||
URL string `json:"url"`
|
||||
ImageURL string `json:"imageUrl"`
|
||||
Status string `json:"status"`
|
||||
Starred bool `json:"starred"`
|
||||
PublishedAt *time.Time `json:"publishedAt"`
|
||||
@@ -231,6 +232,7 @@ func (h *Handler) createItem(c *gin.Context) {
|
||||
Summary string `json:"summary"`
|
||||
Content string `json:"content"`
|
||||
URL string `json:"url"`
|
||||
ImageURL string `json:"imageUrl"`
|
||||
PublishedAt string `json:"publishedAt"`
|
||||
}
|
||||
if err := c.ShouldBindJSON(&input); err != nil {
|
||||
@@ -244,7 +246,8 @@ func (h *Handler) createItem(c *gin.Context) {
|
||||
}
|
||||
item, err := h.service.CreateItem(userID, ItemInput{
|
||||
SourceIdentity: input.SourceID, Title: input.Title, Summary: input.Summary,
|
||||
Content: input.Content, URL: input.URL, PublishedAt: publishedAt,
|
||||
Content: input.Content, URL: input.URL, ImageURL: input.ImageURL,
|
||||
PublishedAt: publishedAt,
|
||||
})
|
||||
if err != nil {
|
||||
writeError(c, err)
|
||||
@@ -366,7 +369,8 @@ func sourceDTO(source models.SaDatasetSource, itemCount int64) SourceDTO {
|
||||
func itemDTO(item models.SaDatasetItem) ItemDTO {
|
||||
return ItemDTO{
|
||||
ID: item.Identity, SourceID: item.SourceIdentity, Title: item.Title,
|
||||
Summary: item.Summary, Content: item.Content, URL: item.URL, Status: item.Status,
|
||||
Summary: item.Summary, Content: item.Content, URL: item.URL,
|
||||
ImageURL: item.ImageURL, Status: item.Status,
|
||||
Starred: item.Starred, PublishedAt: utcTime(item.PublishedAt),
|
||||
CreatedAt: item.CreatedAt.UTC(), UpdatedAt: item.UpdatedAt.UTC(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user