Documentation ¶
Index ¶
- Constants
- Variables
- func ChangeAclOnPlaylist(user uint, userToPromote uint, playlistId uint, role uint) map[string]interface{}
- func DownVoteSong(songid uint, user uint, ...) map[string]interface{}
- func GetDB() *gorm.DB
- func Login(email, password string) map[string]interface{}
- func RefreshSongVotes(userId uint, songid uint, ...)
- func UpVoteSong(songid uint, user uint, ...) map[string]interface{}
- func UpdatePassword(user uint, password string) map[string]interface{}
- type Account
- func (account *Account) Create() map[string]interface{}
- func (account *Account) DeleteAccount(user uint) map[string]interface{}
- func (account *Account) UpdateAccount() map[string]interface{}
- func (account *Account) Validate() (map[string]interface{}, bool)
- func (account *Account) ValidatePassword() (map[string]interface{}, bool)
- type AccountPlaylist
- type Model
- type Playlist
- func (playlist *Playlist) Create(user uint) map[string]interface{}
- func (playlist *Playlist) DeletePlaylist(user uint, playlistId uint, ...) map[string]interface{}
- func (playlist *Playlist) Join(user uint, playlistId uint) map[string]interface{}
- func (playlist *Playlist) LeavePlaylist(user uint, playlistId uint) map[string]interface{}
- func (playlist *Playlist) UpdatePlaylist(user uint, playlistId uint, newPlaylist *Playlist) map[string]interface{}
- func (playlist *Playlist) Validate() (map[string]interface{}, bool)
- type PlaylistAccessControl
- type PlaylistFilter
- type PlaylistOwned
- type Ranking
- type Role
- type Song
- func (song *Song) Create(user uint, notifyOnUpdate func(userId uint, playlistId uint, message string), ...) map[string]interface{}
- func (song *Song) DeleteSong(user uint, songId uint, ...) map[string]interface{}
- func (song *Song) UpdateSong(user uint, songId uint, newSong *Song, ...) map[string]interface{}
- func (song *Song) Validate(user uint) (map[string]interface{}, bool)
- type SongExtended
- type Table
- type Token
- type Vote
Constants ¶
View Source
const ROLE_ADMIN = 1
const ROLE_DEV =
View Source
const ROLE_BYMER = 2
View Source
const ROLE_FOLLOWER = 3
View Source
const ROLE_VISITOR = 4
Variables ¶
View Source
var RoleName = [5]string{
"Author",
"Admin",
"Bymer",
"Follower",
"Visitor",
}
Functions ¶
func ChangeAclOnPlaylist ¶
func ChangeAclOnPlaylist(user uint, userToPromote uint, playlistId uint, role uint) map[string]interface{}
TODO(Cas où l'utilisateur dont l'acl est changé n'appartient pas à la playlist ????) TODO(Cas où le front ne peut envoyer qu'un email et pas un id) TODO(Roles sont rentré à la main dans la db, dans l'ordre croissant d'authorité (1 > 4)) TODO(Le front peut-il directement utilisé ces 'valeurs' d'autorité en dure, sans avoir besoin de les fetch dans la db ?)
func DownVoteSong ¶
func RefreshSongVotes ¶
func UpVoteSong ¶
func UpdatePassword ¶
Types ¶
type Account ¶
type Account struct { Model Email string `json:"email",gorm:"type:text;unique;not null"` Password string `json:"password"` TokenVersion uint `json:"token_version"` Picture string `json:"picture"` Playlists []Playlist `gorm:"ForeignKey:UserId"` FollowedPlaylists []*Playlist `gorm:"many2many:account_playlist"` Acl []PlaylistAccessControl `gorm:"ForeignKey:UserId"` }
a struct to rep user account
func (*Account) DeleteAccount ¶
func (*Account) UpdateAccount ¶
func (*Account) ValidatePassword ¶
type AccountPlaylist ¶
type AccountPlaylist struct { AccountId uint `json:"account_id"` PlaylistId uint `json:"playlist_id"` }
func GetFollowers ¶
func GetFollowers(playlistId uint) []*AccountPlaylist
type Playlist ¶
type Playlist struct { Model Name string `json:"name"` UserId uint `json:"user_id"` SongsNumber int `json:"songs_number"` Songs []Song `gorm:"ForeignKey:PlaylistId"` Follower []*Account `gorm:"many2many:account_playlist;"` FollowerCount int `json:"follower_count"` Acl []PlaylistAccessControl `gorm:"ForeignKey:PlaylistId"` }
func GetPlaylistById ¶
func GetPlaylistById(u uint, filter *PlaylistFilter) *Playlist
func GetPlaylistFromSong ¶
func (*Playlist) DeletePlaylist ¶
func (*Playlist) Join ¶
TODO(variable POST optionel pour choisir le ROLE de l'user (BYMER ou FOllOWER), BYMER by default)
func (*Playlist) LeavePlaylist ¶
func (*Playlist) UpdatePlaylist ¶
type PlaylistAccessControl ¶
type PlaylistFilter ¶
type PlaylistOwned ¶
func GetPlaylistsByUser ¶
func GetPlaylistsByUser(user uint) []*PlaylistOwned
type Ranking ¶
type Ranking struct { SongId uint `json:"song_id"` VoteUp int `json:"vote_up"` VoteDown int `json:"vote_down"` Score int `json:"score"` }
Not a model used to hold part of the song model
func GetSongRankingById ¶
func GetSongsRanking ¶
type Role ¶
type Role struct { ID uint `gorm:"primary_key"` Name string `json:"name"` Acl []PlaylistAccessControl `gorm:"ForeignKey:RoleId"` }
type Song ¶
type Song struct { Model Name string `json:"name"` PlaylistId uint `json:"playlist_id"` ExternalId string `json:"external_id"` VoteUp int `json:"vote_up"` VoteDown int `json:"vote_down"` Score int `json:"score"` Status string `json:"status"` }
func (*Song) DeleteSong ¶
func (*Song) UpdateSong ¶
type SongExtended ¶
func GetSongs ¶
func GetSongs(playlist uint, userId uint) []*SongExtended
Click to show internal directories.
Click to hide internal directories.