veza/veza-backend-api/internal/models/gear_repair.go
senke a3624ce4b3 feat(v0.802): frontend Cloud/Gear, MSW, docs, scope v0.803, archive
- Cloud: CloudFileVersions, CloudShareModal, versions/share in CloudView
- Gear: GearDocumentsTab, GearRepairsTab, warranty badge, initialTab
- MSW: cloud versions/share, gear documents/repairs, tags suggest
- Stories: CloudFileVersions, CloudShareModal, GearDetailModal variants
- gearService: listDocuments, uploadDocument, deleteDocument, listRepairs, createRepair, deleteRepair
- cloudService: listVersions, restoreVersion, shareFile, getSharedFile
- gear_warranty_notifier: 24h ticker, notifications for expiring warranty
- tag_handler_test: unit tests
- docs: API_REFERENCE, CHANGELOG, PROJECT_STATE, FEATURE_STATUS v0.802
- SCOPE_CONTROL, .cursorrules: scope v0.803
- archive: V0_802_RELEASE_SCOPE, RETROSPECTIVE_V0802
2026-02-25 14:00:58 +01:00

34 lines
1,014 B
Go

package models
import (
"time"
"github.com/google/uuid"
"gorm.io/gorm"
)
// GearRepair stores a repair record for a gear item
type GearRepair struct {
ID uuid.UUID `gorm:"type:uuid;primaryKey" json:"id"`
GearID uuid.UUID `gorm:"type:uuid;not null" json:"gear_id"`
RepairDate time.Time `gorm:"type:date;not null" json:"repair_date"`
Description string `gorm:"type:text;not null" json:"description"`
CostCents int `gorm:"not null;default:0" json:"cost_cents"`
Currency string `gorm:"size:3;not null;default:'EUR'" json:"currency"`
Provider string `gorm:"size:255" json:"provider"`
Notes string `gorm:"type:text" json:"notes"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
Gear *GearItem `gorm:"foreignKey:GearID;constraint:OnDelete:CASCADE" json:"-"`
}
func (GearRepair) TableName() string {
return "gear_repairs"
}
func (m *GearRepair) BeforeCreate(tx *gorm.DB) error {
if m.ID == uuid.Nil {
m.ID = uuid.New()
}
return nil
}