WIP: Export Kontor DB
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5s

This commit is contained in:
Thomas Peetz
2026-10-01 17:40:17 +02:00
parent f5abb44466
commit 4aaf580735
47 changed files with 1101 additions and 369 deletions
+27 -8
View File
@@ -1,6 +1,9 @@
package models
import "time"
import (
"kontor-api-gin/internal/helpers"
"time"
)
type Assignment struct {
ID string `gorm:"type:string;primary_key;" json:"id"`
@@ -19,11 +22,27 @@ func (assignment *Assignment) TableName() string {
}
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"`
ID string `json:"id" binding:"required"`
CreatedAt helpers.KontorTime `json:"created_date"`
UpdatedAt helpers.KontorTime `json:"last_modified_date"`
DeletedAt *time.Time `json:"deleted_date,omitempty"`
Version int `json:"version"`
ProfileID *string `json:"profile_id"`
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
}