veza/veza-backend-api/internal/models
senke d03232c85c
Some checks failed
Veza CI / Backend (Go) (push) Failing after 0s
Veza CI / Frontend (Web) (push) Failing after 0s
Veza CI / Rust (Stream Server) (push) Failing after 0s
Security Scan / Secret Scanning (gitleaks) (push) Failing after 0s
Veza CI / Notify on failure (push) Failing after 0s
feat(storage): add track storage_backend column + config prep (v1.0.8 P0)
Phase 0 of the MinIO upload migration (FUNCTIONAL_AUDIT §4 item 2).
Schema + config only — Phase 1 will wire TrackService.UploadTrack()
to actually route writes to S3 when the flag is flipped.

Schema (migration 985):
- tracks.storage_backend VARCHAR(16) NOT NULL DEFAULT 'local'
  CHECK in ('local', 's3')
- tracks.storage_key VARCHAR(512) NULL (S3 object key when backend=s3)
- Partial index on storage_backend = 's3' (migration progress queries)
- Rollback drops both columns + index; safe only while all rows are
  still 'local' (guard query in the rollback comment)

Go model (internal/models/track.go):
- StorageBackend string (default 'local', not null)
- StorageKey *string (nullable)
- Both tagged json:"-" — internal plumbing, never exposed publicly

Config (internal/config/config.go):
- New field Config.TrackStorageBackend
- Read from TRACK_STORAGE_BACKEND env var (default 'local')
- Production validation rule #11 (ValidateForEnvironment):
  - Must be 'local' or 's3' (reject typos like 'S3' or 'minio')
  - If 's3', requires AWS_S3_ENABLED=true (fail fast, do not boot with
    TrackStorageBackend=s3 while S3StorageService is nil)
- Dev/staging warns and falls back to 'local' instead of fail — keeps
  iteration fast while still flagging misconfig.

Docs:
- docs/ENV_VARIABLES.md §13 restructured as "HLS + track storage backend"
  with a migration playbook (local → s3 → migrate-storage CLI)
- docs/ENV_VARIABLES.md §28 validation rules: +2 entries for new rules
- docs/ENV_VARIABLES.md §29 drift findings: TRACK_STORAGE_BACKEND added
  to "missing from template" list before it was fixed
- veza-backend-api/.env.template: TRACK_STORAGE_BACKEND=local with
  comment pointing at Phase 1/2/3 plans

No behavior change yet — TrackService.UploadTrack() still hardcodes the
local path via copyFileAsync(). Phase 1 wires it.

