This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"kontor-api-gin/internal/helpers"
|
||||
"time"
|
||||
)
|
||||
|
||||
type MediaVideo struct {
|
||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||
@@ -13,7 +16,7 @@ type MediaVideo struct {
|
||||
Path string `gorm:"column:path" json:"path"`
|
||||
Review bool `gorm:"column:review" json:"review"`
|
||||
Title string `gorm:"size:300, column:title" json:"title"`
|
||||
WebLink string `gorm:"uniqueIndex,column:url" json:"url"`
|
||||
WebLink string `gorm:"uniqueIndex;column:url" json:"url"`
|
||||
ShouldDownload bool `gorm:"column:should_download" json:"should_download"`
|
||||
}
|
||||
|
||||
@@ -22,18 +25,18 @@ func (media_video *MediaVideo) TableName() string {
|
||||
}
|
||||
|
||||
type MediaVideoDTO struct {
|
||||
ID string `json:"id" binding:"required"`
|
||||
CreatedAt time.Time `json:"created_date"`
|
||||
UpdatedAt time.Time `json:"last_modified_date"`
|
||||
DeletedAt *time.Time `json:"deleted_date"`
|
||||
Version int `json:"version"`
|
||||
CloudLink string `json:"cloud_link"`
|
||||
FileName string `json:"file_name"`
|
||||
Path string `json:"path"`
|
||||
Review bool `json:"review"`
|
||||
Title string `json:"title"`
|
||||
WebLink string `json:"url"`
|
||||
ShouldDownload bool `json:"should_download"`
|
||||
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"`
|
||||
CloudLink string `json:"cloud_link"`
|
||||
FileName string `json:"file_name"`
|
||||
Path string `json:"path"`
|
||||
Review bool `json:"review"`
|
||||
Title string `json:"title"`
|
||||
WebLink string `json:"url"`
|
||||
ShouldDownload bool `json:"should_download"`
|
||||
}
|
||||
|
||||
func ConvertMediaVideosToDtos(media_videos []MediaVideo) []MediaVideoDTO {
|
||||
@@ -41,8 +44,8 @@ func ConvertMediaVideosToDtos(media_videos []MediaVideo) []MediaVideoDTO {
|
||||
for i, media_video := range media_videos {
|
||||
dtos[i] = MediaVideoDTO{
|
||||
ID: media_video.ID,
|
||||
CreatedAt: media_video.CreatedAt,
|
||||
UpdatedAt: media_video.UpdatedAt,
|
||||
CreatedAt: helpers.KontorTime{Time: media_video.CreatedAt},
|
||||
UpdatedAt: helpers.KontorTime{Time: media_video.UpdatedAt},
|
||||
DeletedAt: media_video.DeletedAt,
|
||||
Version: media_video.Version,
|
||||
CloudLink: media_video.CloudLink,
|
||||
|
||||
Reference in New Issue
Block a user