add tysc handlers to kontor-gin
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type MediaLoFi 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"`
|
||||
WebLink string `gorm:"column:url" json:"url"`
|
||||
Review bool `gorm:"column:review" json:"review"`
|
||||
ShouldDownload bool `gorm:"column:should_download" json:"should_download"`
|
||||
Title string `gorm:"size:300, column:title" json:"title"`
|
||||
FileName string `gorm:"column:file_name" json:"file_name"`
|
||||
}
|
||||
|
||||
func (media_lofi *MediaLoFi) TableName() string {
|
||||
return "media_lofi"
|
||||
}
|
||||
|
||||
type MediaLoFiDTO 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"`
|
||||
WebLink string `json:"url"`
|
||||
Review bool `json:"review"`
|
||||
ShouldDownload bool `json:"should_download"`
|
||||
Title string `json:"title"`
|
||||
FileName string `json:"file_name"`
|
||||
}
|
||||
|
||||
func ConvertMediaLoFisToDtos(media_lofis []MediaLoFi) []MediaLoFiDTO {
|
||||
dtos := make([]MediaLoFiDTO, len(media_lofis))
|
||||
for i, media_lofi := range media_lofis {
|
||||
dtos[i] = MediaLoFiDTO{
|
||||
ID: media_lofi.ID,
|
||||
CreatedAt: media_lofi.CreatedAt,
|
||||
UpdatedAt: media_lofi.UpdatedAt,
|
||||
DeletedAt: media_lofi.DeletedAt,
|
||||
Version: media_lofi.Version,
|
||||
WebLink: media_lofi.WebLink,
|
||||
Review: media_lofi.Review,
|
||||
ShouldDownload: media_lofi.ShouldDownload,
|
||||
Title: media_lofi.Title,
|
||||
FileName: media_lofi.FileName,
|
||||
}
|
||||
}
|
||||
return dtos
|
||||
}
|
||||
Reference in New Issue
Block a user