feat: seed default dataset sources
This commit is contained in:
@@ -22,6 +22,7 @@ type SourceDTO struct {
|
||||
Name string `json:"name"`
|
||||
Kind string `json:"kind"`
|
||||
URL string `json:"url"`
|
||||
IconURL string `json:"iconUrl"`
|
||||
Description string `json:"description"`
|
||||
Enabled bool `json:"enabled"`
|
||||
LastSyncedAt *time.Time `json:"lastSyncedAt"`
|
||||
@@ -61,6 +62,7 @@ type sourceRequest struct {
|
||||
Name string `json:"name"`
|
||||
Kind string `json:"kind"`
|
||||
URL string `json:"url"`
|
||||
IconURL string `json:"iconUrl"`
|
||||
Description string `json:"description"`
|
||||
Enabled *bool `json:"enabled"`
|
||||
}
|
||||
@@ -113,7 +115,8 @@ func (h *Handler) createSource(c *gin.Context) {
|
||||
enabled = *input.Enabled
|
||||
}
|
||||
source, err := h.service.CreateSource(userID, SourceInput{
|
||||
Name: input.Name, Kind: input.Kind, URL: input.URL, Description: input.Description, Enabled: enabled,
|
||||
Name: input.Name, Kind: input.Kind, URL: input.URL, IconURL: input.IconURL,
|
||||
Description: input.Description, Enabled: enabled,
|
||||
})
|
||||
if err != nil {
|
||||
writeError(c, err)
|
||||
@@ -141,7 +144,8 @@ func (h *Handler) updateSource(c *gin.Context) {
|
||||
enabled = *input.Enabled
|
||||
}
|
||||
source, err := h.service.UpdateSource(userID, identity, SourceInput{
|
||||
Name: input.Name, Kind: input.Kind, URL: input.URL, Description: input.Description, Enabled: enabled,
|
||||
Name: input.Name, Kind: input.Kind, URL: input.URL, IconURL: input.IconURL,
|
||||
Description: input.Description, Enabled: enabled,
|
||||
})
|
||||
if err != nil {
|
||||
writeError(c, err)
|
||||
@@ -308,7 +312,7 @@ func writeInvalidRequest(c *gin.Context) {
|
||||
func sourceDTO(source models.SaDatasetSource, itemCount int64) SourceDTO {
|
||||
return SourceDTO{
|
||||
ID: source.Identity, Name: source.Name, Kind: source.Kind, URL: source.URL,
|
||||
Description: source.Description, Enabled: source.Enabled,
|
||||
IconURL: source.IconURL, Description: source.Description, Enabled: source.Enabled,
|
||||
LastSyncedAt: utcTime(source.LastSyncedAt), ItemCount: itemCount,
|
||||
CreatedAt: source.CreatedAt.UTC(), UpdatedAt: source.UpdatedAt.UTC(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user