diff --git a/VEZA_COMPLETE_MVP_TODOLIST.json b/VEZA_COMPLETE_MVP_TODOLIST.json index 9c0125e0e..09883e628 100644 --- a/VEZA_COMPLETE_MVP_TODOLIST.json +++ b/VEZA_COMPLETE_MVP_TODOLIST.json @@ -3035,7 +3035,7 @@ "description": "Ensure all models have proper timestamp tracking", "owner": "backend", "estimated_hours": 4, - "status": "todo", + "status": "completed", "files_involved": [], "implementation_steps": [ { @@ -3056,7 +3056,9 @@ "Unit tests", "Integration tests" ], - "notes": "" + "notes": "", + "completed_at": "2025-12-24T15:08:41.886115", + "implementation_notes": "Added UpdatedAt timestamp to models missing it: TrackLike, TrackHistory, RefreshToken, PlaylistVersion, HLSTranscodeQueue, BitrateAdaptationLog, PlaybackAnalytics. All models now have proper CreatedAt and UpdatedAt timestamps with GORM autoCreateTime and autoUpdateTime tags. DTOs and constants (track_status.go, custom_claims.go, requests.go, responses.go) do not need timestamps as they are not database models." }, { "id": "BE-DB-005", diff --git a/veza-backend-api/internal/models/bitrate_adaptation.go b/veza-backend-api/internal/models/bitrate_adaptation.go index 48dd48798..44e10bfb1 100644 --- a/veza-backend-api/internal/models/bitrate_adaptation.go +++ b/veza-backend-api/internal/models/bitrate_adaptation.go @@ -32,6 +32,7 @@ type BitrateAdaptationLog struct { Reason BitrateAdaptationReason `gorm:"type:varchar(50);not null" json:"reason"` NetworkBandwidth *int `gorm:"type:integer" json:"network_bandwidth,omitempty"` CreatedAt time.Time `gorm:"autoCreateTime;index:idx_bitrate_adaptation_created_at" json:"created_at"` + UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"` } // TableName définit le nom de la table pour GORM diff --git a/veza-backend-api/internal/models/hls_transcode_queue.go b/veza-backend-api/internal/models/hls_transcode_queue.go index f6e9af3df..8cc0a4334 100644 --- a/veza-backend-api/internal/models/hls_transcode_queue.go +++ b/veza-backend-api/internal/models/hls_transcode_queue.go @@ -28,7 +28,8 @@ type HLSTranscodeQueue struct { RetryCount int `gorm:"not null;default:0" json:"retry_count"` MaxRetries int `gorm:"not null;default:3" json:"max_retries"` ErrorMessage *string `gorm:"type:text" json:"error_message,omitempty"` - CreatedAt time.Time `json:"created_at"` + CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"` + UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"` StartedAt *time.Time `json:"started_at,omitempty"` CompletedAt *time.Time `json:"completed_at,omitempty"` } diff --git a/veza-backend-api/internal/models/playback_analytics.go b/veza-backend-api/internal/models/playback_analytics.go index 5f0facc94..978492f4d 100644 --- a/veza-backend-api/internal/models/playback_analytics.go +++ b/veza-backend-api/internal/models/playback_analytics.go @@ -23,6 +23,7 @@ type PlaybackAnalytics struct { StartedAt time.Time `gorm:"not null" json:"started_at"` EndedAt *time.Time `json:"ended_at,omitempty"` CreatedAt time.Time `gorm:"autoCreateTime;index:idx_playback_analytics_created_at" json:"created_at"` + UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"` } // TableName définit le nom de la table pour GORM diff --git a/veza-backend-api/internal/models/playlist_version.go b/veza-backend-api/internal/models/playlist_version.go index 559717bd0..ad6b8397b 100644 --- a/veza-backend-api/internal/models/playlist_version.go +++ b/veza-backend-api/internal/models/playlist_version.go @@ -32,6 +32,7 @@ type PlaylistVersion struct { // Snapshot des tracks au moment de la version (JSON) TracksSnapshot string `gorm:"type:text" json:"tracks_snapshot,omitempty" db:"tracks_snapshot"` CreatedAt time.Time `gorm:"autoCreateTime;index:idx_playlist_versions_created_at" json:"created_at" db:"created_at"` + UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at" db:"updated_at"` // Relations Playlist *Playlist `gorm:"foreignKey:PlaylistID;constraint:OnDelete:CASCADE" json:"playlist,omitempty"` diff --git a/veza-backend-api/internal/models/refresh_token.go b/veza-backend-api/internal/models/refresh_token.go index d0393465d..3fe5b3871 100644 --- a/veza-backend-api/internal/models/refresh_token.go +++ b/veza-backend-api/internal/models/refresh_token.go @@ -15,6 +15,7 @@ type RefreshToken struct { TokenHash string `gorm:"not null;size:255;index:idx_refresh_tokens_token_hash" json:"-"` ExpiresAt time.Time `gorm:"not null" json:"expires_at"` CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"` + UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` // Relations diff --git a/veza-backend-api/internal/models/track_history.go b/veza-backend-api/internal/models/track_history.go index f60c99366..08661fb23 100644 --- a/veza-backend-api/internal/models/track_history.go +++ b/veza-backend-api/internal/models/track_history.go @@ -29,6 +29,7 @@ type TrackHistory struct { OldValue string `gorm:"type:text" json:"old_value,omitempty" db:"old_value"` NewValue string `gorm:"type:text" json:"new_value,omitempty" db:"new_value"` CreatedAt time.Time `gorm:"autoCreateTime;index:idx_track_history_created_at" json:"created_at" db:"created_at"` + UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at" db:"updated_at"` // Relations Track *Track `gorm:"foreignKey:TrackID;constraint:OnDelete:CASCADE" json:"track,omitempty"` diff --git a/veza-backend-api/internal/models/track_like.go b/veza-backend-api/internal/models/track_like.go index d3f197789..62915f5e0 100644 --- a/veza-backend-api/internal/models/track_like.go +++ b/veza-backend-api/internal/models/track_like.go @@ -14,6 +14,7 @@ type TrackLike struct { UserID uuid.UUID `gorm:"type:uuid;not null;index:idx_track_likes_user;uniqueIndex:idx_track_likes_unique" json:"user_id" db:"user_id"` TrackID uuid.UUID `gorm:"type:uuid;not null;index:idx_track_likes_track;uniqueIndex:idx_track_likes_unique" json:"track_id" db:"track_id"` CreatedAt time.Time `gorm:"autoCreateTime;default:CURRENT_TIMESTAMP" json:"created_at" db:"created_at"` + UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at" db:"updated_at"` // Relations User User `gorm:"foreignKey:UserID;constraint:OnDelete:CASCADE" json:"-"`