Files
kontor/kontor-gin/internal/models/media_video.go
T
Thomas Peetz 4aaf580735
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5s
WIP: Export Kontor DB
2026-10-01 17:40:17 +02:00

62 lines
2.5 KiB
Go

package models
import (
"kontor-api-gin/internal/helpers"
"time"
)
type MediaVideo 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:"uniqueIndex;column:url" json:"url"`
ShouldDownload bool `gorm:"column:should_download" json:"should_download"`
}
func (media_video *MediaVideo) TableName() string {
return "media_video"
}
type MediaVideoDTO struct {
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 {
dtos := make([]MediaVideoDTO, len(media_videos))
for i, media_video := range media_videos {
dtos[i] = MediaVideoDTO{
ID: media_video.ID,
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,
FileName: media_video.FileName,
Path: media_video.Path,
Review: media_video.Review,
Title: media_video.Title,
WebLink: media_video.WebLink,
ShouldDownload: media_video.ShouldDownload,
}
}
return dtos
}