add tysc handlers to kontor-gin
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type MediaActor 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"`
|
||||
Name string `gorm:"column:name" json:"name"`
|
||||
WebLink string `gorm:"column:url" json:"url"`
|
||||
|
||||
MediaActorFiles []MediaActorFile `gorm:"foreignKey:MediaActorID" json:"media_actor_files"`
|
||||
}
|
||||
|
||||
func (media_actor *MediaActor) TableName() string {
|
||||
return "media_actor"
|
||||
}
|
||||
|
||||
type MediaActorDTO 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"`
|
||||
Name string `json:"name"`
|
||||
WebLink string `json:"url"`
|
||||
}
|
||||
|
||||
func ConvertMediaActorsToDtos(actors []MediaActor) []MediaActorDTO {
|
||||
dtos := make([]MediaActorDTO, len(actors))
|
||||
for i, actor := range actors {
|
||||
dtos[i] = MediaActorDTO{
|
||||
ID: actor.ID,
|
||||
CreatedAt: actor.CreatedAt,
|
||||
UpdatedAt: actor.UpdatedAt,
|
||||
DeletedAt: actor.DeletedAt,
|
||||
Version: actor.Version,
|
||||
Name: actor.Name,
|
||||
WebLink: actor.WebLink,
|
||||
}
|
||||
}
|
||||
return dtos
|
||||
}
|
||||
Reference in New Issue
Block a user