Documentation
¶
Index ¶
- type Repo
- func (r *Repo) AcceptFriendRequest(requestID uuid.UUID) error
- func (r *Repo) AddFriend(userID, friendID uuid.UUID) error
- func (r *Repo) CancelFriendRequest(requestID uuid.UUID) error
- func (r *Repo) Connect(db *gorm.DB)
- func (r *Repo) CountTracks(search string, genreID string, visibility string, userID uuid.UUID) (int64, error)
- func (r *Repo) CreateComment(comment *models.Comment) error
- func (r *Repo) CreateGenre(genre *models.Genre) error
- func (r *Repo) CreateProject(project *models.Project) error
- func (r *Repo) CreateTrack(track *models.Track) error
- func (r *Repo) CreateUpload(track *models.Upload) error
- func (r *Repo) CreateUser(user *models.User, password string) error
- func (r *Repo) Delete(id uuid.UUID) (*models.Rating, error)
- func (r *Repo) DeleteComment(id string) error
- func (r *Repo) DeleteGenre(id string) error
- func (r *Repo) DeleteProject(id string) error
- func (r *Repo) DeleteTrack(id string) error
- func (r *Repo) DeleteUpload(objKey string) error
- func (r *Repo) DeleteUser(id string) error
- func (r *Repo) DeleteUserByUsername(username string) error
- func (r *Repo) Find42UserByUsername(username string, preloads []string) (*models.User, error)
- func (r *Repo) FindUser(e string, u string) (*models.User, error)
- func (r *Repo) FindUserByEmail(email string) (*models.User, error)
- func (r *Repo) FindUserByUsername(username string, preloads []string) (*models.User, error)
- func (r *Repo) GetAllGenres(genres *[]models.Genre, preloads []string) error
- func (r *Repo) GetAllTracks(limit int, page int, search string, genreID string, sortBy string, ...) ([]models.Track, error)
- func (r *Repo) GetAllUploads() ([]models.Upload, error)
- func (r *Repo) GetAllUsers(users *[]models.User, preloads []string) error
- func (r *Repo) GetByID(id string, preloads []string) (*models.Rating, error)
- func (r *Repo) GetByTrackID(trackID string, preloads []string) ([]models.Rating, error)
- func (r *Repo) GetCommentByID(id string, preloads []string) (*models.Comment, error)
- func (r *Repo) GetCommentsByTrack(trackID string, preloads []string) ([]models.Comment, error)
- func (r *Repo) GetExistingRating(authorID, trackID uuid.UUID) (*models.Rating, error)
- func (r *Repo) GetFriendRequestByID(requestID uuid.UUID) (*models.FriendRequest, error)
- func (r *Repo) GetFriends(userID uuid.UUID) ([]*models.User, error)
- func (r *Repo) GetGenreByID(id string, preloads []string) (*models.Genre, error)
- func (r *Repo) GetGenreRoots(genres *[]models.Genre, preloads []string) error
- func (r *Repo) GetPendingRequestWith(userID uuid.UUID, withID uuid.UUID) (*models.FriendRequest, error)
- func (r *Repo) GetPendingRequests(userID uuid.UUID) ([]*models.FriendRequest, error)
- func (r *Repo) GetProjectByID(id string, preloads []string) (*models.Project, error)
- func (r *Repo) GetProjectsByOwnerID(ownerID string, preloads []string) ([]models.Project, error)
- func (r *Repo) GetTrackByID(id string, preloads []string, userID uuid.UUID) (*models.Track, error)
- func (r *Repo) GetTrackStats(trackID uuid.UUID) (float64, int, error)
- func (r *Repo) GetTracksByGenre(limit int, page int, preloads []string, genreID string) ([]models.Track, error)
- func (r *Repo) GetTracksByOwnerID(ownerID string, preloads []string) ([]models.Track, error)
- func (r *Repo) GetUploadByObjectKey(objectKey string) (*models.Upload, error)
- func (r *Repo) GetUploadByOwnerID(ownerID string) ([]models.Upload, error)
- func (r *Repo) GetUserByID(id uuid.UUID, preloads []string) (*models.User, error)
- func (r *Repo) IsFriend(userID, friendID uuid.UUID) (bool, error)
- func (r *Repo) IsOwned(audioFile string, userID uuid.UUID) bool
- func (r *Repo) RejectFriendRequest(requestID uuid.UUID) error
- func (r *Repo) RemoveFriend(userID, friendID uuid.UUID) error
- func (r *Repo) RunInTx(fn func(txRepo *Repo) error) error
- func (r *Repo) SearchProjectsByName(ownerID string, searchQuery string, preloads []string) ([]models.Project, error)
- func (r *Repo) SendFriendRequest(senderID, receiverID uuid.UUID) error
- func (r *Repo) UpdateComment(comment *models.Comment) error
- func (r *Repo) UpdateGenre(genre *models.Genre) error
- func (r *Repo) UpdateLastActivity(id uuid.UUID, ts time.Time) error
- func (r *Repo) UpdatePassword(userID uuid.UUID, newHashedPassword string) error
- func (r *Repo) UpdateProject(project *models.Project) error
- func (r *Repo) UpdateTrack(track *models.Track) error
- func (r *Repo) UpdateTrackStats(trackID uuid.UUID, newAvg float64, newCount int) error
- func (r *Repo) UpdateUpload(trackUpload *models.Upload) error
- func (r *Repo) UpdateUser(user *models.User) error
- func (r *Repo) Upsert(rating *models.Rating) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
func (*Repo) AcceptFriendRequest ¶
AcceptFriendRequest accepts a friend request and creates bidirectional friendship
func (*Repo) CancelFriendRequest ¶
CancelFriendRequest cancels a sent friend request
func (*Repo) CountTracks ¶
func (r *Repo) CountTracks(search string, genreID string, visibility string, userID uuid.UUID) (int64, error)
CountTracks returns the total number of tracks matching the search criteria.
func (*Repo) CreateGenre ¶
Create inserts a new genre.
func (*Repo) CreateTrack ¶
Create saves a new track. Note: Ensure the 'OwnerID' and 'GenreID' are set in the track object.
func (*Repo) CreateUpload ¶
Create saves a new track. Note: Ensure the 'OwnerID' and 'GenreID' are set in the track object.
func (*Repo) DeleteComment ¶
func (*Repo) DeleteGenre ¶
func (*Repo) DeleteProject ¶
func (*Repo) DeleteUpload ¶
Delete removes a track.
func (*Repo) DeleteUser ¶
NOTE: We cannnot just cascade cause we are softdeleting everyting
func (*Repo) DeleteUserByUsername ¶
NOTE: We cannnot just cascade cause we are softdeleting everyting
func (*Repo) Find42UserByUsername ¶
func (*Repo) FindUserByUsername ¶
func (*Repo) GetAllGenres ¶
GetAll retrieves every single genre in a flat list (useful for search/autocomplete).
func (*Repo) GetAllTracks ¶
func (*Repo) GetAllUsers ¶
func (*Repo) GetByTrackID ¶
func (*Repo) GetCommentByID ¶
func (*Repo) GetCommentsByTrack ¶
func (*Repo) GetExistingRating ¶
func (*Repo) GetFriendRequestByID ¶
GetRequestByID retrieves a friend request by ID
func (*Repo) GetGenreByID ¶
func (*Repo) GetGenreRoots ¶
func (*Repo) GetPendingRequestWith ¶
func (*Repo) GetPendingRequests ¶
GetPendingRequests retrieves pending friend requests for a user
func (*Repo) GetProjectByID ¶
GetProjectByID fetches a specific project save
func (*Repo) GetProjectsByOwnerID ¶
GetProjectsByOwnerID fetches only the ROOT projects for a user's dashboard
func (*Repo) GetTrackByID ¶
GetByID fetches a specific track with full details (Comments).
func (*Repo) GetTracksByGenre ¶
func (*Repo) GetTracksByOwnerID ¶
GetByOwnerID fetches all tracks uploaded by a specific user.
func (*Repo) GetUploadByObjectKey ¶
GetByID fetches a specific track with full details (Comments).
func (*Repo) GetUploadByOwnerID ¶
GetByOwnerID fetches all tracks uploaded by a specific user.
func (*Repo) GetUserByID ¶
func (*Repo) RejectFriendRequest ¶
RejectFriendRequest rejects a friend request
func (*Repo) SearchProjectsByName ¶
func (r *Repo) SearchProjectsByName(ownerID string, searchQuery string, preloads []string) ([]models.Project, error)
SearchProjectsByName allows searching the user's projects
func (*Repo) SendFriendRequest ¶
SendFriendRequest sends a friend request
func (*Repo) UpdateLastActivity ¶
func (*Repo) UpdatePassword ¶
func (*Repo) UpdateProject ¶
UpdateProject saves the current state
func (*Repo) UpdateTrack ¶
Update modifies track details.
func (*Repo) UpdateTrackStats ¶
func (*Repo) UpdateUpload ¶
Update modifies track details.