add Database type to cli and server config
This commit is contained in:
@@ -6,13 +6,13 @@ import (
|
||||
)
|
||||
|
||||
type Article struct {
|
||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||
CreatedAt time.Time `gorm:"column:created_date" json:"created_date"`
|
||||
UpdatedAt time.Time `gorm:"column:last_modified_date" json:"last_modified_date"`
|
||||
DeletedAt *time.Time `gorm:"column:deleted_date" json:"deleted_date"`
|
||||
Version int `gorm:"default:0" json:"version"`
|
||||
Title string `gorm:"uniqueIndex" json:"title"`
|
||||
ArticleAuthors []ArticleAuthor `gorm:"foreignKey:ArticleID" json:"article_authors"`
|
||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||
CreatedAt time.Time `gorm:"column:created_date" json:"created_date"`
|
||||
UpdatedAt time.Time `gorm:"column:last_modified_date" json:"last_modified_date"`
|
||||
DeletedAt *time.Time `gorm:"column:deleted_date" json:"deleted_date"`
|
||||
Version int `gorm:"default:0" json:"version"`
|
||||
Title string `gorm:"uniqueIndex" json:"title"`
|
||||
ArticleAuthors []ArticleAuthor `gorm:"foreignKey:ArticleID" json:"article_authors"`
|
||||
}
|
||||
|
||||
func (article *Article) TableName() string {
|
||||
@@ -20,24 +20,24 @@ func (article *Article) TableName() string {
|
||||
}
|
||||
|
||||
type ArticleDTO struct {
|
||||
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"`
|
||||
Title string `json:"title"`
|
||||
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"`
|
||||
Title string `json:"title"`
|
||||
}
|
||||
|
||||
func ConvertArticlesToDtos(articles []Article) []ArticleDTO {
|
||||
dtos := make([]ArticleDTO, len(articles))
|
||||
for i, article := range articles {
|
||||
dtos[i] = ArticleDTO{
|
||||
ID: article.ID,
|
||||
CreatedAt: helpers.KontorTime{Time: article.CreatedAt},
|
||||
UpdatedAt: helpers.KontorTime{Time: article.UpdatedAt},
|
||||
DeletedAt: article.DeletedAt,
|
||||
Version: article.Version,
|
||||
Title: article.Title,
|
||||
ID: article.ID,
|
||||
CreatedAt: helpers.KontorTime{Time: article.CreatedAt},
|
||||
UpdatedAt: helpers.KontorTime{Time: article.UpdatedAt},
|
||||
DeletedAt: article.DeletedAt,
|
||||
Version: article.Version,
|
||||
Title: article.Title,
|
||||
}
|
||||
}
|
||||
return dtos
|
||||
@@ -48,6 +48,5 @@ type CreateArticleDTO struct {
|
||||
}
|
||||
|
||||
type UpdateArticleDTO struct {
|
||||
Title *string `json:"title,omitempty" binding:"omitempty"`
|
||||
Title *string `json:"title,omitempty" binding:"omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ func (media_actor *MediaActor) TableName() string {
|
||||
}
|
||||
|
||||
type MediaActorForm struct {
|
||||
Name string `form:"name" binding:"required"`
|
||||
Weblink string `form:"weblink" binding:"required"`
|
||||
Name string `form:"name" binding:"required"`
|
||||
Weblink string `form:"weblink" binding:"required"`
|
||||
}
|
||||
|
||||
type MediaActorDTO struct {
|
||||
|
||||
@@ -76,3 +76,5 @@ type LoginInput struct {
|
||||
Email string `json:"email" binding:"required"`
|
||||
Password string `json:"password" binding:"required"`
|
||||
}
|
||||
|
||||
type ProfileDTOList []ProfileDTO
|
||||
|
||||
Reference in New Issue
Block a user