add tysc handlers to kontor-gin
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type MediaFile 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"`
|
||||
CloudLink string `gorm:"column:cloud_link" json:"cloud_link"`
|
||||
FileName string `gorm:"column:file_name" json:"file_name"`
|
||||
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:"column:url" json:"url"`
|
||||
ShouldDownload bool `gorm:"column:should_download" json:"should_download"`
|
||||
|
||||
MediaActorFiles []MediaActorFile `gorm:"foreignKey:MediaFileID" json:"media_actor_files"`
|
||||
}
|
||||
|
||||
func (media_file *MediaFile) TableName() string {
|
||||
return "media_file"
|
||||
}
|
||||
|
||||
type MediaFileDTO 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"`
|
||||
}
|
||||
|
||||
func ConvertMediaFilesToDtos(media_files []MediaFile) []MediaFileDTO {
|
||||
dtos := make([]MediaFileDTO, len(media_files))
|
||||
for i, media_file := range media_files {
|
||||
dtos[i] = MediaFileDTO{
|
||||
ID: media_file.ID,
|
||||
CreatedAt: media_file.CreatedAt,
|
||||
UpdatedAt: media_file.UpdatedAt,
|
||||
DeletedAt: media_file.DeletedAt,
|
||||
Version: media_file.Version,
|
||||
CloudLink: media_file.CloudLink,
|
||||
FileName: media_file.FileName,
|
||||
Path: media_file.Path,
|
||||
Review: media_file.Review,
|
||||
Title: media_file.Title,
|
||||
WebLink: media_file.WebLink,
|
||||
ShouldDownload: media_file.ShouldDownload,
|
||||
}
|
||||
}
|
||||
return dtos
|
||||
}
|
||||
Reference in New Issue
Block a user