add methods in Repository an dModel for importing data
This commit is contained in:
@@ -31,6 +31,19 @@ type ArticleAuthorDTO struct {
|
||||
AuthorID *string `json:"author_id"`
|
||||
}
|
||||
|
||||
func (dto ArticleAuthorDTO) ConvertDTOToModel() ArticleAuthor {
|
||||
model := ArticleAuthor{
|
||||
ID: dto.ID,
|
||||
CreatedAt: dto.CreatedAt.Time,
|
||||
UpdatedAt: dto.UpdatedAt.Time,
|
||||
DeletedAt: dto.DeletedAt,
|
||||
Version: dto.Version,
|
||||
ArticleID: dto.ArticleID,
|
||||
AuthorID: dto.AuthorID,
|
||||
}
|
||||
return model
|
||||
}
|
||||
|
||||
func ConvertArticleAuthorsToDtos(article_authors []ArticleAuthor) []ArticleAuthorDTO {
|
||||
dtos := make([]ArticleAuthorDTO, len(article_authors))
|
||||
for i, article_author := range article_authors {
|
||||
|
||||
Reference in New Issue
Block a user