veza/veza-backend-api/internal/models/data_export.go
senke a1000ce7fb style(backend): gofmt -w on 85 files (whitespace only)
backend-ci.yml's `test -z "$(gofmt -l .)"` strict gate (added in
13c21ac11) failed on a backlog of unformatted files. None of the
85 files in this commit had been edited since the gate was added
because no push touched veza-backend-api/** in between, so the
gate never fired until today's CI fixes triggered it.

The diff is exclusively whitespace alignment in struct literals
and trailing-space comments. `go build ./...` and the full test
suite (with VEZA_SKIP_INTEGRATION=1 -short) pass identically.
2026-04-14 12:22:14 +02:00

34 lines
1.1 KiB
Go

package models
import (
"time"
"github.com/google/uuid"
"gorm.io/gorm"
)
// DataExport represents a GDPR data export job (v0.10.8 F065)
type DataExport struct {
ID uuid.UUID `gorm:"type:uuid;primaryKey" json:"id"`
UserID uuid.UUID `gorm:"type:uuid;not null" json:"user_id"`
Status string `gorm:"type:varchar(20);not null;default:'pending'" json:"status"` // pending, processing, completed, failed
S3Key *string `gorm:"type:text" json:"s3_key,omitempty"`
FileSizeBytes *int64 `json:"file_size_bytes,omitempty"`
ExpiresAt time.Time `gorm:"not null" json:"expires_at"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
ErrorMessage *string `gorm:"type:text" json:"error_message,omitempty"`
}
// TableName returns the table name for DataExport
func (DataExport) TableName() string {
return "data_exports"
}
// BeforeCreate generates UUID if not set
func (e *DataExport) BeforeCreate(tx *gorm.DB) error {
if e.ID == uuid.Nil {
e.ID = uuid.New()
}
return nil
}