Refs:
- AUDIT_REPORT.md §9 item (deferrals v1.0.8)
- FUNCTIONAL_AUDIT.md §4 item 2 "Stockage local disque only"
- /home/senke/.claude/plans/audit-fonctionnel-wild-hickey.md Item 3

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 19:54:28 +02:00
..
admin.go adding initial backend API (Go) 2025-12-03 20:29:37 +01:00
announcement.go feat(admin): global announcements CRUD and public banner endpoint 2026-02-25 19:55:21 +01:00
api_key.go v0.9.4 2026-03-05 23:03:43 +01:00
bitrate_adaptation.go [BE-DB-004] be-db: Add created_at and updated_at timestamps to all models 2025-12-24 15:08:43 +01:00
bitrate_adaptation_test.go report generation and future tasks selection 2025-12-08 19:57:54 +01:00
chat_message.go style(backend): gofmt -w on 85 files (whitespace only) 2026-04-14 12:22:14 +02:00
cloud_file_share.go v0.9.4 2026-03-05 23:03:43 +01:00
cloud_file_version.go feat(cloud): file versioning, restore, and sharing 2026-02-25 13:33:08 +01:00
co_listening_session.go feat(v0.10.7): Collaboration Temps Réel F481-F483 2026-03-10 13:34:16 +01:00
custom_claims.go STABILISATION: phase 3–5 – API contract, tests & chat-server hardening 2025-12-06 17:21:59 +01:00
daily_track_stats.go feat(v0.11.0): F381-F385 database migrations and models for creator analytics 2026-03-10 16:21:01 +01:00
data_export.go style(backend): gofmt -w on 85 files (whitespace only) 2026-04-14 12:22:14 +02:00
delivered_status.go feat(chat): Sprint 1 -- migrations, models, repositories for chat rewrite 2026-02-22 20:38:20 +01:00
feature_flag.go v0.9.4 2026-03-05 23:03:43 +01:00
federated_identity.go adding initial backend API (Go) 2025-12-03 20:29:37 +01:00
gear.go v0.9.4 2026-03-05 23:03:43 +01:00
gear_document.go feat(v0.802): frontend Cloud/Gear, MSW, docs, scope v0.803, archive 2026-02-25 14:00:58 +01:00
gear_image.go feat(v0.501): Sprint 1 -- infrastructure foundations 2026-02-22 18:10:25 +01:00
gear_repair.go feat(v0.802): frontend Cloud/Gear, MSW, docs, scope v0.803, archive 2026-02-25 14:00:58 +01:00
genre.go feat(v0.10.1): Tags & Genres discover - F351-F355 2026-03-09 01:52:56 +01:00
hardware.go v0.9.4 2026-03-05 23:03:43 +01:00
hls_stream.go v0.9.4 2026-03-05 23:03:43 +01:00
hls_stream_test.go STABILISATION: phase 3–5 – API contract, tests & chat-server hardening 2025-12-06 17:21:59 +01:00
hls_transcode_queue.go v0.9.4 2026-03-05 23:03:43 +01:00
hls_transcode_queue_test.go STABILISATION: phase 3–5 – API contract, tests & chat-server hardening 2025-12-06 17:21:59 +01:00
live_stream.go v0.9.4 2026-03-05 23:03:43 +01:00
message.go feat(chat): Sprint 1 -- migrations, models, repositories for chat rewrite 2026-02-22 20:38:20 +01:00
message_reaction.go feat(chat): Sprint 1 -- migrations, models, repositories for chat rewrite 2026-02-22 20:38:20 +01:00
mfa_config.go adding initial backend API (Go) 2025-12-03 20:29:37 +01:00
notification.go incus deployement fully implemented, Makefile updated and make fmt ran 2026-01-13 19:47:57 +01:00
playback_analytics.go v0.9.4 2026-03-05 23:03:43 +01:00
playback_analytics_test.go adding initial backend API (Go) 2025-12-03 20:29:37 +01:00
playlist.go style(backend): gofmt -w on 85 files (whitespace only) 2026-04-14 12:22:14 +02:00
playlist_collaborator.go STABILISATION: phase 3–5 – API contract, tests & chat-server hardening 2025-12-06 17:21:59 +01:00
playlist_collaborator_test.go adding initial backend API (Go) 2025-12-03 20:29:37 +01:00
playlist_follow.go STABILISATION: phase 3–5 – API contract, tests & chat-server hardening 2025-12-06 17:21:59 +01:00
playlist_share_link.go v0.9.4 2026-03-05 23:03:43 +01:00
playlist_test.go adding initial backend API (Go) 2025-12-03 20:29:37 +01:00
playlist_version.go v0.9.4 2026-03-05 23:03:43 +01:00
queue.go v0.9.4 2026-03-05 23:03:43 +01:00
queue_session.go v0.9.4 2026-03-05 23:03:43 +01:00
read_receipt.go feat(chat): Sprint 1 -- migrations, models, repositories for chat rewrite 2026-02-22 20:38:20 +01:00
recovery_code.go adding initial backend API (Go) 2025-12-03 20:29:37 +01:00
refresh_token.go [BE-DB-004] be-db: Add created_at and updated_at timestamps to all models 2025-12-24 15:08:43 +01:00
report.go feat(admin): moderation queue with reports CRUD 2026-02-25 19:53:04 +01:00
requests.go adding initial backend API (Go) 2025-12-03 20:29:37 +01:00
responses.go [INT-008] int: Standardize date/time formats 2025-12-25 15:16:38 +01:00
role.go [T0-006] test(backend): Ajout tests service role - Progression couverture 2026-01-04 01:44:21 +01:00
role_test.go report generation and future tasks selection 2025-12-08 19:57:54 +01:00
room.go stabilizing veza-backend-api: phase 1 2025-12-16 11:23:49 -05:00
room_invitation.go style(backend): gofmt -w on 85 files (whitespace only) 2026-04-14 12:22:14 +02:00
royalty.go v0.9.4 2026-03-05 23:03:43 +01:00
seller_stripe_account.go style(backend): gofmt -w on 85 files (whitespace only) 2026-04-14 12:22:14 +02:00
session.go stabilizing veza-backend-api: phase 1 2025-12-16 11:23:49 -05:00
storage_quota.go feat(v0.501): Sprint 1 -- infrastructure foundations 2026-02-22 18:10:25 +01:00
tag.go feat(v0.10.1): Tags & Genres discover - F351-F355 2026-03-09 01:52:56 +01:00
track.go feat(storage): add track storage_backend column + config prep (v1.0.8 P0) 2026-04-23 19:54:28 +02:00
track_comment.go STABILISATION: phase 3–5 – API contract, tests & chat-server hardening 2025-12-06 17:21:59 +01:00
track_comment_test.go adding initial backend API (Go) 2025-12-03 20:29:37 +01:00
track_history.go v0.9.4 2026-03-05 23:03:43 +01:00
track_history_test.go adding initial backend API (Go) 2025-12-03 20:29:37 +01:00
track_like.go v0.9.4 2026-03-05 23:03:43 +01:00
track_like_test.go report generation and future tasks selection 2025-12-08 19:57:54 +01:00
track_lyrics.go feat(tracks): add lyrics model and endpoints (E3) 2026-02-20 15:36:28 +01:00
track_play.go v0.9.4 2026-03-05 23:03:43 +01:00
track_play_test.go adding initial backend API (Go) 2025-12-03 20:29:37 +01:00
track_repost.go feat(v0.10.3): Commentaires & Interactions Sociales - F201-F215 2026-03-09 10:30:47 +01:00
track_share.go STABILISATION: phase 3–5 – API contract, tests & chat-server hardening 2025-12-06 17:21:59 +01:00
track_share_test.go adding initial backend API (Go) 2025-12-03 20:29:37 +01:00
track_status.go adding initial backend API (Go) 2025-12-03 20:29:37 +01:00
track_stem.go feat(v0.10.7): Collaboration Temps Réel F481-F483 2026-03-10 13:34:16 +01:00
track_version.go report generation and future tasks selection 2025-12-08 19:57:54 +01:00
track_version_test.go report generation and future tasks selection 2025-12-08 19:57:54 +01:00
user.go feat(backend,web): self-service creator role upgrade via /settings 2026-04-16 18:35:07 +02:00
user_file.go feat(v0.501): Sprint 1 -- infrastructure foundations 2026-02-22 18:10:25 +01:00
user_folder.go feat(v0.501): Sprint 1 -- infrastructure foundations 2026-02-22 18:10:25 +01:00
user_genre_tag_follow.go style(backend): gofmt -w on 85 files (whitespace only) 2026-04-14 12:22:14 +02:00
user_presence.go feat: backend — config, handlers, services, logging, migration 2026-03-23 15:46:57 +01:00
user_settings.go v0.9.4 2026-03-05 23:03:43 +01:00
webauthn_credential.go feat(v0.13.3): complete - Polish Sécurité Avancée 2026-03-13 10:09:01 +01:00
webhook.go incus deployement fully implemented, Makefile updated and make fmt ran 2026-01-13 19:47:57 +01:00