repositories

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2026 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

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

func (r *Repo) AcceptFriendRequest(requestID uuid.UUID) error

AcceptFriendRequest accepts a friend request and creates bidirectional friendship

func (*Repo) AddFriend

func (r *Repo) AddFriend(userID, friendID uuid.UUID) error

func (*Repo) CancelFriendRequest

func (r *Repo) CancelFriendRequest(requestID uuid.UUID) error

CancelFriendRequest cancels a sent friend request

func (*Repo) Connect

func (r *Repo) Connect(db *gorm.DB)

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) CreateComment

func (r *Repo) CreateComment(comment *models.Comment) error

func (*Repo) CreateGenre

func (r *Repo) CreateGenre(genre *models.Genre) error

Create inserts a new genre.

func (*Repo) CreateProject

func (r *Repo) CreateProject(project *models.Project) error

func (*Repo) CreateTrack

func (r *Repo) CreateTrack(track *models.Track) error

Create saves a new track. Note: Ensure the 'OwnerID' and 'GenreID' are set in the track object.

func (*Repo) CreateUpload

func (r *Repo) CreateUpload(track *models.Upload) error

Create saves a new track. Note: Ensure the 'OwnerID' and 'GenreID' are set in the track object.

func (*Repo) CreateUser

func (r *Repo) CreateUser(user *models.User, password string) error

func (*Repo) Delete

func (r *Repo) Delete(id uuid.UUID) (*models.Rating, error)

func (*Repo) DeleteComment

func (r *Repo) DeleteComment(id string) error

func (*Repo) DeleteGenre

func (r *Repo) DeleteGenre(id string) error

func (*Repo) DeleteProject

func (r *Repo) DeleteProject(id string) error

func (*Repo) DeleteTrack

func (r *Repo) DeleteTrack(id string) error

Delete removes a track.

func (*Repo) DeleteUpload

func (r *Repo) DeleteUpload(objKey string) error

Delete removes a track.

func (*Repo) DeleteUser

func (r *Repo) DeleteUser(id string) error

NOTE: We cannnot just cascade cause we are softdeleting everyting

func (*Repo) DeleteUserByUsername

func (r *Repo) DeleteUserByUsername(username string) error

NOTE: We cannnot just cascade cause we are softdeleting everyting

func (*Repo) Find42UserByUsername

func (r *Repo) Find42UserByUsername(username string, preloads []string) (*models.User, error)

func (*Repo) FindUser

func (r *Repo) FindUser(e string, u string) (*models.User, error)

func (*Repo) FindUserByEmail

func (r *Repo) FindUserByEmail(email string) (*models.User, error)

func (*Repo) FindUserByUsername

func (r *Repo) FindUserByUsername(username string, preloads []string) (*models.User, error)

func (*Repo) GetAllGenres

func (r *Repo) GetAllGenres(genres *[]models.Genre, preloads []string) error

GetAll retrieves every single genre in a flat list (useful for search/autocomplete).

func (*Repo) GetAllTracks

func (r *Repo) GetAllTracks(limit int, page int, search string, genreID string, sortBy string, order string, preloads []string, visibility string, userID uuid.UUID) ([]models.Track, error)

func (*Repo) GetAllUploads

func (r *Repo) GetAllUploads() ([]models.Upload, error)

func (*Repo) GetAllUsers

func (r *Repo) GetAllUsers(users *[]models.User, preloads []string) error

func (*Repo) GetByID

func (r *Repo) GetByID(id string, preloads []string) (*models.Rating, error)

func (*Repo) GetByTrackID

func (r *Repo) GetByTrackID(trackID string, preloads []string) ([]models.Rating, error)

func (*Repo) GetCommentByID

func (r *Repo) GetCommentByID(id string, preloads []string) (*models.Comment, error)

func (*Repo) GetCommentsByTrack

func (r *Repo) GetCommentsByTrack(trackID string, preloads []string) ([]models.Comment, error)

func (*Repo) GetExistingRating

func (r *Repo) GetExistingRating(authorID, trackID uuid.UUID) (*models.Rating, error)

func (*Repo) GetFriendRequestByID

func (r *Repo) GetFriendRequestByID(requestID uuid.UUID) (*models.FriendRequest, error)

GetRequestByID retrieves a friend request by ID

func (*Repo) GetFriends

func (r *Repo) GetFriends(userID uuid.UUID) ([]*models.User, error)

