add methods in Repository an dModel for importing data
This commit is contained in:
@@ -34,6 +34,20 @@ type ComicworkDTO struct {
|
||||
WorkTypeID *string `json:"work_type_id"`
|
||||
}
|
||||
|
||||
func (dto ComicworkDTO) ConvertDTOToModel() ComicWork {
|
||||
model := ComicWork{
|
||||
ID: dto.ID,
|
||||
CreatedAt: dto.CreatedAt.Time,
|
||||
UpdatedAt: dto.UpdatedAt.Time,
|
||||
DeletedAt: dto.DeletedAt,
|
||||
Version: dto.Version,
|
||||
ComicID: dto.ComicID,
|
||||
ArtistID: dto.ArtistID,
|
||||
WorkTypeID: dto.WorkTypeID,
|
||||
}
|
||||
return model
|
||||
}
|
||||
|
||||
func ConvertComicworksToDtos(comicworks []ComicWork) []ComicworkDTO {
|
||||
dtos := make([]ComicworkDTO, len(comicworks))
|
||||
for i, comicwork := range comicworks {
|
||||
|
||||
Reference in New Issue
Block a user