This commit is contained in:
@@ -39,6 +39,17 @@ var exportCmd = &cobra.Command{
|
|||||||
Volume []models.VolumeDTO `json:"volume"`
|
Volume []models.VolumeDTO `json:"volume"`
|
||||||
StoryArc []models.StoryArcDTO `json:"story_arc"`
|
StoryArc []models.StoryArcDTO `json:"story_arc"`
|
||||||
Issue []models.IssueDTO `json:"issue"`
|
Issue []models.IssueDTO `json:"issue"`
|
||||||
|
TradePaperback []models.TradePaperbackDTO `json:"trade_paperback"`
|
||||||
|
ComicWork []models.ComicworkDTO `json:"comic_work"`
|
||||||
|
IssueWork []models.IssueworkDTO `json:"issue_work"`
|
||||||
|
MediaArticle []models.MediaArticleDTO `json:"media_article"`
|
||||||
|
MediaVideo []models.MediaVideoDTO `json:"media_video"`
|
||||||
|
MediaLoFi []models.MediaLoFiDTO `json:"media_lofi"`
|
||||||
|
MediaFile []models.MediaFileDTO `json:"media_file"`
|
||||||
|
Profile []models.ProfileDTO `json:"profile"`
|
||||||
|
Permission []models.PermissionDTO `json:"permission"`
|
||||||
|
Assignment []models.AssignmentDTO `json:"assignment"`
|
||||||
|
Token []models.TokenDTO `json:"token"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -57,6 +68,17 @@ var exportCmd = &cobra.Command{
|
|||||||
volumes []models.VolumeDTO
|
volumes []models.VolumeDTO
|
||||||
storyarcs []models.StoryArcDTO
|
storyarcs []models.StoryArcDTO
|
||||||
issues []models.IssueDTO
|
issues []models.IssueDTO
|
||||||
|
tradepaperbacks []models.TradePaperbackDTO
|
||||||
|
comicworks []models.ComicworkDTO
|
||||||
|
issueworks []models.IssueworkDTO
|
||||||
|
mediaarticles []models.MediaArticleDTO
|
||||||
|
mediavideos []models.MediaVideoDTO
|
||||||
|
mediafiles []models.MediaFileDTO
|
||||||
|
medialofis []models.MediaLoFiDTO
|
||||||
|
profiles []models.ProfileDTO
|
||||||
|
permissions []models.PermissionDTO
|
||||||
|
assignments []models.AssignmentDTO
|
||||||
|
tokens []models.TokenDTO
|
||||||
)
|
)
|
||||||
|
|
||||||
registry := map[string]any{
|
registry := map[string]any{
|
||||||
@@ -75,6 +97,17 @@ var exportCmd = &cobra.Command{
|
|||||||
"http://127.0.0.1:8550/api/v1/comics/volumes": &volumes,
|
"http://127.0.0.1:8550/api/v1/comics/volumes": &volumes,
|
||||||
"http://127.0.0.1:8550/api/v1/comics/storyarcs": &storyarcs,
|
"http://127.0.0.1:8550/api/v1/comics/storyarcs": &storyarcs,
|
||||||
"http://127.0.0.1:8550/api/v1/comics/issues": &issues,
|
"http://127.0.0.1:8550/api/v1/comics/issues": &issues,
|
||||||
|
"http://127.0.0.1:8550/api/v1/comics/tradepaperbacks": &tradepaperbacks,
|
||||||
|
"http://127.0.0.1:8550/api/v1/comics/comicworks": &comicworks,
|
||||||
|
"http://127.0.0.1:8550/api/v1/comics/issueworks": &issueworks,
|
||||||
|
"http://127.0.0.1:8550/api/v1/media/articles": &mediaarticles,
|
||||||
|
"http://127.0.0.1:8550/api/v1/media/videos": &mediavideos,
|
||||||
|
"http://127.0.0.1:8550/api/v1/media/files": &mediafiles,
|
||||||
|
"http://127.0.0.1:8550/api/v1/media/lofis": &medialofis,
|
||||||
|
"http://127.0.0.1:8550/api/v1/user/profiles": &profiles,
|
||||||
|
"http://127.0.0.1:8550/api/v1/user/permissions": &permissions,
|
||||||
|
"http://127.0.0.1:8550/api/v1/user/assignments": &assignments,
|
||||||
|
"http://127.0.0.1:8550/api/v1/user/tokens": &tokens,
|
||||||
}
|
}
|
||||||
for url, value := range registry {
|
for url, value := range registry {
|
||||||
GetJSON(client, login.Token, url, value)
|
GetJSON(client, login.Token, url, value)
|
||||||
@@ -95,6 +128,17 @@ var exportCmd = &cobra.Command{
|
|||||||
Volume: volumes,
|
Volume: volumes,
|
||||||
StoryArc: storyarcs,
|
StoryArc: storyarcs,
|
||||||
Issue: issues,
|
Issue: issues,
|
||||||
|
TradePaperback: tradepaperbacks,
|
||||||
|
ComicWork: comicworks,
|
||||||
|
IssueWork: issueworks,
|
||||||
|
MediaArticle: mediaarticles,
|
||||||
|
MediaVideo: mediavideos,
|
||||||
|
MediaFile: mediafiles,
|
||||||
|
MediaLoFi: medialofis,
|
||||||
|
Profile: profiles,
|
||||||
|
Permission: permissions,
|
||||||
|
Assignment: assignments,
|
||||||
|
Token: tokens,
|
||||||
}
|
}
|
||||||
defer client.Close()
|
defer client.Close()
|
||||||
jsonData, err := json.MarshalIndent(export, "", " ")
|
jsonData, err := json.MarshalIndent(export, "", " ")
|
||||||
|
|||||||
@@ -9,14 +9,20 @@ import (
|
|||||||
|
|
||||||
type AdminHandler struct {
|
type AdminHandler struct {
|
||||||
AuthHandler *AuthHandler
|
AuthHandler *AuthHandler
|
||||||
|
ProfileHandler *ProfileHandler
|
||||||
PermissionHandler *PermissionHandler
|
PermissionHandler *PermissionHandler
|
||||||
|
AssignmentHandler *AssignmentHandler
|
||||||
|
TokenHandler *TokenHandler
|
||||||
Secret []byte
|
Secret []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAdminHandler(db *gorm.DB, secret []byte) *AdminHandler {
|
func NewAdminHandler(db *gorm.DB, secret []byte) *AdminHandler {
|
||||||
adminHandler := &AdminHandler{
|
adminHandler := &AdminHandler{
|
||||||
AuthHandler: &AuthHandler{Service: service.NewAuthService(repository.NewProfileRepository(db), secret)},
|
AuthHandler: &AuthHandler{Service: service.NewAuthService(repository.NewProfileRepository(db), secret)},
|
||||||
|
ProfileHandler: NewProfileHandler(db),
|
||||||
PermissionHandler: &PermissionHandler{Service: service.NewPermissionService(repository.NewPermissionRepository(db))},
|
PermissionHandler: &PermissionHandler{Service: service.NewPermissionService(repository.NewPermissionRepository(db))},
|
||||||
|
AssignmentHandler: NewAssignmentHandler(db),
|
||||||
|
TokenHandler: NewTokenHandler(db),
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
}
|
}
|
||||||
return adminHandler
|
return adminHandler
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package handlers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"kontor-api-gin/internal/models"
|
||||||
|
"kontor-api-gin/internal/repository"
|
||||||
|
"kontor-api-gin/internal/service"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AssignmentHandler struct {
|
||||||
|
Service *service.AssignmentService
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewAssignmentHandler(db *gorm.DB) *AssignmentHandler {
|
||||||
|
handler := &AssignmentHandler{Service: service.NewAssignmentService(repository.NewAssignmentRepository(db))}
|
||||||
|
return handler
|
||||||
|
}
|
||||||
|
|
||||||
|
func (handler *AssignmentHandler) List(c *gin.Context) {
|
||||||
|
assignments, err := handler.Service.List(c.Request.Context())
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dtos := models.ConvertAssignmentsToDtos(assignments)
|
||||||
|
c.JSON(http.StatusOK, dtos)
|
||||||
|
}
|
||||||
@@ -22,6 +22,7 @@ type ComicsHandler struct {
|
|||||||
StoryArcHandler *StoryArcHandler
|
StoryArcHandler *StoryArcHandler
|
||||||
ComicworkHandler *ComicworkHandler
|
ComicworkHandler *ComicworkHandler
|
||||||
IssueworkHandler *IssueworkHandler
|
IssueworkHandler *IssueworkHandler
|
||||||
|
TradePaperbackHandler *TradePaperbackHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewComicsHandler(db *gorm.DB) *ComicsHandler {
|
func NewComicsHandler(db *gorm.DB) *ComicsHandler {
|
||||||
@@ -35,6 +36,7 @@ func NewComicsHandler(db *gorm.DB) *ComicsHandler {
|
|||||||
StoryArcHandler: NewStoryArcHandler(db),
|
StoryArcHandler: NewStoryArcHandler(db),
|
||||||
ComicworkHandler: NewComicworkHandler(db),
|
ComicworkHandler: NewComicworkHandler(db),
|
||||||
IssueworkHandler: NewIssueworkHandler(db),
|
IssueworkHandler: NewIssueworkHandler(db),
|
||||||
|
TradePaperbackHandler: NewTradePaperbackHandler(db),
|
||||||
}
|
}
|
||||||
return comicsHandler
|
return comicsHandler
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package handlers
|
package handlers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"kontor-api-gin/internal/repository"
|
|
||||||
"kontor-api-gin/internal/service"
|
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -11,13 +8,15 @@ type MediaHandler struct {
|
|||||||
MediaActorHandler *MediaActorHandler
|
MediaActorHandler *MediaActorHandler
|
||||||
MediaFileHandler *MediaFileHandler
|
MediaFileHandler *MediaFileHandler
|
||||||
MediaLoFiHandler *MediaLoFiHandler
|
MediaLoFiHandler *MediaLoFiHandler
|
||||||
|
MediaVideoHandler *MediaVideoHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMediaHandler(db *gorm.DB) *MediaHandler {
|
func NewMediaHandler(db *gorm.DB) *MediaHandler {
|
||||||
mediaHandler := &MediaHandler{
|
mediaHandler := &MediaHandler{
|
||||||
MediaActorHandler: &MediaActorHandler{Service: service.NewMediaActorService(repository.NewMediaActorRepository(db))},
|
MediaActorHandler: NewMediaActorHandler(db),
|
||||||
MediaFileHandler: &MediaFileHandler{Service: service.NewMediaFileService(repository.NewMediaFileRepository(db))},
|
MediaFileHandler: NewMediaFileHandler(db),
|
||||||
MediaLoFiHandler: &MediaLoFiHandler{Service: service.NewMediaLoFiService(repository.NewMediaLoFiRepository(db))},
|
MediaLoFiHandler: NewMediaLoFiHandler(db),
|
||||||
|
MediaVideoHandler: NewMediaVideoHandler(db),
|
||||||
}
|
}
|
||||||
return mediaHandler
|
return mediaHandler
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package handlers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"kontor-api-gin/internal/globals"
|
||||||
|
"kontor-api-gin/internal/models"
|
||||||
|
"kontor-api-gin/internal/repository"
|
||||||
|
"kontor-api-gin/internal/service"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/gin-contrib/sessions"
|
||||||
|
"github.com/gin-contrib/slog"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MediaVideoHandler struct {
|
||||||
|
Service *service.MediaVideoService
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewMediaVideoHandler(db *gorm.DB) *MediaVideoHandler {
|
||||||
|
handler := &MediaVideoHandler{Service: service.NewMediaVideoService(repository.NewMediaVideoRepository(db))}
|
||||||
|
return handler
|
||||||
|
}
|
||||||
|
|
||||||
|
func (handler *MediaVideoHandler) List(c *gin.Context) {
|
||||||
|
logger := slog.Get(c)
|
||||||
|
logger.Info("MediaVideoHandler#List")
|
||||||
|
videos, err := handler.Service.List(c.Request.Context())
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dtos := models.ConvertMediaVideosToDtos(videos)
|
||||||
|
c.JSON(http.StatusOK, dtos)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (handler *MediaVideoHandler) ListPage(c *gin.Context) {
|
||||||
|
session := sessions.Default(c)
|
||||||
|
user := session.Get(globals.UserKey)
|
||||||
|
videos, err := handler.Service.List(c.Request.Context())
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.HTML(http.StatusOK, "mediavideos", gin.H{
|
||||||
|
"title": "Kontor MediaFiles",
|
||||||
|
"version": "0.4.0",
|
||||||
|
"message": "MediaFiles...",
|
||||||
|
"mediavideos": videos,
|
||||||
|
"user": user,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package handlers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"kontor-api-gin/internal/models"
|
||||||
|
"kontor-api-gin/internal/repository"
|
||||||
|
"kontor-api-gin/internal/service"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ProfileHandler struct {
|
||||||
|
Service *service.ProfileService
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewProfileHandler(db *gorm.DB) *ProfileHandler {
|
||||||
|
handler := &ProfileHandler{Service: service.NewProfileService(repository.NewProfileRepository(db))}
|
||||||
|
return handler
|
||||||
|
}
|
||||||
|
|
||||||
|
func (handler *ProfileHandler) List(c *gin.Context) {
|
||||||
|
profiles, err := handler.Service.List(c.Request.Context())
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dtos := models.ConvertProfilesToDtos(profiles)
|
||||||
|
c.JSON(http.StatusOK, dtos)
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package handlers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"kontor-api-gin/internal/models"
|
||||||
|
"kontor-api-gin/internal/repository"
|
||||||
|
"kontor-api-gin/internal/service"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
type TokenHandler struct {
|
||||||
|
Service *service.TokenService
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTokenHandler(db *gorm.DB) *TokenHandler {
|
||||||
|
handler := &TokenHandler{Service: service.NewTokenService(repository.NewTokenRepository(db))}
|
||||||
|
return handler
|
||||||
|
}
|
||||||
|
|
||||||
|
func (handler *TokenHandler) List(c *gin.Context) {
|
||||||
|
tokens, err := handler.Service.List(c.Request.Context())
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dtos := models.ConvertTokensToDtos(tokens)
|
||||||
|
c.JSON(http.StatusOK, dtos)
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package handlers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"kontor-api-gin/internal/globals"
|
||||||
|
"kontor-api-gin/internal/models"
|
||||||
|
"kontor-api-gin/internal/repository"
|
||||||
|
"kontor-api-gin/internal/service"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/gin-contrib/sessions"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
type TradePaperbackHandler struct {
|
||||||
|
Service *service.TradePaperbackService
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTradePaperbackHandler(db *gorm.DB) *TradePaperbackHandler {
|
||||||
|
handler := &TradePaperbackHandler{Service: service.NewTradePaperbackService(repository.NewTradePaperbackRepository(db))}
|
||||||
|
return handler
|
||||||
|
}
|
||||||
|
|
||||||
|
func (handler *TradePaperbackHandler) List(c *gin.Context) {
|
||||||
|
tradepaperbacks, err := handler.Service.List(c.Request.Context())
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dtos := models.ConvertTradePaperbacksToDtos(tradepaperbacks)
|
||||||
|
c.JSON(http.StatusOK, dtos)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (handler *TradePaperbackHandler) ListPage(c *gin.Context) {
|
||||||
|
session := sessions.Default(c)
|
||||||
|
user := session.Get(globals.UserKey)
|
||||||
|
tradepaperbacks, err := handler.Service.List(c.Request.Context())
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.HTML(http.StatusOK, "comics", gin.H{
|
||||||
|
"title": "Kontor Comics",
|
||||||
|
"version": "0.4.0",
|
||||||
|
"message": "Comics...",
|
||||||
|
"tradepaperbacks": tradepaperbacks,
|
||||||
|
"user": user,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package helpers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DateOnly struct {
|
||||||
|
time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d DateOnly) MarshalJSON() ([]byte, error) {
|
||||||
|
if d.IsZero() {
|
||||||
|
return []byte("null"), nil
|
||||||
|
}
|
||||||
|
return json.Marshal(d.Format("2006-01-02"))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DateOnly) UnmarshalJSON(b []byte) error {
|
||||||
|
var s string
|
||||||
|
if err := json.Unmarshal(b, &s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if s == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
t, err := time.Parse("2006-01-02", s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
d.Time = t
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type KontorTime struct {
|
||||||
|
time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
const layout = "2006-01-02 15:04:05.000000"
|
||||||
|
|
||||||
|
func (kt KontorTime) MarshalJSON() ([]byte, error) {
|
||||||
|
if kt.IsZero() {
|
||||||
|
return []byte("null"), nil
|
||||||
|
}
|
||||||
|
return json.Marshal(kt.Format(layout))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (kt *KontorTime) UnmarshalJSON(b []byte) error {
|
||||||
|
var s string
|
||||||
|
if err := json.Unmarshal(b, &s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if s == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
t, err := time.Parse(layout, s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
kt.Time = t
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type Artist struct {
|
type Artist struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -18,8 +21,8 @@ func (artist *Artist) TableName() string {
|
|||||||
|
|
||||||
type ArtistDTO struct {
|
type ArtistDTO struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
CreatedAt time.Time `json:"created_date"`
|
CreatedAt helpers.KontorTime `json:"created_date"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date"`
|
||||||
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
||||||
Version int `json:"version"`
|
Version int `json:"version"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@@ -31,8 +34,8 @@ func ConvertArtistsToDtos(artists []Artist) []ArtistDTO {
|
|||||||
for i, artist := range artists {
|
for i, artist := range artists {
|
||||||
dtos[i] = ArtistDTO{
|
dtos[i] = ArtistDTO{
|
||||||
ID: artist.ID,
|
ID: artist.ID,
|
||||||
CreatedAt: artist.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: artist.CreatedAt},
|
||||||
UpdatedAt: artist.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: artist.UpdatedAt},
|
||||||
DeletedAt: artist.DeletedAt,
|
DeletedAt: artist.DeletedAt,
|
||||||
Version: artist.Version,
|
Version: artist.Version,
|
||||||
Name: artist.Name,
|
Name: artist.Name,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type Assignment struct {
|
type Assignment struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -20,10 +23,26 @@ func (assignment *Assignment) TableName() string {
|
|||||||
|
|
||||||
type AssignmentDTO struct {
|
type AssignmentDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date" binding:"required"`
|
CreatedAt helpers.KontorTime `json:"created_date"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date"`
|
||||||
DeletedAt *time.Time `json:"deleted_date" binding:"omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
||||||
Version int `json:"version" binding:"required"`
|
Version int `json:"version"`
|
||||||
ProfileID *string `json:"profile_id" binding:"required"`
|
ProfileID *string `json:"profile_id"`
|
||||||
PermissionID *string `json:"permission_id" binding:"required"`
|
PermissionID *string `json:"permission_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func ConvertAssignmentsToDtos(assignments []Assignment) []AssignmentDTO {
|
||||||
|
dtos := make([]AssignmentDTO, len(assignments))
|
||||||
|
for i, assignment := range assignments {
|
||||||
|
dtos[i] = AssignmentDTO{
|
||||||
|
ID: assignment.ID,
|
||||||
|
CreatedAt: helpers.KontorTime{Time: assignment.CreatedAt},
|
||||||
|
UpdatedAt: helpers.KontorTime{Time: assignment.UpdatedAt},
|
||||||
|
DeletedAt: assignment.DeletedAt,
|
||||||
|
Version: assignment.Version,
|
||||||
|
ProfileID: assignment.ProfileID,
|
||||||
|
PermissionID: assignment.PermissionID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dtos
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type Card struct {
|
type Card struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -24,8 +27,8 @@ func (card *Card) TableName() string {
|
|||||||
|
|
||||||
type CardDTO struct {
|
type CardDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date" binding:"required"`
|
CreatedAt helpers.KontorTime `json:"created_date" binding:"required"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date" binding:"required"`
|
||||||
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
|
||||||
Version int `json:"version" binding:"required"`
|
Version int `json:"version" binding:"required"`
|
||||||
CardNumber int `json:"card_number" binding:"required"`
|
CardNumber int `json:"card_number" binding:"required"`
|
||||||
@@ -40,8 +43,8 @@ func ConvertCardsToDtos(cards []Card) []CardDTO {
|
|||||||
for i, card := range cards {
|
for i, card := range cards {
|
||||||
dtos[i] = CardDTO{
|
dtos[i] = CardDTO{
|
||||||
ID: card.ID,
|
ID: card.ID,
|
||||||
CreatedAt: card.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: card.CreatedAt},
|
||||||
UpdatedAt: card.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: card.UpdatedAt},
|
||||||
DeletedAt: card.DeletedAt,
|
DeletedAt: card.DeletedAt,
|
||||||
Version: card.Version,
|
Version: card.Version,
|
||||||
CardNumber: card.CardNumber,
|
CardNumber: card.CardNumber,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type CardSet struct {
|
type CardSet struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -22,8 +25,8 @@ func (cardset *CardSet) TableName() string {
|
|||||||
|
|
||||||
type CardSetDTO struct {
|
type CardSetDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date" binding:"required"`
|
CreatedAt helpers.KontorTime `json:"created_date" binding:"required"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date" binding:"required"`
|
||||||
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
|
||||||
Version int `json:"version" binding:"required"`
|
Version int `json:"version" binding:"required"`
|
||||||
Name string `json:"name" binding:"required"`
|
Name string `json:"name" binding:"required"`
|
||||||
@@ -37,8 +40,8 @@ func ConvertCardSetsToDtos(cardsets []CardSet) []CardSetDTO {
|
|||||||
for i, cardset := range cardsets {
|
for i, cardset := range cardsets {
|
||||||
dtos[i] = CardSetDTO{
|
dtos[i] = CardSetDTO{
|
||||||
ID: cardset.ID,
|
ID: cardset.ID,
|
||||||
CreatedAt: cardset.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: cardset.CreatedAt},
|
||||||
UpdatedAt: cardset.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: cardset.UpdatedAt},
|
||||||
DeletedAt: cardset.DeletedAt,
|
DeletedAt: cardset.DeletedAt,
|
||||||
Version: cardset.Version,
|
Version: cardset.Version,
|
||||||
Name: cardset.Name,
|
Name: cardset.Name,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -29,8 +30,8 @@ func (comic *Comic) TableName() string {
|
|||||||
|
|
||||||
type ComicDTO struct {
|
type ComicDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date"`
|
CreatedAt helpers.KontorTime `json:"created_date"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date"`
|
||||||
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
||||||
Version int `json:"version"`
|
Version int `json:"version"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
@@ -45,8 +46,8 @@ func ConvertComicsToDtos(comics []Comic) []ComicDTO {
|
|||||||
for i, comic := range comics {
|
for i, comic := range comics {
|
||||||
dtos[i] = ComicDTO{
|
dtos[i] = ComicDTO{
|
||||||
ID: comic.ID,
|
ID: comic.ID,
|
||||||
CreatedAt: comic.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: comic.CreatedAt},
|
||||||
UpdatedAt: comic.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: comic.UpdatedAt},
|
||||||
DeletedAt: comic.DeletedAt,
|
DeletedAt: comic.DeletedAt,
|
||||||
Version: comic.Version,
|
Version: comic.Version,
|
||||||
Title: comic.Title,
|
Title: comic.Title,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type ComicWork struct {
|
type ComicWork struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -22,12 +25,12 @@ func (comic_work *ComicWork) TableName() string {
|
|||||||
|
|
||||||
type ComicworkDTO struct {
|
type ComicworkDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date"`
|
CreatedAt helpers.KontorTime `json:"created_date"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date"`
|
||||||
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
||||||
Version int `json:"version"`
|
Version int `json:"version"`
|
||||||
ArtistID *string `json:"artist_id"`
|
|
||||||
ComicID *string `json:"comic_id"`
|
ComicID *string `json:"comic_id"`
|
||||||
|
ArtistID *string `json:"artist_id"`
|
||||||
WorkTypeID *string `json:"work_type_id"`
|
WorkTypeID *string `json:"work_type_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,8 +39,8 @@ func ConvertComicworksToDtos(comicworks []ComicWork) []ComicworkDTO {
|
|||||||
for i, comicwork := range comicworks {
|
for i, comicwork := range comicworks {
|
||||||
dtos[i] = ComicworkDTO{
|
dtos[i] = ComicworkDTO{
|
||||||
ID: comicwork.ID,
|
ID: comicwork.ID,
|
||||||
CreatedAt: comicwork.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: comicwork.CreatedAt},
|
||||||
UpdatedAt: comicwork.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: comicwork.UpdatedAt},
|
||||||
DeletedAt: comicwork.DeletedAt,
|
DeletedAt: comicwork.DeletedAt,
|
||||||
Version: comicwork.Version,
|
Version: comicwork.Version,
|
||||||
ArtistID: comicwork.ArtistID,
|
ArtistID: comicwork.ArtistID,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type Issue struct {
|
type Issue struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -27,15 +30,18 @@ func (issue *Issue) TableName() string {
|
|||||||
|
|
||||||
type IssueDTO struct {
|
type IssueDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date"`
|
CreatedAt helpers.KontorTime `json:"created_date"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date"`
|
||||||
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
||||||
Version int `json:"version"`
|
Version int `json:"version"`
|
||||||
|
IssueNumber string `json:"issue_number"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
PublishedOn time.Time `json:"published_on"`
|
PublishedOn helpers.DateOnly `json:"published_on"`
|
||||||
|
InStock bool `json:"in_stock"`
|
||||||
|
IsRead bool `json:"is_read"`
|
||||||
ComicID *string `json:"comic_id"`
|
ComicID *string `json:"comic_id"`
|
||||||
StoryArcID *string `json:"story_arc_id"`
|
|
||||||
VolumeID *string `json:"volume_id"`
|
VolumeID *string `json:"volume_id"`
|
||||||
|
StoryArcID *string `json:"story_arc_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConvertIssuesToDtos(issues []Issue) []IssueDTO {
|
func ConvertIssuesToDtos(issues []Issue) []IssueDTO {
|
||||||
@@ -43,15 +49,18 @@ func ConvertIssuesToDtos(issues []Issue) []IssueDTO {
|
|||||||
for i, issue := range issues {
|
for i, issue := range issues {
|
||||||
dtos[i] = IssueDTO{
|
dtos[i] = IssueDTO{
|
||||||
ID: issue.ID,
|
ID: issue.ID,
|
||||||
CreatedAt: issue.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: issue.CreatedAt},
|
||||||
UpdatedAt: issue.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: issue.UpdatedAt},
|
||||||
DeletedAt: issue.DeletedAt,
|
DeletedAt: issue.DeletedAt,
|
||||||
Version: issue.Version,
|
Version: issue.Version,
|
||||||
|
IssueNumber: issue.IssueNumber,
|
||||||
Title: issue.Title,
|
Title: issue.Title,
|
||||||
PublishedOn: issue.PublishedOn,
|
PublishedOn: helpers.DateOnly{Time: issue.PublishedOn},
|
||||||
|
InStock: issue.InStock,
|
||||||
|
IsRead: issue.IsRead,
|
||||||
ComicID: issue.ComicID,
|
ComicID: issue.ComicID,
|
||||||
StoryArcID: issue.StoryArcID,
|
|
||||||
VolumeID: issue.VolumeID,
|
VolumeID: issue.VolumeID,
|
||||||
|
StoryArcID: issue.StoryArcID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dtos
|
return dtos
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type IssueWork struct {
|
type IssueWork struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -22,12 +25,12 @@ func (issue_work *IssueWork) TableName() string {
|
|||||||
|
|
||||||
type IssueworkDTO struct {
|
type IssueworkDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date"`
|
CreatedAt helpers.KontorTime `json:"created_date"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date"`
|
||||||
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
||||||
Version int `json:"version"`
|
Version int `json:"version"`
|
||||||
ArtistID *string `json:"artist_id"`
|
|
||||||
IssueID *string `json:"issue_id"`
|
IssueID *string `json:"issue_id"`
|
||||||
|
ArtistID *string `json:"artist_id"`
|
||||||
WorkTypeID *string `json:"work_type_id"`
|
WorkTypeID *string `json:"work_type_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,8 +39,8 @@ func ConvertIssueworksToDtos(issueworks []IssueWork) []IssueworkDTO {
|
|||||||
for i, issuework := range issueworks {
|
for i, issuework := range issueworks {
|
||||||
dtos[i] = IssueworkDTO{
|
dtos[i] = IssueworkDTO{
|
||||||
ID: issuework.ID,
|
ID: issuework.ID,
|
||||||
CreatedAt: issuework.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: issuework.CreatedAt},
|
||||||
UpdatedAt: issuework.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: issuework.UpdatedAt},
|
||||||
DeletedAt: issuework.DeletedAt,
|
DeletedAt: issuework.DeletedAt,
|
||||||
Version: issuework.Version,
|
Version: issuework.Version,
|
||||||
ArtistID: issuework.ArtistID,
|
ArtistID: issuework.ArtistID,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type MediaFile struct {
|
type MediaFile struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -25,9 +28,9 @@ func (media_file *MediaFile) TableName() string {
|
|||||||
|
|
||||||
type MediaFileDTO struct {
|
type MediaFileDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date"`
|
CreatedAt helpers.KontorTime `json:"created_date"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date"`
|
||||||
DeletedAt *time.Time `json:"deleted_date"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
||||||
Version int `json:"version"`
|
Version int `json:"version"`
|
||||||
CloudLink string `json:"cloud_link"`
|
CloudLink string `json:"cloud_link"`
|
||||||
FileName string `json:"file_name"`
|
FileName string `json:"file_name"`
|
||||||
@@ -43,8 +46,8 @@ func ConvertMediaFilesToDtos(media_files []MediaFile) []MediaFileDTO {
|
|||||||
for i, media_file := range media_files {
|
for i, media_file := range media_files {
|
||||||
dtos[i] = MediaFileDTO{
|
dtos[i] = MediaFileDTO{
|
||||||
ID: media_file.ID,
|
ID: media_file.ID,
|
||||||
CreatedAt: media_file.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: media_file.CreatedAt},
|
||||||
UpdatedAt: media_file.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: media_file.UpdatedAt},
|
||||||
DeletedAt: media_file.DeletedAt,
|
DeletedAt: media_file.DeletedAt,
|
||||||
Version: media_file.Version,
|
Version: media_file.Version,
|
||||||
CloudLink: media_file.CloudLink,
|
CloudLink: media_file.CloudLink,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type MediaLoFi struct {
|
type MediaLoFi struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -11,7 +14,7 @@ type MediaLoFi struct {
|
|||||||
WebLink string `gorm:"column:url" json:"url"`
|
WebLink string `gorm:"column:url" json:"url"`
|
||||||
Review bool `gorm:"column:review" json:"review"`
|
Review bool `gorm:"column:review" json:"review"`
|
||||||
ShouldDownload bool `gorm:"column:should_download" json:"should_download"`
|
ShouldDownload bool `gorm:"column:should_download" json:"should_download"`
|
||||||
Title string `gorm:"size:300, column:title" json:"title"`
|
Title string `gorm:"size:300;column:title" json:"title"`
|
||||||
FileName string `gorm:"column:file_name" json:"file_name"`
|
FileName string `gorm:"column:file_name" json:"file_name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,15 +24,15 @@ func (media_lofi *MediaLoFi) TableName() string {
|
|||||||
|
|
||||||
type MediaLoFiDTO struct {
|
type MediaLoFiDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date"`
|
CreatedAt helpers.KontorTime `json:"created_date"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date"`
|
||||||
DeletedAt *time.Time `json:"deleted_date"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
||||||
Version int `json:"version"`
|
Version int `json:"version"`
|
||||||
WebLink string `json:"url"`
|
FileName string `json:"file_name"`
|
||||||
Review bool `json:"review"`
|
Review bool `json:"review"`
|
||||||
ShouldDownload bool `json:"should_download"`
|
ShouldDownload bool `json:"should_download"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
FileName string `json:"file_name"`
|
WebLink string `json:"url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConvertMediaLoFisToDtos(media_lofis []MediaLoFi) []MediaLoFiDTO {
|
func ConvertMediaLoFisToDtos(media_lofis []MediaLoFi) []MediaLoFiDTO {
|
||||||
@@ -37,8 +40,8 @@ func ConvertMediaLoFisToDtos(media_lofis []MediaLoFi) []MediaLoFiDTO {
|
|||||||
for i, media_lofi := range media_lofis {
|
for i, media_lofi := range media_lofis {
|
||||||
dtos[i] = MediaLoFiDTO{
|
dtos[i] = MediaLoFiDTO{
|
||||||
ID: media_lofi.ID,
|
ID: media_lofi.ID,
|
||||||
CreatedAt: media_lofi.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: media_lofi.CreatedAt},
|
||||||
UpdatedAt: media_lofi.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: media_lofi.UpdatedAt},
|
||||||
DeletedAt: media_lofi.DeletedAt,
|
DeletedAt: media_lofi.DeletedAt,
|
||||||
Version: media_lofi.Version,
|
Version: media_lofi.Version,
|
||||||
WebLink: media_lofi.WebLink,
|
WebLink: media_lofi.WebLink,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type MediaVideo struct {
|
type MediaVideo struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -13,7 +16,7 @@ type MediaVideo struct {
|
|||||||
Path string `gorm:"column:path" json:"path"`
|
Path string `gorm:"column:path" json:"path"`
|
||||||
Review bool `gorm:"column:review" json:"review"`
|
Review bool `gorm:"column:review" json:"review"`
|
||||||
Title string `gorm:"size:300, column:title" json:"title"`
|
Title string `gorm:"size:300, column:title" json:"title"`
|
||||||
WebLink string `gorm:"uniqueIndex,column:url" json:"url"`
|
WebLink string `gorm:"uniqueIndex;column:url" json:"url"`
|
||||||
ShouldDownload bool `gorm:"column:should_download" json:"should_download"`
|
ShouldDownload bool `gorm:"column:should_download" json:"should_download"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,9 +26,9 @@ func (media_video *MediaVideo) TableName() string {
|
|||||||
|
|
||||||
type MediaVideoDTO struct {
|
type MediaVideoDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date"`
|
CreatedAt helpers.KontorTime `json:"created_date"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date"`
|
||||||
DeletedAt *time.Time `json:"deleted_date"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
||||||
Version int `json:"version"`
|
Version int `json:"version"`
|
||||||
CloudLink string `json:"cloud_link"`
|
CloudLink string `json:"cloud_link"`
|
||||||
FileName string `json:"file_name"`
|
FileName string `json:"file_name"`
|
||||||
@@ -41,8 +44,8 @@ func ConvertMediaVideosToDtos(media_videos []MediaVideo) []MediaVideoDTO {
|
|||||||
for i, media_video := range media_videos {
|
for i, media_video := range media_videos {
|
||||||
dtos[i] = MediaVideoDTO{
|
dtos[i] = MediaVideoDTO{
|
||||||
ID: media_video.ID,
|
ID: media_video.ID,
|
||||||
CreatedAt: media_video.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: media_video.CreatedAt},
|
||||||
UpdatedAt: media_video.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: media_video.UpdatedAt},
|
||||||
DeletedAt: media_video.DeletedAt,
|
DeletedAt: media_video.DeletedAt,
|
||||||
Version: media_video.Version,
|
Version: media_video.Version,
|
||||||
CloudLink: media_video.CloudLink,
|
CloudLink: media_video.CloudLink,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type Permission struct {
|
type Permission struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -18,9 +21,24 @@ func (permission *Permission) TableName() string {
|
|||||||
|
|
||||||
type PermissionDTO struct {
|
type PermissionDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date" binding:"required"`
|
CreatedAt helpers.KontorTime `json:"created_date" binding:"required"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date" binding:"required"`
|
||||||
DeletedAt *time.Time `json:"deleted_date" binding:"omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"required"`
|
||||||
Version int `json:"version" binding:"required"`
|
Version int `json:"version" binding:"required"`
|
||||||
Name string `json:"name" binding:"required"`
|
Name string `json:"name" binding:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ConvertPermissionsToDtos(permissions []Permission) []PermissionDTO {
|
||||||
|
dtos := make([]PermissionDTO, len(permissions))
|
||||||
|
for i, permission := range permissions {
|
||||||
|
dtos[i] = PermissionDTO{
|
||||||
|
ID: permission.ID,
|
||||||
|
CreatedAt: helpers.KontorTime{Time: permission.CreatedAt},
|
||||||
|
UpdatedAt: helpers.KontorTime{Time: permission.UpdatedAt},
|
||||||
|
DeletedAt: permission.DeletedAt,
|
||||||
|
Version: permission.Version,
|
||||||
|
Name: permission.Name,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dtos
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type Player struct {
|
type Player struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -19,8 +22,8 @@ func (player *Player) TableName() string {
|
|||||||
|
|
||||||
type PlayerDTO struct {
|
type PlayerDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date" binding:"required"`
|
CreatedAt helpers.KontorTime `json:"created_date" binding:"required"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date" binding:"required"`
|
||||||
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
|
||||||
Version int `json:"version" binding:"required"`
|
Version int `json:"version" binding:"required"`
|
||||||
FirstName string `json:"first_name" binding:"required"`
|
FirstName string `json:"first_name" binding:"required"`
|
||||||
@@ -32,8 +35,8 @@ func ConvertPlayersToDtos(players []Player) []PlayerDTO {
|
|||||||
for i, player := range players {
|
for i, player := range players {
|
||||||
dtos[i] = PlayerDTO{
|
dtos[i] = PlayerDTO{
|
||||||
ID: player.ID,
|
ID: player.ID,
|
||||||
CreatedAt: player.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: player.CreatedAt},
|
||||||
UpdatedAt: player.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: player.UpdatedAt},
|
||||||
DeletedAt: player.DeletedAt,
|
DeletedAt: player.DeletedAt,
|
||||||
Version: player.Version,
|
Version: player.Version,
|
||||||
FirstName: player.FirstName,
|
FirstName: player.FirstName,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type Position struct {
|
type Position struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -21,8 +24,8 @@ func (position *Position) TableName() string {
|
|||||||
|
|
||||||
type PositionDTO struct {
|
type PositionDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date" binding:"required"`
|
CreatedAt helpers.KontorTime `json:"created_date" binding:"required"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date" binding:"required"`
|
||||||
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
|
||||||
Version int `json:"version" binding:"required"`
|
Version int `json:"version" binding:"required"`
|
||||||
Name string `json:"name" binding:"required"`
|
Name string `json:"name" binding:"required"`
|
||||||
@@ -35,8 +38,8 @@ func ConvertPositionsToDtos(positions []Position) []PositionDTO {
|
|||||||
for i, position := range positions {
|
for i, position := range positions {
|
||||||
dtos[i] = PositionDTO{
|
dtos[i] = PositionDTO{
|
||||||
ID: position.ID,
|
ID: position.ID,
|
||||||
CreatedAt: position.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: position.CreatedAt},
|
||||||
UpdatedAt: position.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: position.UpdatedAt},
|
||||||
DeletedAt: position.DeletedAt,
|
DeletedAt: position.DeletedAt,
|
||||||
Version: position.Version,
|
Version: position.Version,
|
||||||
Name: position.Name,
|
Name: position.Name,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type Profile struct {
|
type Profile struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -35,11 +38,11 @@ func (profile *Profile) GetFullName() string {
|
|||||||
return full_name
|
return full_name
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProfileDTO_ struct {
|
type ProfileDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date" binding:"required"`
|
CreatedAt helpers.KontorTime `json:"created_date" binding:"required"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date" binding:"required"`
|
||||||
DeletedAt *time.Time `json:"deleted_date" binding:"omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
||||||
Version int `json:"version" binding:"required"`
|
Version int `json:"version" binding:"required"`
|
||||||
First_Name *string `json:"first_name" binding:"required"`
|
First_Name *string `json:"first_name" binding:"required"`
|
||||||
Last_Name *string `json:"last_name" binding:"required"`
|
Last_Name *string `json:"last_name" binding:"required"`
|
||||||
@@ -49,6 +52,26 @@ type ProfileDTO_ struct {
|
|||||||
Enabled bool `json:"enabled" binding:"required"`
|
Enabled bool `json:"enabled" binding:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ConvertProfilesToDtos(profiles []Profile) []ProfileDTO {
|
||||||
|
dtos := make([]ProfileDTO, len(profiles))
|
||||||
|
for i, profile := range profiles {
|
||||||
|
dtos[i] = ProfileDTO{
|
||||||
|
ID: profile.ID,
|
||||||
|
CreatedAt: helpers.KontorTime{Time: profile.CreatedAt},
|
||||||
|
UpdatedAt: helpers.KontorTime{Time: profile.UpdatedAt},
|
||||||
|
DeletedAt: profile.DeletedAt,
|
||||||
|
Version: profile.Version,
|
||||||
|
First_Name: profile.First_Name,
|
||||||
|
Last_Name: profile.Last_Name,
|
||||||
|
User_Name: profile.User_Name,
|
||||||
|
Email: profile.Email,
|
||||||
|
Password: profile.Password,
|
||||||
|
Enabled: profile.Enabled,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dtos
|
||||||
|
}
|
||||||
|
|
||||||
type LoginInput struct {
|
type LoginInput struct {
|
||||||
Email string `json:"email" binding:"required"`
|
Email string `json:"email" binding:"required"`
|
||||||
Password string `json:"password" binding:"required"`
|
Password string `json:"password" binding:"required"`
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type Publisher struct {
|
type Publisher struct {
|
||||||
ID string `gorm:"type:string;primary_key;"`
|
ID string `gorm:"type:string;primary_key;"`
|
||||||
@@ -22,8 +25,8 @@ func (publisher *Publisher) TableName() string {
|
|||||||
|
|
||||||
type PublisherDTO struct {
|
type PublisherDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date"`
|
CreatedAt helpers.KontorTime `json:"created_date"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date"`
|
||||||
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
||||||
Version int `json:"version"`
|
Version int `json:"version"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@@ -33,16 +36,16 @@ type PublisherDTO struct {
|
|||||||
|
|
||||||
func ConvertPublishersToDtos(publishers []Publisher) []PublisherDTO {
|
func ConvertPublishersToDtos(publishers []Publisher) []PublisherDTO {
|
||||||
dtos := make([]PublisherDTO, len(publishers))
|
dtos := make([]PublisherDTO, len(publishers))
|
||||||
for i, comic := range publishers {
|
for i, publisher := range publishers {
|
||||||
dtos[i] = PublisherDTO{
|
dtos[i] = PublisherDTO{
|
||||||
ID: comic.ID,
|
ID: publisher.ID,
|
||||||
CreatedAt: comic.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: publisher.CreatedAt},
|
||||||
UpdatedAt: comic.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: publisher.UpdatedAt},
|
||||||
DeletedAt: comic.DeletedAt,
|
DeletedAt: publisher.DeletedAt,
|
||||||
Version: comic.Version,
|
Version: publisher.Version,
|
||||||
Name: comic.Name,
|
Name: publisher.Name,
|
||||||
WebLink: comic.WebLink,
|
WebLink: publisher.WebLink,
|
||||||
ParentPublisherID: comic.ParentPublisherID,
|
ParentPublisherID: publisher.ParentPublisherID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dtos
|
return dtos
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type Rooster struct {
|
type Rooster struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -24,8 +27,8 @@ func (rooster *Rooster) TableName() string {
|
|||||||
|
|
||||||
type RoosterDTO struct {
|
type RoosterDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date" binding:"required"`
|
CreatedAt helpers.KontorTime `json:"created_date" binding:"required"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date" binding:"required"`
|
||||||
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
|
||||||
Version int `json:"version" binding:"required"`
|
Version int `json:"version" binding:"required"`
|
||||||
Year int `json:"year" binding:"required"`
|
Year int `json:"year" binding:"required"`
|
||||||
@@ -39,8 +42,8 @@ func ConvertRoostersToDtos(roosters []Rooster) []RoosterDTO {
|
|||||||
for i, rooster := range roosters {
|
for i, rooster := range roosters {
|
||||||
dtos[i] = RoosterDTO{
|
dtos[i] = RoosterDTO{
|
||||||
ID: rooster.ID,
|
ID: rooster.ID,
|
||||||
CreatedAt: rooster.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: rooster.CreatedAt},
|
||||||
UpdatedAt: rooster.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: rooster.UpdatedAt},
|
||||||
DeletedAt: rooster.DeletedAt,
|
DeletedAt: rooster.DeletedAt,
|
||||||
Version: rooster.Version,
|
Version: rooster.Version,
|
||||||
Year: rooster.Year,
|
Year: rooster.Year,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type Sport struct {
|
type Sport struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -17,8 +20,8 @@ func (sport *Sport) TableName() string {
|
|||||||
|
|
||||||
type SportDTO struct {
|
type SportDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date" binding:"required"`
|
CreatedAt helpers.KontorTime `json:"created_date" binding:"required"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date" binding:"required"`
|
||||||
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
|
||||||
Version int `json:"version" binding:"required"`
|
Version int `json:"version" binding:"required"`
|
||||||
Name string `json:"name" binding:"required"`
|
Name string `json:"name" binding:"required"`
|
||||||
@@ -29,8 +32,8 @@ func ConvertSportsToDtos(sports []Sport) []SportDTO {
|
|||||||
for i, sport := range sports {
|
for i, sport := range sports {
|
||||||
dtos[i] = SportDTO{
|
dtos[i] = SportDTO{
|
||||||
ID: sport.ID,
|
ID: sport.ID,
|
||||||
CreatedAt: sport.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: sport.CreatedAt},
|
||||||
UpdatedAt: sport.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: sport.UpdatedAt},
|
||||||
DeletedAt: sport.DeletedAt,
|
DeletedAt: sport.DeletedAt,
|
||||||
Version: sport.Version,
|
Version: sport.Version,
|
||||||
Name: sport.Name,
|
Name: sport.Name,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type StoryArc struct {
|
type StoryArc struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -21,8 +24,8 @@ func (story_arc *StoryArc) TableName() string {
|
|||||||
|
|
||||||
type StoryArcDTO struct {
|
type StoryArcDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date"`
|
CreatedAt helpers.KontorTime `json:"created_date"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date"`
|
||||||
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
||||||
Version int `json:"version"`
|
Version int `json:"version"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@@ -35,8 +38,8 @@ func ConvertStoryArcsToDtos(storyarcs []StoryArc) []StoryArcDTO {
|
|||||||
for i, storyarc := range storyarcs {
|
for i, storyarc := range storyarcs {
|
||||||
dtos[i] = StoryArcDTO{
|
dtos[i] = StoryArcDTO{
|
||||||
ID: storyarc.ID,
|
ID: storyarc.ID,
|
||||||
CreatedAt: storyarc.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: storyarc.CreatedAt},
|
||||||
UpdatedAt: storyarc.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: storyarc.UpdatedAt},
|
||||||
DeletedAt: storyarc.DeletedAt,
|
DeletedAt: storyarc.DeletedAt,
|
||||||
Version: storyarc.Version,
|
Version: storyarc.Version,
|
||||||
Name: storyarc.Name,
|
Name: storyarc.Name,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type Team struct {
|
type Team struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -21,8 +24,8 @@ func (team *Team) TableName() string {
|
|||||||
|
|
||||||
type TeamDTO struct {
|
type TeamDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date" binding:"required"`
|
CreatedAt helpers.KontorTime `json:"created_date" binding:"required"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date" binding:"required"`
|
||||||
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
|
||||||
Version int `json:"version" binding:"required"`
|
Version int `json:"version" binding:"required"`
|
||||||
Name string `json:"name" binding:"required"`
|
Name string `json:"name" binding:"required"`
|
||||||
@@ -35,8 +38,8 @@ func ConvertTeamsToDtos(teams []Team) []TeamDTO {
|
|||||||
for i, team := range teams {
|
for i, team := range teams {
|
||||||
dtos[i] = TeamDTO{
|
dtos[i] = TeamDTO{
|
||||||
ID: team.ID,
|
ID: team.ID,
|
||||||
CreatedAt: team.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: team.CreatedAt},
|
||||||
UpdatedAt: team.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: team.UpdatedAt},
|
||||||
DeletedAt: team.DeletedAt,
|
DeletedAt: team.DeletedAt,
|
||||||
Version: team.Version,
|
Version: team.Version,
|
||||||
Name: team.Name,
|
Name: team.Name,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type Token struct {
|
type Token struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -22,10 +25,25 @@ func (token *Token) TableName() string {
|
|||||||
|
|
||||||
type TokenDTO struct {
|
type TokenDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date" binding:"required"`
|
CreatedAt helpers.KontorTime `json:"created_date"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date"`
|
||||||
DeletedAt *time.Time `json:"deleted_date" binding:"omitempty"`
|
DeletedAt *time.Time `json:"deleted_date.omitempty"`
|
||||||
Version int `json:"version" binding:"required"`
|
Version int `json:"version"`
|
||||||
Token string `json:"token" binding:"required"`
|
Token string `json:"token"`
|
||||||
ProfileID *string `json:"profile_id" binding:"required"`
|
ProfileID *string `json:"profile_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func ConvertTokensToDtos(tokens []Token) []TokenDTO {
|
||||||
|
dtos := make([]TokenDTO, len(tokens))
|
||||||
|
for i, token := range tokens {
|
||||||
|
dtos[i] = TokenDTO{
|
||||||
|
ID: token.ID,
|
||||||
|
CreatedAt: helpers.KontorTime{Time: token.CreatedAt},
|
||||||
|
UpdatedAt: helpers.KontorTime{Time: token.UpdatedAt},
|
||||||
|
DeletedAt: token.DeletedAt,
|
||||||
|
Version: token.Version,
|
||||||
|
ProfileID: token.ProfileID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dtos
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type TradePaperback struct {
|
type TradePaperback 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"`
|
CreatedAt time.Time `gorm:"column:created_date" json:"created_date"`
|
||||||
UpdatedAt time.Time `gorm:"column:last_modified_date" json:"last_modified_date"`
|
UpdatedAt time.Time `gorm:"column:last_modified_date" json:"last_modified_date"`
|
||||||
DeletedAt *time.Time `gorm:"column:deleted_date" json:"deleted_date"`
|
DeletedAt *time.Time `gorm:"column:deleted_date" json:"deleted_date"`
|
||||||
@@ -12,9 +15,39 @@ type TradePaperback struct {
|
|||||||
IssueStart int `gorm:"column:issue_start" json:"issue_start"`
|
IssueStart int `gorm:"column:issue_start" json:"issue_start"`
|
||||||
IssueEnd int `gorm:"column:issue_end" json:"issue_end"`
|
IssueEnd int `gorm:"column:issue_end" json:"issue_end"`
|
||||||
ComicID *string `gorm:"column:comic_id" json:"comic_id"`
|
ComicID *string `gorm:"column:comic_id" json:"comic_id"`
|
||||||
Comic *Comic `gorm:"foreignKey:ComicID"`
|
Comic *Comic `gorm:"foreignKey:ComicID" json:"comic"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (trade_paperback *TradePaperback) TableName() string {
|
func (trade_paperback *TradePaperback) TableName() string {
|
||||||
return "trade_paperback"
|
return "trade_paperback"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type TradePaperbackDTO struct {
|
||||||
|
ID string `json:"id" binding:"required"`
|
||||||
|
CreatedAt helpers.KontorTime `json:"created_date" binding:"required"`
|
||||||
|
UpdatedAt helpers.KontorTime `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"`
|
||||||
|
IssueStart int `json:"issue_start"`
|
||||||
|
IssueEnd int `json:"issue_end"`
|
||||||
|
ComicID *string `json:"comic_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func ConvertTradePaperbacksToDtos(tradepaperbacks []TradePaperback) []TradePaperbackDTO {
|
||||||
|
dtos := make([]TradePaperbackDTO, len(tradepaperbacks))
|
||||||
|
for i, tradepaperback := range tradepaperbacks {
|
||||||
|
dtos[i] = TradePaperbackDTO{
|
||||||
|
ID: tradepaperback.ID,
|
||||||
|
CreatedAt: helpers.KontorTime{Time: tradepaperback.CreatedAt},
|
||||||
|
UpdatedAt: helpers.KontorTime{Time: tradepaperback.UpdatedAt},
|
||||||
|
DeletedAt: tradepaperback.DeletedAt,
|
||||||
|
Version: tradepaperback.Version,
|
||||||
|
Name: tradepaperback.Name,
|
||||||
|
IssueStart: tradepaperback.IssueStart,
|
||||||
|
IssueEnd: tradepaperback.IssueEnd,
|
||||||
|
ComicID: tradepaperback.ComicID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dtos
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type Vendor struct {
|
type Vendor struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -19,8 +22,8 @@ func (vendor *Vendor) TableName() string {
|
|||||||
|
|
||||||
type VendorDTO struct {
|
type VendorDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date" binding:"required"`
|
CreatedAt helpers.KontorTime `json:"created_date" binding:"required"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date" binding:"required"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date" binding:"required"`
|
||||||
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty" binding:"omitempty"`
|
||||||
Version int `json:"version" binding:"required"`
|
Version int `json:"version" binding:"required"`
|
||||||
Name string `json:"name" binding:"required"`
|
Name string `json:"name" binding:"required"`
|
||||||
@@ -31,8 +34,8 @@ func ConvertVendorsToDtos(vendors []Vendor) []VendorDTO {
|
|||||||
for i, vendor := range vendors {
|
for i, vendor := range vendors {
|
||||||
dtos[i] = VendorDTO{
|
dtos[i] = VendorDTO{
|
||||||
ID: vendor.ID,
|
ID: vendor.ID,
|
||||||
CreatedAt: vendor.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: vendor.CreatedAt},
|
||||||
UpdatedAt: vendor.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: vendor.UpdatedAt},
|
||||||
DeletedAt: vendor.DeletedAt,
|
DeletedAt: vendor.DeletedAt,
|
||||||
Version: vendor.Version,
|
Version: vendor.Version,
|
||||||
Name: vendor.Name,
|
Name: vendor.Name,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type Volume struct {
|
type Volume struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -19,8 +22,8 @@ func (volume *Volume) TableName() string {
|
|||||||
|
|
||||||
type VolumeDTO struct {
|
type VolumeDTO struct {
|
||||||
ID string `json:"id" binding:"required"`
|
ID string `json:"id" binding:"required"`
|
||||||
CreatedAt time.Time `json:"created_date"`
|
CreatedAt helpers.KontorTime `json:"created_date"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date"`
|
||||||
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
||||||
Version int `json:"version"`
|
Version int `json:"version"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@@ -32,8 +35,8 @@ func ConvertVolumesToDtos(volumes []Volume) []VolumeDTO {
|
|||||||
for i, volume := range volumes {
|
for i, volume := range volumes {
|
||||||
dtos[i] = VolumeDTO{
|
dtos[i] = VolumeDTO{
|
||||||
ID: volume.ID,
|
ID: volume.ID,
|
||||||
CreatedAt: volume.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: volume.CreatedAt},
|
||||||
UpdatedAt: volume.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: volume.UpdatedAt},
|
||||||
DeletedAt: volume.DeletedAt,
|
DeletedAt: volume.DeletedAt,
|
||||||
Version: volume.Version,
|
Version: volume.Version,
|
||||||
Name: volume.Name,
|
Name: volume.Name,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"kontor-api-gin/internal/helpers"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type WorkType struct {
|
type WorkType struct {
|
||||||
ID string `gorm:"type:string;primary_key;" json:"id"`
|
ID string `gorm:"type:string;primary_key;" json:"id"`
|
||||||
@@ -17,9 +20,9 @@ func (worktype *WorkType) TableName() string {
|
|||||||
|
|
||||||
type WorkTypeDTO struct {
|
type WorkTypeDTO struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
CreatedAt time.Time `json:"created_date"`
|
CreatedAt helpers.KontorTime `json:"created_date"`
|
||||||
UpdatedAt time.Time `json:"last_modified_date"`
|
UpdatedAt helpers.KontorTime `json:"last_modified_date"`
|
||||||
DeletedAt *time.Time `json:"deleted_date"`
|
DeletedAt *time.Time `json:"deleted_date,omitempty"`
|
||||||
Version int `json:"version"`
|
Version int `json:"version"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
}
|
}
|
||||||
@@ -29,8 +32,8 @@ func ConvertWorkTypesToDtos(worktypes []WorkType) []WorkTypeDTO {
|
|||||||
for i, worktype := range worktypes {
|
for i, worktype := range worktypes {
|
||||||
dtos[i] = WorkTypeDTO{
|
dtos[i] = WorkTypeDTO{
|
||||||
ID: worktype.ID,
|
ID: worktype.ID,
|
||||||
CreatedAt: worktype.CreatedAt,
|
CreatedAt: helpers.KontorTime{Time: worktype.CreatedAt},
|
||||||
UpdatedAt: worktype.UpdatedAt,
|
UpdatedAt: helpers.KontorTime{Time: worktype.UpdatedAt},
|
||||||
DeletedAt: worktype.DeletedAt,
|
DeletedAt: worktype.DeletedAt,
|
||||||
Version: worktype.Version,
|
Version: worktype.Version,
|
||||||
Name: worktype.Name,
|
Name: worktype.Name,
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"kontor-api-gin/internal/models"
|
||||||
|
"log/slog"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AssignmentRepository struct {
|
||||||
|
db *gorm.DB
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewAssignmentRepository(db *gorm.DB) *AssignmentRepository {
|
||||||
|
repository := &AssignmentRepository{db: db}
|
||||||
|
return repository
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repository *AssignmentRepository) FindAll(context context.Context) ([]models.Assignment, error) {
|
||||||
|
var assignments []models.Assignment
|
||||||
|
|
||||||
|
result := repository.db.Find(&assignments)
|
||||||
|
slog.Info("AssignmentRepository#FindAll", "count", result.RowsAffected)
|
||||||
|
|
||||||
|
return assignments, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repository *AssignmentRepository) GetById(context context.Context, id string) (models.Assignment, error) {
|
||||||
|
var assignment = models.Assignment{ID: id}
|
||||||
|
slog.Info("AssignmentRepository#GetById", "id", id)
|
||||||
|
result := repository.db.First(&assignment)
|
||||||
|
if result.Error != nil {
|
||||||
|
slog.Info("AssignmentRepository#GetById", "error", result.Error.Error())
|
||||||
|
}
|
||||||
|
return assignment, result.Error
|
||||||
|
}
|
||||||
@@ -21,7 +21,7 @@ func (repository *IssueworkRepository) FindAll(context context.Context) ([]model
|
|||||||
var issueworks []models.IssueWork
|
var issueworks []models.IssueWork
|
||||||
|
|
||||||
result := repository.db.Find(&issueworks)
|
result := repository.db.Find(&issueworks)
|
||||||
slog.Info("IssueRepository#FindAll", "count", result.RowsAffected)
|
slog.Info("IssueworkRepository#FindAll", "count", result.RowsAffected)
|
||||||
|
|
||||||
return issueworks, nil
|
return issueworks, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"kontor-api-gin/internal/models"
|
||||||
|
"log/slog"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MediaVideoRepository struct {
|
||||||
|
db *gorm.DB
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewMediaVideoRepository(db *gorm.DB) *MediaVideoRepository {
|
||||||
|
repo := &MediaVideoRepository{db: db}
|
||||||
|
return repo
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repository *MediaVideoRepository) FindAll(context context.Context) ([]models.MediaVideo, error) {
|
||||||
|
var videos []models.MediaVideo
|
||||||
|
|
||||||
|
result := repository.db.Find(&videos)
|
||||||
|
slog.Info("MediaVideoRepository#FindAll", "count", result.RowsAffected)
|
||||||
|
|
||||||
|
return videos, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"kontor-api-gin/internal/models"
|
||||||
|
"log/slog"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
type TokenRepository struct {
|
||||||
|
db *gorm.DB
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTokenRepository(db *gorm.DB) *TokenRepository {
|
||||||
|
repository := &TokenRepository{db: db}
|
||||||
|
return repository
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repository *TokenRepository) FindAll(context context.Context) ([]models.Token, error) {
|
||||||
|
var tokens []models.Token
|
||||||
|
|
||||||
|
result := repository.db.Find(&tokens)
|
||||||
|
slog.Info("TokenRepository#FindAll", "count", result.RowsAffected)
|
||||||
|
|
||||||
|
return tokens, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repository *TokenRepository) GetById(context context.Context, id string) (models.Token, error) {
|
||||||
|
var token = models.Token{ID: id}
|
||||||
|
slog.Info("TokenRepository#GetById", "id", id)
|
||||||
|
result := repository.db.First(&token)
|
||||||
|
if result.Error != nil {
|
||||||
|
slog.Info("TokenRepository#GetById", "error", result.Error.Error())
|
||||||
|
}
|
||||||
|
return token, result.Error
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"kontor-api-gin/internal/models"
|
||||||
|
"log/slog"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
type TradePaperbackRepository struct {
|
||||||
|
db *gorm.DB
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTradePaperbackRepository(db *gorm.DB) *TradePaperbackRepository {
|
||||||
|
repo := &TradePaperbackRepository{db: db}
|
||||||
|
return repo
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repository *TradePaperbackRepository) FindAll(context context.Context) ([]models.TradePaperback, error) {
|
||||||
|
var tradepaperbacks []models.TradePaperback
|
||||||
|
|
||||||
|
result := repository.db.Find(&tradepaperbacks)
|
||||||
|
slog.Info("TradePaperbackRepository#FindAll", "count", result.RowsAffected)
|
||||||
|
|
||||||
|
return tradepaperbacks, nil
|
||||||
|
}
|
||||||
@@ -21,7 +21,7 @@ func (repository *WorkTypeRepository) FindAll(context context.Context) ([]models
|
|||||||
var workTypes []models.WorkType
|
var workTypes []models.WorkType
|
||||||
|
|
||||||
result := repository.db.Find(&workTypes)
|
result := repository.db.Find(&workTypes)
|
||||||
slog.Info("VolumeRepository#FindAll", "count", result.RowsAffected)
|
slog.Info("WorkTypeRepository#FindAll", "count", result.RowsAffected)
|
||||||
|
|
||||||
return workTypes, nil
|
return workTypes, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,10 @@ func New(admin *handlers.AdminHandler, comics *handlers.ComicsHandler, media *ha
|
|||||||
{
|
{
|
||||||
secured := v1.Group("")
|
secured := v1.Group("")
|
||||||
secured.Use(middleware.JWT(admin.Secret))
|
secured.Use(middleware.JWT(admin.Secret))
|
||||||
secured.GET("admin/permissions", admin.PermissionHandler.List)
|
secured.GET("user/profiles", admin.ProfileHandler.List)
|
||||||
|
secured.GET("user/permissions", admin.PermissionHandler.List)
|
||||||
|
secured.GET("user/assignments", admin.AssignmentHandler.List)
|
||||||
|
secured.GET("user/tokens", admin.TokenHandler.List)
|
||||||
secured.GET("tysc/sports", tysc.SportHandler.List)
|
secured.GET("tysc/sports", tysc.SportHandler.List)
|
||||||
secured.GET("tysc/sports/:id", tysc.SportHandler.Get)
|
secured.GET("tysc/sports/:id", tysc.SportHandler.Get)
|
||||||
secured.GET("tysc/players", tysc.PlayerHandler.List)
|
secured.GET("tysc/players", tysc.PlayerHandler.List)
|
||||||
@@ -84,12 +87,14 @@ func New(admin *handlers.AdminHandler, comics *handlers.ComicsHandler, media *ha
|
|||||||
secured.GET("/comics/publishers", comics.PublisherHandler.List)
|
secured.GET("/comics/publishers", comics.PublisherHandler.List)
|
||||||
secured.GET("/comics/artists", comics.ArtistHandler.List)
|
secured.GET("/comics/artists", comics.ArtistHandler.List)
|
||||||
secured.GET("/comics/issues", comics.IssueHandler.List)
|
secured.GET("/comics/issues", comics.IssueHandler.List)
|
||||||
|
secured.GET("/comics/tradepaperbacks", comics.TradePaperbackHandler.List)
|
||||||
secured.GET("/comics/worktypes", comics.WorkTypeHandler.List)
|
secured.GET("/comics/worktypes", comics.WorkTypeHandler.List)
|
||||||
secured.GET("/comics/volumes", comics.VolumeHandler.List)
|
secured.GET("/comics/volumes", comics.VolumeHandler.List)
|
||||||
secured.GET("/comics/storyarcs", comics.StoryArcHandler.List)
|
secured.GET("/comics/storyarcs", comics.StoryArcHandler.List)
|
||||||
secured.GET("/comics/comicworks", comics.ComicworkHandler.List)
|
secured.GET("/comics/comicworks", comics.ComicworkHandler.List)
|
||||||
secured.GET("/comics/issueworks", comics.IssueworkHandler.List)
|
secured.GET("/comics/issueworks", comics.IssueworkHandler.List)
|
||||||
secured.GET("/media/files", media.MediaFileHandler.List)
|
secured.GET("/media/files", media.MediaFileHandler.List)
|
||||||
|
secured.GET("/media/videos", media.MediaVideoHandler.List)
|
||||||
secured.GET("/media/lofis", media.MediaLoFiHandler.List)
|
secured.GET("/media/lofis", media.MediaLoFiHandler.List)
|
||||||
secured.GET("/media/actors", media.MediaActorHandler.List)
|
secured.GET("/media/actors", media.MediaActorHandler.List)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package service
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"kontor-api-gin/internal/models"
|
||||||
|
"kontor-api-gin/internal/repository"
|
||||||
|
"log/slog"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AssignmentService struct {
|
||||||
|
repository *repository.AssignmentRepository
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewAssignmentService(repo *repository.AssignmentRepository) *AssignmentService {
|
||||||
|
service := &AssignmentService{repository: repo}
|
||||||
|
return service
|
||||||
|
}
|
||||||
|
|
||||||
|
func (service *AssignmentService) List(context context.Context) ([]models.Assignment, error) {
|
||||||
|
slog.Info("AssignmentService#List")
|
||||||
|
return service.repository.FindAll(context)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (service *AssignmentService) Get(context context.Context, id string) (models.Assignment, error) {
|
||||||
|
slog.Info("AssignmentService#Get")
|
||||||
|
return service.repository.GetById(context, id)
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package service
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"kontor-api-gin/internal/models"
|
||||||
|
"kontor-api-gin/internal/repository"
|
||||||
|
"log/slog"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MediaVideoService struct {
|
||||||
|
repository *repository.MediaVideoRepository
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewMediaVideoService(repo *repository.MediaVideoRepository) *MediaVideoService {
|
||||||
|
service := &MediaVideoService{repository: repo}
|
||||||
|
return service
|
||||||
|
}
|
||||||
|
|
||||||
|
func (service *MediaVideoService) List(context context.Context) ([]models.MediaVideo, error) {
|
||||||
|
slog.Info("MediaVideoService#List")
|
||||||
|
return service.repository.FindAll(context)
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package service
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"kontor-api-gin/internal/models"
|
||||||
|
"kontor-api-gin/internal/repository"
|
||||||
|
"log/slog"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ProfileService struct {
|
||||||
|
repository *repository.ProfileRepository
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewProfileService(repo *repository.ProfileRepository) *ProfileService {
|
||||||
|
service := &ProfileService{repository: repo}
|
||||||
|
return service
|
||||||
|
}
|
||||||
|
|
||||||
|
func (service *ProfileService) List(context context.Context) ([]models.Profile, error) {
|
||||||
|
slog.Info("ProfileService#List")
|
||||||
|
return service.repository.FindAll(context)
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package service
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"kontor-api-gin/internal/models"
|
||||||
|
"kontor-api-gin/internal/repository"
|
||||||
|
"log/slog"
|
||||||
|
)
|
||||||
|
|
||||||
|
type TokenService struct {
|
||||||
|
repository *repository.TokenRepository
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTokenService(repo *repository.TokenRepository) *TokenService {
|
||||||
|
service := &TokenService{repository: repo}
|
||||||
|
return service
|
||||||
|
}
|
||||||
|
|
||||||
|
func (service *TokenService) List(context context.Context) ([]models.Token, error) {
|
||||||
|
slog.Info("TokenService#List")
|
||||||
|
return service.repository.FindAll(context)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (service *TokenService) Get(context context.Context, id string) (models.Token, error) {
|
||||||
|
slog.Info("TokenService#Get")
|
||||||
|
return service.repository.GetById(context, id)
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package service
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"kontor-api-gin/internal/models"
|
||||||
|
"kontor-api-gin/internal/repository"
|
||||||
|
"log/slog"
|
||||||
|
)
|
||||||
|
|
||||||
|
type TradePaperbackService struct {
|
||||||
|
repository *repository.TradePaperbackRepository
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTradePaperbackService(repo *repository.TradePaperbackRepository) *TradePaperbackService {
|
||||||
|
service := &TradePaperbackService{repository: repo}
|
||||||
|
return service
|
||||||
|
}
|
||||||
|
|
||||||
|
func (service *TradePaperbackService) List(context context.Context) ([]models.TradePaperback, error) {
|
||||||
|
slog.Info("TradePaperbackService#List")
|
||||||
|
return service.repository.FindAll(context)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user