mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-13 18:36:37 +08:00
fix(contracts): decouple DTOs from ORM tags and table name mappings
This commit is contained in:
@@ -10,18 +10,13 @@ import (
|
|||||||
|
|
||||||
// SystemConfigDTO represents a system configuration key-value entry.
|
// SystemConfigDTO represents a system configuration key-value entry.
|
||||||
type SystemConfigDTO struct {
|
type SystemConfigDTO struct {
|
||||||
Key string `json:"key" gorm:"primaryKey;column:key;size:255"`
|
Key string `json:"key"`
|
||||||
Value string `json:"value" gorm:"column:value;type:text"`
|
Value string `json:"value"`
|
||||||
Type string `json:"type" gorm:"column:type;size:50"`
|
Type string `json:"type"`
|
||||||
Visibility int `json:"visibility" gorm:"column:visibility"`
|
Visibility int `json:"visibility"`
|
||||||
Description string `json:"description" gorm:"column:description;size:500"`
|
Description string `json:"description"`
|
||||||
UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at"`
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
CreatedAt time.Time `json:"created_at" gorm:"column:created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
}
|
|
||||||
|
|
||||||
// TableName returns the default table name for SystemConfigDTO.
|
|
||||||
func (SystemConfigDTO) TableName() string {
|
|
||||||
return "w_system_configs"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemConfigService defines the unified contract for querying and mutating system configurations.
|
// SystemConfigService defines the unified contract for querying and mutating system configurations.
|
||||||
|
|||||||
@@ -71,11 +71,6 @@ type TaskExecutionDTO struct {
|
|||||||
UpdatedAt time.Time `json:"updated_at"`
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName returns the default table name for TaskExecutionDTO.
|
|
||||||
func (TaskExecutionDTO) TableName() string {
|
|
||||||
return "w_task_executions"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Canonical triggered_by values persisted on task executions and shown in admin UI.
|
// Canonical triggered_by values persisted on task executions and shown in admin UI.
|
||||||
const (
|
const (
|
||||||
TaskTriggerSystem = "system"
|
TaskTriggerSystem = "system"
|
||||||
|
|||||||
@@ -23,25 +23,20 @@ type UploadMetadataDTO struct {
|
|||||||
|
|
||||||
// UploadDTO represents an uploaded file record.
|
// UploadDTO represents an uploaded file record.
|
||||||
type UploadDTO struct {
|
type UploadDTO struct {
|
||||||
ID uint64 `json:"id" gorm:"primaryKey"`
|
ID uint64 `json:"id"`
|
||||||
UserID uint64 `json:"user_id" gorm:"index"`
|
UserID uint64 `json:"user_id"`
|
||||||
FileName string `json:"file_name" gorm:"size:255"`
|
FileName string `json:"file_name"`
|
||||||
FilePath string `json:"file_path" gorm:"size:500"`
|
FilePath string `json:"file_path"`
|
||||||
MimeType string `json:"mime_type" gorm:"size:100"`
|
MimeType string `json:"mime_type"`
|
||||||
Size int64 `json:"size"`
|
Size int64 `json:"size"`
|
||||||
Hash string `json:"hash" gorm:"size:64"`
|
Hash string `json:"hash"`
|
||||||
Status string `json:"status" gorm:"type:varchar(20)"`
|
Status string `json:"status"`
|
||||||
Type string `json:"type" gorm:"size:50;index"`
|
Type string `json:"type"`
|
||||||
Metadata UploadMetadataDTO `json:"metadata" gorm:"serializer:json;type:jsonb"`
|
Metadata UploadMetadataDTO `json:"metadata"`
|
||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
UpdatedAt time.Time `json:"updated_at"`
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName returns the default table name for UploadDTO.
|
|
||||||
func (UploadDTO) TableName() string {
|
|
||||||
return "w_uploads"
|
|
||||||
}
|
|
||||||
|
|
||||||
// OpenedUploadDTO encapsulates the retrieved object stream and its metadata.
|
// OpenedUploadDTO encapsulates the retrieved object stream and its metadata.
|
||||||
type OpenedUploadDTO struct {
|
type OpenedUploadDTO struct {
|
||||||
Upload UploadDTO
|
Upload UploadDTO
|
||||||
|
|||||||
Reference in New Issue
Block a user