add tysc handlers to kontor-gin

This commit is contained in:
2026-09-30 04:12:03 +02:00
parent c848758821
commit f912dcb670
100 changed files with 2420 additions and 1064 deletions
@@ -1,9 +1,9 @@
package comics
package models
import "time"
type Artist struct {
ID string `gorm:"type:string;primary_key;"`
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"`
@@ -17,5 +17,6 @@ func (artist *Artist) TableName() string {
}
type CreateArtistDTO struct {
Name string `json:"name" binding:"required"`
Name string `json:"name" binding:"required"`
WebLink string `json:"weblink" binding:"required"`
}
+29
View File
@@ -0,0 +1,29 @@
package models
import "time"
type Assignment 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"`
ProfileID *string `gorm:"column:profile_id" json:"profile_id"`
Profile *Profile `gorm:"foreignKey:ProfileID" json:"profile"`
PermissionID *string `gorm:"column:permission_id" json:"permission_id"`
Permission *Profile `gorm:"foreignKey:PermissionID" json:"permission"`
}
func (assignment *Assignment) TableName() string {
return "assignment"
}
type AssignmentDTO struct {
ID string `json:"id" binding:"required"`
CreatedAt time.Time `json:"created_date" binding:"required"`
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
DeletedAt *time.Time `json:"deleted_date" binding:"omitempty"`
Version int `json:"version" binding:"required"`
ProfileID *string `json:"profile_id" binding:"required"`
PermissionID *string `json:"permission_id" binding:"required"`
}
+55
View File
@@ -0,0 +1,55 @@
package models
import "time"
type Card 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"`
CardNumber int `gorm:"column:card_number" json:"card_number"`
Year int `gorm:"column:year" json:"year"`
CardSetID string `gorm:"column:card_set_id" json:"card_set_id"`
CardSet CardSet `gorm:"foreignKey:CardSetID" json:"card_set"`
RoosterID string `gorm:"column_rooster_id" json:"rooster_id"`
Rooster *Rooster `gorm:"foreignKey:RoosterID" json:"rooster"`
VendorID string `gorm:"column_vendor_id" json:"vendor_id"`
Vendor Vendor `gorm:"foreignKey:VendorID" json:"vendor"`
}
func (card *Card) TableName() string {
return "card"
}
type CardDTO struct {
ID string `json:"id" binding:"required"`
CreatedAt time.Time `json:"created_date" binding:"required"`
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
Version int `json:"version" binding:"required"`
CardNumber int `json:"card_number" binding:"required"`
Year int `json:"year" binding:"required"`
CardSetID string `json:"card_set_id" binding:"required"`
RoosterID string `json:"rooster_id" binding:"required"`
VendorID string `json:"vendor_id" binding:"required"`
}
func ConvertCardsToDtos(cards []Card) []CardDTO {
dtos := make([]CardDTO, len(cards))
for i, card := range cards {
dtos[i] = CardDTO{
ID: card.ID,
CreatedAt: card.CreatedAt,
UpdatedAt: card.UpdatedAt,
DeletedAt: card.DeletedAt,
Version: card.Version,
CardNumber: card.CardNumber,
Year: card.Year,
CardSetID: card.CardSetID,
RoosterID: card.RoosterID,
VendorID: card.VendorID,
}
}
return dtos
}
+51
View File
@@ -0,0 +1,51 @@
package models
import "time"
type CardSet 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"`
ParallelSet bool `gorm:"column:parallel_set" json:"parallel_set"`
InsertSet bool `gorm:"column:insert_set" json:"insert_set"`
VendorID string `gorm:"column_vendor_id" json:"vendor_id"`
Vendor Vendor `gorm:"foreignKey:VendorID" json:"vendor"`
Cards []Card `gorm:"foreignKey:CardSetID" json:"cards"`
}
func (cardset *CardSet) TableName() string {
return "card_set"
}
type CardSetDTO struct {
ID string `json:"id" binding:"required"`
CreatedAt time.Time `json:"created_date" binding:"required"`
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
Version int `json:"version" binding:"required"`
Name string `json:"name" binding:"required"`
ParallelSet bool `json:"parallel_set" binding:"required"`
InsertSet bool `json:"insert_set" binding:"required"`
VendorID string `json:"vendor_id" binding:"required"`
}
func ConvertCardSetsToDtos(cardsets []CardSet) []CardSetDTO {
dtos := make([]CardSetDTO, len(cardsets))
for i, cardset := range cardsets {
dtos[i] = CardSetDTO{
ID: cardset.ID,
CreatedAt: cardset.CreatedAt,
UpdatedAt: cardset.UpdatedAt,
DeletedAt: cardset.DeletedAt,
Version: cardset.Version,
Name: cardset.Name,
ParallelSet: cardset.ParallelSet,
InsertSet: cardset.InsertSet,
VendorID: cardset.VendorID,
}
}
return dtos
}
@@ -1,11 +1,11 @@
package comics
package models
import (
"time"
)
type Comic struct {
ID string `gorm:"type:string;primary_key;"`
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"`
@@ -15,6 +15,7 @@ type Comic struct {
Completed bool `gorm:"column:completed" json:"completed"`
WebLink string `gorm:"column:weblink" json:"weblink"`
PublisherID *string `gorm:"column:publisher_id" json:"publisher_id"`
Publisher *Publisher `gorm:"foreignKey:PublisherID"`
Issues []Issue `gorm:"foreignKey:ComicID"`
StoryArcs []StoryArc `gorm:"foreignKey:ComicID"`
TradePaperbacks []TradePaperback `gorm:"foreignKey:ComicID"`
@@ -26,6 +27,38 @@ func (comic *Comic) TableName() string {
return "comic"
}
type ComicDTO 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,omitempty"`
Version int `json:"version"`
Title string `json:"title"`
PublisherID *string `json:"publisher_id"`
CurrentOrder bool `json:"current_order"`
Completed bool `json:"completed"`
WebLink string `json:"weblink"`
}
func ConvertComicsToDtos(comics []Comic) []ComicDTO {
dtos := make([]ComicDTO, len(comics))
for i, comic := range comics {
dtos[i] = ComicDTO{
ID: comic.ID,
CreatedAt: comic.CreatedAt,
UpdatedAt: comic.UpdatedAt,
DeletedAt: comic.DeletedAt,
Version: comic.Version,
Title: comic.Title,
CurrentOrder: comic.CurrentOrder,
Completed: comic.Completed,
WebLink: comic.WebLink,
PublisherID: comic.PublisherID,
}
}
return dtos
}
type CreateComicDTO struct {
Title string `json:"title" binding:"required"`
}
@@ -1,4 +1,4 @@
package comics
package models
import "time"
@@ -1,4 +1,4 @@
package comics
package models
import "time"
@@ -1,4 +1,4 @@
package comics
package models
import "time"
+45
View File
@@ -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
}
@@ -0,0 +1,45 @@
package models
import "time"
type MediaActorFile 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"`
MediaActorID *string `gorm:"column:media_actor_id" json:"media_actor_id"`
MediaActor *MediaActor `gorm:"foreignKey:MediaActorID" json:"media_actor"`
MediaFileID *string `form:"column:media_file_id" json:"media_file_id"`
MediaFile *MediaFile `gorm:"foreignKey:MediaFileID" json:"media_file"`
}
func (media_file *MediaActorFile) TableName() string {
return "media_actor_file"
}
type MediaActorFileDTO 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"`
MediaActorID *string `json:"media_actor_id"`
MediaFileID *string `json:"media_file_id"`
}
func ConvertMediaActorFilesToDtos(actor_files []MediaActorFile) []MediaActorFileDTO {
dtos := make([]MediaActorFileDTO, len(actor_files))
for i, actor_file := range actor_files {
dtos[i] = MediaActorFileDTO{
ID: actor_file.ID,
CreatedAt: actor_file.CreatedAt,
UpdatedAt: actor_file.UpdatedAt,
DeletedAt: actor_file.DeletedAt,
Version: actor_file.Version,
MediaActorID: actor_file.MediaActorID,
MediaFileID: actor_file.MediaFileID,
}
}
return dtos
}
@@ -0,0 +1,46 @@
package models
import "time"
type MediaArticle 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"`
Review bool `gorm:"column:review" json:"review"`
Title string `gorm:"size:300, column:title" json:"title"`
WebLink string `gorm:"column:url" json:"url"`
}
func (media_article *MediaArticle) TableName() string {
return "media_article"
}
type MediaArticleDTO 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"`
Review bool `json:"review"`
Title string `json:"title"`
WebLink string `json:"url"`
}
func ConvertMediaArticlesToDtos(media_articles []MediaArticle) []MediaArticleDTO {
dtos := make([]MediaArticleDTO, len(media_articles))
for i, media_article := range media_articles {
dtos[i] = MediaArticleDTO{
ID: media_article.ID,
CreatedAt: media_article.CreatedAt,
UpdatedAt: media_article.UpdatedAt,
DeletedAt: media_article.DeletedAt,
Version: media_article.Version,
Review: media_article.Review,
Title: media_article.Title,
WebLink: media_article.WebLink,
}
}
return dtos
}
+60
View File
@@ -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
}
+52
View File
@@ -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
}
+58
View File
@@ -0,0 +1,58 @@
package models
import "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 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 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: media_video.CreatedAt,
UpdatedAt: 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
}
+26
View File
@@ -0,0 +1,26 @@
package models
import "time"
type Permission 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"`
Assignments []Assignment `gorm:"foreignKey:PermissionID" json:"assignments"`
}
func (permission *Permission) TableName() string {
return "permission"
}
type PermissionDTO struct {
ID string `json:"id" binding:"required"`
CreatedAt time.Time `json:"created_date" binding:"required"`
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
DeletedAt *time.Time `json:"deleted_date" binding:"omitempty"`
Version int `json:"version" binding:"required"`
Name string `json:"name" binding:"required"`
}
+44
View File
@@ -0,0 +1,44 @@
package models
import "time"
type Player 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"`
FirstName string `gorm:"column:first_name" json:"first_name"`
LastName string `gorm:"column:last_name" json:"last_name"`
Roosters []Rooster `gorm:"foreignKey:PlayerID" json:"roosters"`
}
func (player *Player) TableName() string {
return "player"
}
type PlayerDTO struct {
ID string `json:"id" binding:"required"`
CreatedAt time.Time `json:"created_date" binding:"required"`
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
Version int `json:"version" binding:"required"`
FirstName string `json:"first_name" binding:"required"`
LastName string `json:"last_name" binding:"required"`
}
func ConvertPlayersToDtos(players []Player) []PlayerDTO {
dtos := make([]PlayerDTO, len(players))
for i, player := range players {
dtos[i] = PlayerDTO{
ID: player.ID,
CreatedAt: player.CreatedAt,
UpdatedAt: player.UpdatedAt,
DeletedAt: player.DeletedAt,
Version: player.Version,
FirstName: player.FirstName,
LastName: player.LastName,
}
}
return dtos
}
+48
View File
@@ -0,0 +1,48 @@
package models
import "time"
type Position 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"`
ShortName string `gorm:"column:short_name" json:"short_name"`
SportID string `gorm:"column:sport_id" json:"sport_id"`
Sport Sport `gorm:"foreignKey:SportID" json:"sport"`
Roosters []Rooster `gorm:"foreignKey:TeamID" json:"roosters"`
}
func (position *Position) TableName() string {
return "field_position"
}
type PositionDTO struct {
ID string `json:"id" binding:"required"`
CreatedAt time.Time `json:"created_date" binding:"required"`
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
Version int `json:"version" binding:"required"`
Name string `json:"name" binding:"required"`
ShortName string `json:"short_name" binding:"required"`
SportID string `json:"sport_id" binding:"required"`
}
func ConvertPositionsToDtos(positions []Position) []PositionDTO {
dtos := make([]PositionDTO, len(positions))
for i, position := range positions {
dtos[i] = PositionDTO{
ID: position.ID,
CreatedAt: position.CreatedAt,
UpdatedAt: position.UpdatedAt,
DeletedAt: position.DeletedAt,
Version: position.Version,
Name: position.Name,
ShortName: position.ShortName,
SportID: position.SportID,
}
}
return dtos
}
+55
View File
@@ -0,0 +1,55 @@
package models
import "time"
type Profile 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"`
First_Name *string `gorm:"column:first_name" json:"first_name"`
Last_Name *string `gorm:"column:last_name" json:"last_name"`
User_Name string `gorm:"column:user_name" json:"user_name"`
Email string `gorm:"column:email" json:"email"`
Password string `gorm:"column:password" json:"password"`
Enabled bool `gorm:"column:enabled" json:"enabled"`
Assignments []Assignment `gorm:"foreignKey:ProfileID" json:"assignments"`
Tokens []Token `gorm:"foreignKey:ProfileID" json:"tokens"`
}
func (profile *Profile) TableName() string {
return "profile"
}
func (profile *Profile) GetFullName() string {
full_name := ""
if profile.First_Name != nil {
full_name += *profile.First_Name
}
if profile.Last_Name != nil {
full_name += " "
full_name += *profile.Last_Name
}
return full_name
}
type ProfileDTO_ struct {
ID string `json:"id" binding:"required"`
CreatedAt time.Time `json:"created_date" binding:"required"`
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
DeletedAt *time.Time `json:"deleted_date" binding:"omitempty"`
Version int `json:"version" binding:"required"`
First_Name *string `json:"first_name" binding:"required"`
Last_Name *string `json:"last_name" binding:"required"`
User_Name string `json:"user_name" binding:"required"`
Email string `json:"email" binding:"required"`
Password string `json:"password" binding:"required"`
Enabled bool `json:"enabled" binding:"required"`
}
type LoginInput struct {
Email string `json:"email" binding:"required"`
Password string `json:"password" binding:"required"`
}
@@ -1,4 +1,4 @@
package comics
package models
import "time"
@@ -20,6 +20,34 @@ func (publisher *Publisher) TableName() string {
return "publisher"
}
type PublisherDTO 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:"weblink"`
ParentPublisherID *string `json:"parent_publisher_id"`
}
func ConvertPublishersToDtos(publishers []Publisher) []PublisherDTO {
dtos := make([]PublisherDTO, len(publishers))
for i, comic := range publishers {
dtos[i] = PublisherDTO{
ID: comic.ID,
CreatedAt: comic.CreatedAt,
UpdatedAt: comic.UpdatedAt,
DeletedAt: comic.DeletedAt,
Version: comic.Version,
Name: comic.Name,
WebLink: comic.WebLink,
ParentPublisherID: comic.ParentPublisherID,
}
}
return dtos
}
type CreatePublisherDTO struct {
Name string `json:"name" binding:"required"`
WebLink string `json:"weblink" binding:"required"`
+53
View File
@@ -0,0 +1,53 @@
package models
import "time"
type Rooster 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"`
Year int `gorm:"column:year" json:"year"`
TeamID string `gorm:"column:team_id" json:"team_id"`
Team Team `gorm:"foreignKey:TeamID" json:"team"`
PlayerID string `gorm:"column:player_id" json:"player_id"`
Player Player `gorm:"foreignKey:PlayerID" json:"player"`
PositionID string `gorm:"column:position_id" json:"position_id"`
Position Position `gorm:"foreignKey:PositionID" json:"position"`
Cards []Card `gorm:"foreignKey:RoosterID" json:"cards"`
}
func (rooster *Rooster) TableName() string {
return "rooster"
}
type RoosterDTO struct {
ID string `json:"id" binding:"required"`
CreatedAt time.Time `json:"created_date" binding:"required"`
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
Version int `json:"version" binding:"required"`
Year int `json:"year" binding:"required"`
TeamID string `json:"team_id" binding:"required"`
PlayerID string `json:"player_id" binding:"required"`
PositionID string `json:"position_id" binding:"required"`
}
func ConvertRoostersToDtos(roosters []Rooster) []RoosterDTO {
dtos := make([]RoosterDTO, len(roosters))
for i, rooster := range roosters {
dtos[i] = RoosterDTO{
ID: rooster.ID,
CreatedAt: rooster.CreatedAt,
UpdatedAt: rooster.UpdatedAt,
DeletedAt: rooster.DeletedAt,
Version: rooster.Version,
Year: rooster.Year,
TeamID: rooster.TeamID,
PlayerID: rooster.PlayerID,
PositionID: rooster.PositionID,
}
}
return dtos
}
+45
View File
@@ -0,0 +1,45 @@
package models
import "time"
type Sport 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:"uniqueIndex" json:"name"`
}
func (sport *Sport) TableName() string {
return "sport"
}
type SportDTO struct {
ID string `json:"id" binding:"required"`
CreatedAt time.Time `json:"created_date" binding:"required"`
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
Version int `json:"version" binding:"required"`
Name string `json:"name" binding:"required"`
}
func ConvertSportsToDtos(sports []Sport) []SportDTO {
dtos := make([]SportDTO, len(sports))
for i, sport := range sports {
dtos[i] = SportDTO{
ID: sport.ID,
CreatedAt: sport.CreatedAt,
UpdatedAt: sport.UpdatedAt,
DeletedAt: sport.DeletedAt,
Version: sport.Version,
Name: sport.Name,
}
}
return dtos
}
type CreateSportDTO struct {
Name string `json:"name" binding:"required"`
WebLink string `json:"weblink" binding:"required"`
}
@@ -1,4 +1,4 @@
package comics
package models
import "time"
+48
View File
@@ -0,0 +1,48 @@
package models
import "time"
type Team 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"`
ShortName string `gorm:"column:short_name" json:"short_name"`
SportID string `gorm:"column:sport_id" json:"sport_id"`
Sport Sport `gorm:"foreignKey:SportID" json:"sport"`
Roosters []Rooster `gorm:"foreignKey:TeamID" json:"roosters"`
}
func (team *Team) TableName() string {
return "team"
}
type TeamDTO struct {
ID string `json:"id" binding:"required"`
CreatedAt time.Time `json:"created_date" binding:"required"`
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
Version int `json:"version" binding:"required"`
Name string `json:"name" binding:"required"`
ShortName string `json:"short_name" binding:"required"`
SportID string `json:"sport_id" binding:"required"`
}
func ConvertTeamsToDtos(teams []Team) []TeamDTO {
dtos := make([]TeamDTO, len(teams))
for i, team := range teams {
dtos[i] = TeamDTO{
ID: team.ID,
CreatedAt: team.CreatedAt,
UpdatedAt: team.UpdatedAt,
DeletedAt: team.DeletedAt,
Version: team.Version,
Name: team.Name,
ShortName: team.ShortName,
SportID: team.SportID,
}
}
return dtos
}
+31
View File
@@ -0,0 +1,31 @@
package models
import "time"
type Token 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"`
Token string `gorm:"uniqueIndex,column:token" json:"token"`
Name string `gorm:"column:name" json:"name"`
LastUsedAt time.Time `gorm:"column:last_used_date" json:"last_used_date"`
Enabled bool `gorm:"column.enabled" json:"enabled"`
ProfileID *string `gorm:"column:profile_id" json:"profile_id"`
Profile *Profile `gorm:"foreignKey:ProfileID" json:"profile"`
}
func (token *Token) TableName() string {
return "token"
}
type TokenDTO struct {
ID string `json:"id" binding:"required"`
CreatedAt time.Time `json:"created_date" binding:"required"`
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
DeletedAt *time.Time `json:"deleted_date" binding:"omitempty"`
Version int `json:"version" binding:"required"`
Token string `json:"token" binding:"required"`
ProfileID *string `json:"profile_id" binding:"required"`
}
@@ -1,4 +1,4 @@
package comics
package models
import "time"
+42
View File
@@ -0,0 +1,42 @@
package models
import "time"
type Vendor 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"`
CardSets []CardSet `gorm:"foreignKey:VendorID" json:"card_sets"`
Cards []Card `gorm:"foreignKey:VendorID" json:"cards"`
}
func (vendor *Vendor) TableName() string {
return "vendor"
}
type VendorDTO struct {
ID string `json:"id" binding:"required"`
CreatedAt time.Time `json:"created_date" binding:"required"`
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
Version int `json:"version" binding:"required"`
Name string `json:"name" binding:"required"`
}
func ConvertVendorsToDtos(vendors []Vendor) []VendorDTO {
dtos := make([]VendorDTO, len(vendors))
for i, vendor := range vendors {
dtos[i] = VendorDTO{
ID: vendor.ID,
CreatedAt: vendor.CreatedAt,
UpdatedAt: vendor.UpdatedAt,
DeletedAt: vendor.DeletedAt,
Version: vendor.Version,
Name: vendor.Name,
}
}
return dtos
}
@@ -1,4 +1,4 @@
package comics
package models
import "time"
@@ -1,4 +1,4 @@
package comics
package models
import "time"