veza/veza-backend-api/internal/models/track_repost.go
senke 6111ae6136
Some checks failed
Backend API CI / test-unit (push) Failing after 0s
Backend API CI / test-integration (push) Failing after 0s
Frontend CI / test (push) Failing after 0s
Storybook Audit / Build & audit Storybook (push) Failing after 0s
feat(v0.10.3): Commentaires & Interactions Sociales - F201-F215
- F201: Commentaires avec timestamp cliquable, modération mots-clés
- F202: Likes privés (compteur visible créateur uniquement)
- F203: Reposts de tracks sur le profil, bouton Repost, onglet Reposts
- F204: Notifications (commentaire, repost), pas de gamification

Backend: migrations 127/128, comment_moderation_service, track_repost_service,
  GetTrackLikes/GetTrack masquent like_count pour non-créateurs
Frontend: LikeButton isCreator, RepostButton, Reposts tab profil, timestamp seek
2026-03-09 10:30:47 +01:00

32 lines
999 B
Go

package models
import (
"time"
"github.com/google/uuid"
"gorm.io/gorm"
)
// TrackRepost represents a user reposting a track to their profile (v0.10.3 F203).
type TrackRepost struct {
ID uuid.UUID `gorm:"type:uuid;primaryKey;default:gen_random_uuid()" json:"id"`
UserID uuid.UUID `gorm:"type:uuid;not null;index:idx_track_reposts_user_id" json:"user_id"`
TrackID uuid.UUID `gorm:"type:uuid;not null;index:idx_track_reposts_track_id" json:"track_id"`
CreatedAt time.Time `gorm:"autoCreateTime;index:idx_track_reposts_created_at" json:"created_at"`
User User `gorm:"foreignKey:UserID;constraint:OnDelete:CASCADE" json:"-"`
Track Track `gorm:"foreignKey:TrackID;constraint:OnDelete:CASCADE" json:"-"`
}
// TableName returns the table name for GORM.
func (TrackRepost) TableName() string {
return "track_reposts"
}
// BeforeCreate generates UUID if not set.
func (m *TrackRepost) BeforeCreate(tx *gorm.DB) error {
if m.ID == uuid.Nil {
m.ID = uuid.New()
}
return nil
}