add methods in Repository and Model for importing data
This commit is contained in:
@@ -55,6 +55,24 @@ type MediaFileDTO struct {
|
||||
ShouldDownload bool `json:"should_download"`
|
||||
}
|
||||
|
||||
func (dto MediaFileDTO) ConvertDTOToModel() MediaFile {
|
||||
model := MediaFile{
|
||||
ID: dto.ID,
|
||||
CreatedAt: dto.CreatedAt.Time,
|
||||
UpdatedAt: dto.UpdatedAt.Time,
|
||||
DeletedAt: dto.DeletedAt,
|
||||
Version: dto.Version,
|
||||
CloudLink: dto.CloudLink,
|
||||
FileName: dto.FileName,
|
||||
Path: dto.Path,
|
||||
Review: dto.Review,
|
||||
ShouldDownload: dto.ShouldDownload,
|
||||
Title: dto.Title,
|
||||
WebLink: dto.WebLink,
|
||||
}
|
||||
return model
|
||||
}
|
||||
|
||||
func ConvertMediaFilesToDtos(media_files []MediaFile) []MediaFileDTO {
|
||||
dtos := make([]MediaFileDTO, len(media_files))
|
||||
for i, media_file := range media_files {
|
||||
|
||||
Reference in New Issue
Block a user