func (*Repo) GetGenreByID

func (r *Repo) GetGenreByID(id string, preloads []string) (*models.Genre, error)

func (*Repo) GetGenreRoots

func (r *Repo) GetGenreRoots(genres *[]models.Genre, preloads []string) error

func (*Repo) GetPendingRequestWith

func (r *Repo) GetPendingRequestWith(userID uuid.UUID, withID uuid.UUID) (*models.FriendRequest, error)

func (*Repo) GetPendingRequests

func (r *Repo) GetPendingRequests(userID uuid.UUID) ([]*models.FriendRequest, error)

GetPendingRequests retrieves pending friend requests for a user

func (*Repo) GetProjectByID

func (r *Repo) GetProjectByID(id string, preloads []string) (*models.Project, error)

GetProjectByID fetches a specific project save

func (*Repo) GetProjectsByOwnerID

func (r *Repo) GetProjectsByOwnerID(ownerID string, preloads []string) ([]models.Project, error)

GetProjectsByOwnerID fetches only the ROOT projects for a user's dashboard

func (*Repo) GetTrackByID

func (r *Repo) GetTrackByID(id string, preloads []string, userID uuid.UUID) (*models.Track, error)

GetByID fetches a specific track with full details (Comments).

func (*Repo) GetTrackStats

func (r *Repo) GetTrackStats(trackID uuid.UUID) (float64, int, error)

func (*Repo) GetTracksByGenre

func (r *Repo) GetTracksByGenre(limit int, page int, preloads []string, genreID string) ([]models.Track, error)

func (*Repo) GetTracksByOwnerID

func (r *Repo) GetTracksByOwnerID(ownerID string, preloads []string) ([]models.Track, error)

GetByOwnerID fetches all tracks uploaded by a specific user.

func (*Repo) GetUploadByObjectKey

func (r *Repo) GetUploadByObjectKey(objectKey string) (*models.Upload, error)

GetByID fetches a specific track with full details (Comments).

func (*Repo) GetUploadByOwnerID

func (r *Repo) GetUploadByOwnerID(ownerID string) ([]models.Upload, error)

GetByOwnerID fetches all tracks uploaded by a specific user.

func (*Repo) GetUserByID

func (r *Repo) GetUserByID(id uuid.UUID, preloads []string) (*models.User, error)

func (*Repo) IsFriend

func (r *Repo) IsFriend(userID, friendID uuid.UUID) (bool, error)

func (*Repo) IsOwned

func (r *Repo) IsOwned(audioFile string, userID uuid.UUID) bool

func (*Repo) RejectFriendRequest

func (r *Repo) RejectFriendRequest(requestID uuid.UUID) error

RejectFriendRequest rejects a friend request

func (*Repo) RemoveFriend

func (r *Repo) RemoveFriend(userID, friendID uuid.UUID) error

func (*Repo) RunInTx

func (r *Repo) RunInTx(fn func(txRepo *Repo) error) error

It creates a temporary clone of RatingRepo that uses the transaction DB.

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

func (r *Repo) SendFriendRequest(senderID, receiverID uuid.UUID) error

SendFriendRequest sends a friend request

func (*Repo) UpdateComment

func (r *Repo) UpdateComment(comment *models.Comment) error

func (*Repo) UpdateGenre

func (r *Repo) UpdateGenre(genre *models.Genre) error

func (*Repo) UpdateLastActivity

func (r *Repo) UpdateLastActivity(id uuid.UUID, ts time.Time) error

func (*Repo) UpdatePassword

func (r *Repo) UpdatePassword(userID uuid.UUID, newHashedPassword string) error

func (*Repo) UpdateProject

func (r *Repo) UpdateProject(project *models.Project) error

UpdateProject saves the current state

func (*Repo) UpdateTrack

func (r *Repo) UpdateTrack(track *models.Track) error

Update modifies track details.

func (*Repo) UpdateTrackStats

func (r *Repo) UpdateTrackStats(trackID uuid.UUID, newAvg float64, newCount int) error

func (*Repo) UpdateUpload

func (r *Repo) UpdateUpload(trackUpload *models.Upload) error

Update modifies track details.

func (*Repo) UpdateUser

func (r *Repo) UpdateUser(user *models.User) error

func (*Repo) Upsert

func (r *Repo) Upsert(rating *models.Rating) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL