Documentation
¶
Index ¶
- func AddManager(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func AddUserAttendsEvent(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func CreateClub(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func CreateClubEvent(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func CreateTag(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func DeleteClubEvent(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func ExtractToken(r *http.Request) string
- func GenerateCookie(name string, value string) *http.Cookie
- func GenerateJWT(subject string, duration time.Duration, jwtSecret string) (string, error)
- func GetActiveTags(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, _ *http.Request, ...) (int, error)
- func GetAllEvents(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, _ *http.Request, ...) (int, error)
- func GetClub(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func GetClubEvents(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func GetClubManagers(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func GetClubPhoto(db *gorm.DB, _ *redis.Client, w http.ResponseWriter, r *http.Request, ...) (int, error)
- func GetClubPreview(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func GetClubs(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func GetEvent(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func GetTags(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, _ *http.Request, ...) (int, error)
- func GetToggleClub(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func GetToggleUser(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func GetTokenClaims(token string) jwt.MapClaims
- func GetTokenPair(subject string, accessDuration time.Duration, refreshDuration time.Duration) (*model.TokenInfo, error)
- func GetUser(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func GetUserClubsManage(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func GetUserEventsAttend(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func GetUserSwipedClubs(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func Hash(info string) (string, error)
- func IsActiveToken(rc *redis.Client, r *http.Request) bool
- func IsSingleRecordActive(db *gorm.DB, tableName string, column string, val string, t interface{}) bool
- func IsValidJWT(token string, kf jwt.Keyfunc) bool
- func IsValidRequest(username string, r *http.Request) bool
- func KF(secret string) jwt.Keyfunc
- func LeaveClub(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func Login(db *gorm.DB, rc *redis.Client, w http.ResponseWriter, r *http.Request, ...) (int, error)
- func Logout(_ *gorm.DB, rc *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func PromoteOwner(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func RefreshToken(_ *gorm.DB, rc *redis.Client, w http.ResponseWriter, r *http.Request, ...) (int, error)
- func RemoveManager(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func RemoveUserAttendsEvent(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func RequestResetUserPassword(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func ResetUserPassword(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func SignUp(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func SingleRecordExists(db *gorm.DB, tableName string, column string, val string, t interface{}) bool
- func SwipeClub(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func ToggleClub(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func ToggleTag(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func ToggleUser(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func UnSwipeClub(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func UpdateClub(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func UpdateClubEvent(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func UpdateClubTags(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func UpdateUserPassword(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func UpdateUserTags(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func UploadClubPhoto(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func UploadTagsList(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, ...) (int, error)
- func VerifyJWT(r *http.Request) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddManager ¶
func AddManager(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
AddManager - Adding a manager to a club Note: The user adding the manager must be a club owner
func AddUserAttendsEvent ¶
func AddUserAttendsEvent(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
AddUserAttendsEvent - Adding a user attended event
func CreateClub ¶
func CreateClub(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
CreateClub - Creating a club (You must have an active user account first) See model.Club or the docs for club information constraints
func CreateClubEvent ¶
func CreateClubEvent(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
CreateClubEvent - Creating an event for a particular club. The user creating the club must at least be a manager See model.Event or docs for the event constraints
func CreateTag ¶
func CreateTag(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
CreateTag - Create a single tag provided the proper JSON request (See the docs for more info)
func DeleteClubEvent ¶
func DeleteClubEvent(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
DeleteClubEvent - Deleting a club event
func ExtractToken ¶
ExtractToken returns the JWT token if it's provided otherwise, an empty string will be returned
func GenerateCookie ¶
GenerateCookie - Generating http cookie where the refresh token will be embedded.
func GenerateJWT ¶
GenerateJWT - Generating a JWT based on the user's username
func GetActiveTags ¶
func GetActiveTags(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, _ *http.Request, s *status.Status) (int, error)
GetActiveTags - Obtaining all active tags
func GetAllEvents ¶
func GetAllEvents(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, _ *http.Request, s *status.Status) (int, error)
GetAllEvents - Returning all events from all clubs
func GetClub ¶
func GetClub(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
GetClub - Obtaining all information about a club
func GetClubEvents ¶
func GetClubEvents(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
GetClubEvents - Obtaining all events that a club hosts
func GetClubManagers ¶
func GetClubManagers(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
GetClubManagers returns all club managers (not including the club owner)
func GetClubPhoto ¶
func GetClubPhoto(db *gorm.DB, _ *redis.Client, w http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
GetClubPhoto - Obtaining a club profile photo (if it exists)
func GetClubPreview ¶
func GetClubPreview(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
GetClubPreview obtains a preview a non active club
func GetClubs ¶
func GetClubs(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
GetClubs returns all tag filtered non-swiped clubs Note: If all of the tags supplied are invalid or an empty list is given, the tag filter is not applied
func GetEvent ¶
func GetEvent(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
GetEvent - Obtaining an event from a specific club
func GetTags ¶
func GetTags(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, _ *http.Request, s *status.Status) (int, error)
GetTags - Obtaining all tags (both active and inactive)
func GetToggleClub ¶
func GetToggleClub(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
GetToggleClub obtains all clubs that need to be activated (toggled)
func GetToggleUser ¶
func GetToggleUser(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
GetToggleUser obtains all users that need to be activated (toggled)
func GetTokenClaims ¶
func GetTokenClaims(token string) jwt.MapClaims
GetTokenClaims - Extract the Token Claims from the HTTP Request Header
func GetTokenPair ¶
func GetTokenPair(subject string, accessDuration time.Duration, refreshDuration time.Duration) (*model.TokenInfo, error)
GetTokenPair - Obtaining an access and refresh token pair Note: Access tokens have a lifespan of 5 minutes
Refresh tokens have a lifespan of 24 hours (1 day)
func GetUser ¶
func GetUser(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
GetUser - Returns all user info
func GetUserClubsManage ¶
func GetUserClubsManage(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
GetUserClubsManage - Returns all of the Clubs that a User currently manages
func GetUserEventsAttend ¶
func GetUserEventsAttend(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
GetUserEventsAttend - Returns all Events that a User currently attends
func GetUserSwipedClubs ¶
func GetUserSwipedClubs(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
GetUserSwipedClubs obtains all clubs that a user has swiped (i.e. the clubs that a user has favourited)
func IsActiveToken ¶
IsActiveToken returns whether the token is active or not (in the redis cache)
func IsSingleRecordActive ¶
func IsSingleRecordActive(db *gorm.DB, tableName string, column string, val string, t interface{}) bool
IsSingleRecordActive - Returns true if the record is active This is used for verifying users and clubs as they need to be activated upon creation
func IsValidJWT ¶
IsValidJWT - Returning true whether the JWT is valid
func IsValidRequest ¶
IsValidRequest - Validating the user request to ensure that they can only access/modify their own data. True if the requested user has the same username identifier as the token username
func KF ¶
func KF(secret string) jwt.Keyfunc
KF - Key Function to verify the token signing method (Used in conjunction with IsValidJWT)
func LeaveClub ¶
func LeaveClub(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
LeaveClub lets the user step down a club manager (The user won't have any correlations previously managed club) Note: If the user is a club owner, they must appoint a new owner in replacement of them
func Login ¶
func Login(db *gorm.DB, rc *redis.Client, w http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
Login - User Login See model.credentials or docs for username and email constraints
func Logout ¶
func Logout(_ *gorm.DB, rc *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
Logout logs out a user Any access tokens will be revoked and can no longer be used (even if they are still valid)
func PromoteOwner ¶
func PromoteOwner(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
PromoteOwner promotes a club manager to be the new owner while the current owner would step down and become a manager Note: There can only be 1 club owner but you can have many club managers
func RefreshToken ¶
func RefreshToken(_ *gorm.DB, rc *redis.Client, w http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
RefreshToken verifies the refresh token and obtains a new set of access and refresh tokens
func RemoveManager ¶
func RemoveManager(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
RemoveManager - Removing a manager from a club Note: The user removing the manager must be a club owner
func RemoveUserAttendsEvent ¶
func RemoveUserAttendsEvent(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
RemoveUserAttendsEvent - Removing a user attended event
func RequestResetUserPassword ¶
func RequestResetUserPassword(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
RequestResetUserPassword - Requesting a user password reset This will send an email to the user (if the user exists). The email is valid for 10 minutes and can only be used a single time
func ResetUserPassword ¶
func ResetUserPassword(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
ResetUserPassword - Resetting a user's password through a password email reset See model.Credentials or docs for password constraints
func SignUp ¶
func SignUp(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
SignUp will create a user given valid credentials See model.Credentials or docs for username and email constraints
func SingleRecordExists ¶
func SingleRecordExists(db *gorm.DB, tableName string, column string, val string, t interface{}) bool
SingleRecordExists - Returning true if the record already exists in the table, false otherwise.
func SwipeClub ¶
func SwipeClub(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
SwipeClub adds the club to a users favourite club list (i.e. The user is interested in this club)
func ToggleClub ¶
func ToggleClub(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
ToggleClub - Toggling clubs as active or inactive
func ToggleTag ¶
func ToggleTag(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
ToggleTag - Toggling tags as either active or inactive
func ToggleUser ¶
func ToggleUser(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
ToggleUser - Toggling users as active or inactive
func UnSwipeClub ¶
func UnSwipeClub(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
UnSwipeClub removes the club from the users favourite club list
func UpdateClub ¶
func UpdateClub(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
UpdateClub - Update club with new information See model.Club or docs for club attribute specifications
func UpdateClubEvent ¶
func UpdateClubEvent(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
UpdateClubEvent - Updating an event for a particular club
func UpdateClubTags ¶
func UpdateClubTags(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
UpdateClubTags - Updating user club tags All old tags will be overrided with the new set of tags provided
func UpdateUserPassword ¶
func UpdateUserPassword(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
UpdateUserPassword - Updating a user's password by providing the correct original password and the password See model.Credentials or docs for password constraints
func UpdateUserTags ¶
func UpdateUserTags(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
UpdateUserTags - Updating the users choice of tags and attended events. Only valid tags will be extracted and added if it's not already. If an invalid format is provided where there aren't any valid tags to be extracted, the users tag preferences will be reset
func UploadClubPhoto ¶
func UploadClubPhoto(db *gorm.DB, _ *redis.Client, _ http.ResponseWriter, r *http.Request, s *status.Status) (int, error)
UploadClubPhoto - Uploading a club photo Club photo file size upload is 10 MB max
Types ¶
This section is empty.