Documentation ¶
Index ¶
- func AddAssociationController(w http.ResponseWriter, r *http.Request)
- func AddAssociationUser(user AssociationUser)
- func AddAttendeeController(w http.ResponseWriter, r *http.Request)
- func AddAttendeeToGoingList(id bson.ObjectId, userID bson.ObjectId) (Event, User)
- func AddAttendeeToMaybeList(id bson.ObjectId, userID bson.ObjectId) (Event, User)
- func AddAttendeeToNotGoingList(id bson.ObjectId, userID bson.ObjectId) (Event, User)
- func AddEventController(w http.ResponseWriter, r *http.Request)
- func AddPostController(w http.ResponseWriter, r *http.Request)
- func AddUserController(w http.ResponseWriter, r *http.Request)
- func ArchiveImage(fileName string) error
- func AuthMiddleware(next http.HandlerFunc, role string) http.HandlerFunc
- func ChangeAttendeeStatusController(w http.ResponseWriter, r *http.Request)
- func CheckAndRefreshStringTokens(authStringToken string, refreshStringToken string, role string) (*jwt.Token, *jwt.Token, error)
- func CommentEventController(w http.ResponseWriter, r *http.Request)
- func CommentPostController(w http.ResponseWriter, r *http.Request)
- func ContainsString(slice []string, element string) bool
- func CreateNewTokens(ID bson.ObjectId, role string) (*jwt.Token, *jwt.Token)
- func CreateOrUpdateNotificationUser(user NotificationUser)
- func Credit(w http.ResponseWriter, r *http.Request)
- func DeleteAssociationController(w http.ResponseWriter, r *http.Request)
- func DeleteCommentsForUser(userID bson.ObjectId)
- func DeleteCommentsForUserOnEvents(userID bson.ObjectId)
- func DeleteEventController(w http.ResponseWriter, r *http.Request)
- func DeleteImage(fileName string) error
- func DeleteNotificationController(w http.ResponseWriter, r *http.Request)
- func DeleteNotificationTokenForUser(id bson.ObjectId)
- func DeleteNotificationsForComment(id bson.ObjectId)
- func DeleteNotificationsForEvent(id bson.ObjectId)
- func DeleteNotificationsForPost(id bson.ObjectId)
- func DeleteNotificationsForUser(id bson.ObjectId)
- func DeletePostController(w http.ResponseWriter, r *http.Request)
- func DeleteTagsForUser(userID bson.ObjectId)
- func DeleteTagsForUserOnEvents(userID bson.ObjectId)
- func DeleteTokenCookies(w *http.ResponseWriter, r *http.Request)
- func DeleteUserController(w http.ResponseWriter, r *http.Request)
- func DislikePostController(w http.ResponseWriter, r *http.Request)
- func DislikePostWithUser(id bson.ObjectId, userID bson.ObjectId) (Post, User)
- func GeneratePassword() string
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(s int) (string, error)
- func GetAllAssociationsController(w http.ResponseWriter, r *http.Request)
- func GetAllPostsController(w http.ResponseWriter, r *http.Request)
- func GetAllUserController(w http.ResponseWriter, r *http.Request)
- func GetAssociationController(w http.ResponseWriter, r *http.Request)
- func GetAssociationUserController(w http.ResponseWriter, r *http.Request)
- func GetEventController(w http.ResponseWriter, r *http.Request)
- func GetEventsForAssociationController(w http.ResponseWriter, r *http.Request)
- func GetFutureEventsController(w http.ResponseWriter, r *http.Request)
- func GetImageColors(fileName string) [][]int
- func GetImageDimension(fileName string) (int, int)
- func GetImagesNames() ([]string, error)
- func GetMD5Hash(text string) string
- func GetMongoSession() *mgo.Session
- func GetMyAssociationController(w http.ResponseWriter, r *http.Request)
- func GetMyAssociations(id bson.ObjectId) []bson.ObjectId
- func GetNotificationController(w http.ResponseWriter, r *http.Request)
- func GetPostController(w http.ResponseWriter, r *http.Request)
- func GetPostsForAssociationController(w http.ResponseWriter, r *http.Request)
- func GetUserController(w http.ResponseWriter, r *http.Request)
- func GetUserFromRequest(r *http.Request) (bson.ObjectId, error)
- func HowToPost(w http.ResponseWriter, r *http.Request)
- func Index(w http.ResponseWriter, r *http.Request)
- func InitJWT() error
- func Legal(w http.ResponseWriter, r *http.Request)
- func LikePostController(w http.ResponseWriter, r *http.Request)
- func LikePostWithUser(id bson.ObjectId, userID bson.ObjectId) (Post, User)
- func LoginAssociationController(w http.ResponseWriter, r *http.Request)
- func LoginUserController(w http.ResponseWriter, r *http.Request)
- func LogoutAssociationController(w http.ResponseWriter, r *http.Request)
- func LogoutUserController(w http.ResponseWriter, r *http.Request)
- func NewRouter() *mux.Router
- func RandomString(strlen int) string
- func RemoveAttendee(id bson.ObjectId, userID bson.ObjectId, list string) (Event, User)
- func RemoveAttendeeController(w http.ResponseWriter, r *http.Request)
- func ReportComment(id bson.ObjectId, commentID bson.ObjectId, reporterID bson.ObjectId)
- func ReportCommentController(w http.ResponseWriter, r *http.Request)
- func ReportUser(id bson.ObjectId, reporterID bson.ObjectId)
- func ReportUserController(w http.ResponseWriter, r *http.Request)
- func ResizeImage(imageName string, newWidth uint, newHeight uint) (string, error)
- func ResponseHandler(w *http.ResponseWriter, fileName string, err error)
- func RevokeRefreshStringToken(refreshStringToken string) error
- func SearchAssociationController(w http.ResponseWriter, r *http.Request)
- func SearchEventController(w http.ResponseWriter, r *http.Request)
- func SearchPostController(w http.ResponseWriter, r *http.Request)
- func SearchUniversalController(w http.ResponseWriter, r *http.Request)
- func SearchUserController(w http.ResponseWriter, r *http.Request)
- func SendAssociationEmailForCommentOnEvent(email string, event Event, comment Comment, user User) error
- func SendAssociationEmailForCommentOnPost(email string, post Post, comment Comment, user User) error
- func SendAssociationEmailSubscription(email string, password string) error
- func SendEmail(to string, subject string, body string)
- func TriggerNotificationForEvent(event Event, sender bson.ObjectId, content bson.ObjectId, message string)
- func TriggerNotificationForPost(post Post, sender bson.ObjectId, content bson.ObjectId, message string)
- func TriggerNotificationForUserFromEvent(sender bson.ObjectId, receiver bson.ObjectId, content bson.ObjectId, ...)
- func TriggerNotificationForUserFromPost(sender bson.ObjectId, receiver bson.ObjectId, content bson.ObjectId, ...)
- func UncommentEventController(w http.ResponseWriter, r *http.Request)
- func UncommentPostController(w http.ResponseWriter, r *http.Request)
- func UpdateAssociationController(w http.ResponseWriter, r *http.Request)
- func UpdateEventController(w http.ResponseWriter, r *http.Request)
- func UpdateNotificationUserController(w http.ResponseWriter, r *http.Request)
- func UpdatePostController(w http.ResponseWriter, r *http.Request)
- func UpdateUserController(w http.ResponseWriter, r *http.Request)
- func UploadImage(r *http.Request) (string, error)
- func UploadImageController(w http.ResponseWriter, r *http.Request)
- func UploadImageWithName(r *http.Request, name string) (string, error)
- func UploadNewImageController(w http.ResponseWriter, r *http.Request)
- func VerifyEmail(email string) bool
- type Association
- func AddAssociation(association Association) Association
- func AddEventToAssociation(id bson.ObjectId, event bson.ObjectId) Association
- func AddPostToAssociation(id bson.ObjectId, post bson.ObjectId) Association
- func DeleteAssociation(id bson.ObjectId) Association
- func GetAssociation(id bson.ObjectId) Association
- func GetAssociationFromEmail(email string) Association
- func RemoveEventFromAssociation(id bson.ObjectId, event bson.ObjectId) Association
- func RemovePostFromAssociation(id bson.ObjectId, post bson.ObjectId) Association
- func UpdateAssociation(id bson.ObjectId, association Association) Association
- type AssociationLogin
- type AssociationUser
- type Associations
- type Comment
- type Comments
- type Config
- type Event
- type Events
- type Middleware
- type Notification
- type NotificationUser
- type Notifications
- type Post
- type Posts
- type Route
- type Routes
- type Search
- type Tag
- type Tags
- type TokenClaims
- type TokenJTI
- type User
- func AddEventToUser(id bson.ObjectId, eventID bson.ObjectId) User
- func AddUser(user *User) User
- func DeleteUser(user User) User
- func DislikePost(id bson.ObjectId, postID bson.ObjectId) User
- func GetUser(id bson.ObjectId) User
- func LikePost(id bson.ObjectId, postID bson.ObjectId) User
- func NewUser(username string) *User
- func RemoveEventFromUser(id bson.ObjectId, eventID bson.ObjectId) User
- func UpdateUser(id bson.ObjectId, user User) User
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAssociationController ¶
func AddAssociationController(w http.ResponseWriter, r *http.Request)
AddAssociationController will answer a JSON of the brand new created association (from the JSON Body) Should be protected
func AddAssociationUser ¶
func AddAssociationUser(user AssociationUser)
AddAssociationUser will add the given AssociationUser to the database
func AddAttendeeController ¶
func AddAttendeeController(w http.ResponseWriter, r *http.Request)
func AddAttendeeToGoingList ¶
AddAttendeeToGoingList will add the given userID to the given eventID as an attendee
func AddAttendeeToMaybeList ¶
func AddEventController ¶
func AddEventController(w http.ResponseWriter, r *http.Request)
AddEventController will answer the JSON of the brand new created Event from the JSON body Should be protected
func AddPostController ¶
func AddPostController(w http.ResponseWriter, r *http.Request)
AddPostController will answer a JSON of the brand new created post (from the JSON Body) Should be protected
func AddUserController ¶
func AddUserController(w http.ResponseWriter, r *http.Request)
AddUserController will answer a JSON of the brand new created user (from the JSON Body)
func ArchiveImage ¶
ArchiveImage will move images in a subdirectory "archive"
func AuthMiddleware ¶
func AuthMiddleware(next http.HandlerFunc, role string) http.HandlerFunc
AuthMiddleware makes sure the user is authenticated before handling the request.
func ChangeAttendeeStatusController ¶
func ChangeAttendeeStatusController(w http.ResponseWriter, r *http.Request)
AddAttendeeController will answer the JSON of the event with the given attendee added
func CheckAndRefreshStringTokens ¶
func CheckAndRefreshStringTokens(authStringToken string, refreshStringToken string, role string) (*jwt.Token, *jwt.Token, error)
CheckAndRefreshStringTokens renews the auth token, if needed.
func CommentEventController ¶
func CommentEventController(w http.ResponseWriter, r *http.Request)
CommentEventController will answer a JSON of the event
func CommentPostController ¶
func CommentPostController(w http.ResponseWriter, r *http.Request)
CommentPostController will answer a JSON of the post
func ContainsString ¶
ContainsString returns true if slice contains element
func CreateNewTokens ¶
CreateNewTokens creates auth and refresh tokens.
func CreateOrUpdateNotificationUser ¶
func CreateOrUpdateNotificationUser(user NotificationUser)
func DeleteAssociationController ¶
func DeleteAssociationController(w http.ResponseWriter, r *http.Request)
DeleteAssociationController will answer a JSON of an empty association if the deletion has succeed Should be protected
func DeleteCommentsForUser ¶
func DeleteEventController ¶
func DeleteEventController(w http.ResponseWriter, r *http.Request)
DeleteEventController will answer an empty JSON if the deletion has succeed Should be protected
func DeleteImage ¶
DeleteImage will permanently delete an image
func DeleteNotificationController ¶
func DeleteNotificationController(w http.ResponseWriter, r *http.Request)
func DeletePostController ¶
func DeletePostController(w http.ResponseWriter, r *http.Request)
DeletePostController will answer a JSON of an empty post if the deletion has succeed Should be protected
func DeleteTagsForUser ¶
func DeleteTokenCookies ¶
func DeleteTokenCookies(w *http.ResponseWriter, r *http.Request)
DeleteTokenCookies deletes the cookies
func DeleteUserController ¶
func DeleteUserController(w http.ResponseWriter, r *http.Request)
DeleteUserController will answer a JSON of an empty user if the deletion succeeded. Should be protected
func DislikePostController ¶
func DislikePostController(w http.ResponseWriter, r *http.Request)
DislikePostController will answer a JSON of the post and the user that disliked the post
func DislikePostWithUser ¶
DislikePostWithUser will remove the user to the list of users that liked the post (cf. Likes field)
func GeneratePassword ¶
func GeneratePassword() string
func GenerateRandomBytes ¶
GenerateRandomBytes returns securely generated random bytes.
func GenerateRandomString ¶
GenerateRandomString returns a URL-safe, base64 encoded securely generated random string.
func GetAllAssociationsController ¶
func GetAllAssociationsController(w http.ResponseWriter, r *http.Request)
GetAllAssociationsController will answer a JSON of all associations
func GetAllPostsController ¶
func GetAllPostsController(w http.ResponseWriter, r *http.Request)
GetAllPostsController will answer a JSON of the N latest posts. Here N = 50.
func GetAllUserController ¶
func GetAllUserController(w http.ResponseWriter, r *http.Request)
func GetAssociationController ¶
func GetAssociationController(w http.ResponseWriter, r *http.Request)
GetAssociationController will answer a JSON of the association linked to the given id in the URL
func GetAssociationUserController ¶
func GetAssociationUserController(w http.ResponseWriter, r *http.Request)
func GetEventController ¶
func GetEventController(w http.ResponseWriter, r *http.Request)
GetEventController will answer a JSON of the event from the given "id" in the URL. (cf Routes in routes.go)
func GetEventsForAssociationController ¶
func GetEventsForAssociationController(w http.ResponseWriter, r *http.Request)
func GetFutureEventsController ¶
func GetFutureEventsController(w http.ResponseWriter, r *http.Request)
GetFutureEventsController will answer a JSON containing all future events from "NOW"
func GetImageColors ¶
GetImageColors will return a palette of colors found in the image
func GetImageDimension ¶
GetImageDimension will return image dimention in pixels
func GetImagesNames ¶
GetImagesNames will return a string of all images in cdn
func GetMD5Hash ¶
func GetMongoSession ¶
func GetMongoSession() *mgo.Session
GetMongoSession creates a new session. If there is an active mongo session it will return a Clone.
func GetMyAssociationController ¶
func GetMyAssociationController(w http.ResponseWriter, r *http.Request)
GetMyAssociationController will answer a JSON of the associations owned by the applicant master association
func GetMyAssociations ¶
GetMyAssociations will return an array of all ID from owned existing Association
func GetNotificationController ¶
func GetNotificationController(w http.ResponseWriter, r *http.Request)
func GetPostController ¶
func GetPostController(w http.ResponseWriter, r *http.Request)
GetPostController will answer a JSON of the post linked to the given id in the URL
func GetPostsForAssociationController ¶
func GetPostsForAssociationController(w http.ResponseWriter, r *http.Request)
GetPostsForAssociationController will answer a JSON of the post owned by the given association
func GetUserController ¶
func GetUserController(w http.ResponseWriter, r *http.Request)
GetUserController will answer a JSON of the user linked to the given id in the URL
func GetUserFromRequest ¶
GetUserFromRequest returns the User or AssociationUser ID from the auth cookie.
func HowToPost ¶
func HowToPost(w http.ResponseWriter, r *http.Request)
HowToPost show a page explaining how to post for associations
func LikePostController ¶
func LikePostController(w http.ResponseWriter, r *http.Request)
LikePostController will answer a JSON of the post and the user that liked the post
func LikePostWithUser ¶
LikePostWithUser will add the user to the list of user that liked the post (cf. Likes field)
func LoginAssociationController ¶
func LoginAssociationController(w http.ResponseWriter, r *http.Request)
LoginAssociationController logs an association in.
func LoginUserController ¶
func LoginUserController(w http.ResponseWriter, r *http.Request)
LoginUserController logs a user in using CAS. If the ticket is valid, auth and refresh tokens are generated.
func LogoutAssociationController ¶
func LogoutAssociationController(w http.ResponseWriter, r *http.Request)
LogoutAssociationController logs an association out.
func LogoutUserController ¶
func LogoutUserController(w http.ResponseWriter, r *http.Request)
LogoutUserController logs a user out.
func NewRouter ¶
NewRouter is the constructor of the Router It will create every routes from the routes variable just above
func RandomString ¶
func RemoveAttendee ¶
RemoveAttendee remove the given userID from the given eventID as a participant
func RemoveAttendeeController ¶
func RemoveAttendeeController(w http.ResponseWriter, r *http.Request)
RemoveAttendeeController will answer the JSON of the event without the given attendee added
func ReportComment ¶
func ReportCommentController ¶
func ReportCommentController(w http.ResponseWriter, r *http.Request)
func ReportUserController ¶
func ReportUserController(w http.ResponseWriter, r *http.Request)
func ResizeImage ¶
ResizeImage will resize an image as jpeg and response its new name Put 0 to newWidth or newHeight to make it automatically calculate to keep aspect ratio.
func ResponseHandler ¶
func ResponseHandler(w *http.ResponseWriter, fileName string, err error)
ResponseHandler will response to the client
func RevokeRefreshStringToken ¶
RevokeRefreshStringToken deletes the given token from the database, if valid.
func SearchAssociationController ¶
func SearchAssociationController(w http.ResponseWriter, r *http.Request)
func SearchEventController ¶
func SearchEventController(w http.ResponseWriter, r *http.Request)
func SearchPostController ¶
func SearchPostController(w http.ResponseWriter, r *http.Request)
func SearchUniversalController ¶
func SearchUniversalController(w http.ResponseWriter, r *http.Request)
func SearchUserController ¶
func SearchUserController(w http.ResponseWriter, r *http.Request)
func SendAssociationEmailForCommentOnEvent ¶
func SendAssociationEmailForCommentOnEvent(email string, event Event, comment Comment, user User) error
SendAssociationEmailForCommentOnEvent sends an email indicating a new comment has been added on an event
func SendAssociationEmailForCommentOnPost ¶
func SendAssociationEmailForCommentOnPost(email string, post Post, comment Comment, user User) error
SendAssociationEmailForCommentOnPost sends an email indicating a new comment has been added on a post
func SendAssociationEmailSubscription ¶
SendAssociationEmailSubscription sends a subscription email containing the credentials.
func TriggerNotificationForEvent ¶
func TriggerNotificationForEvent(event Event, sender bson.ObjectId, content bson.ObjectId, message string)
TriggerNotificationForEvent sends a notification and a push notification to users targeted by the promotion. Push notifications are not sent in a local environment.
func TriggerNotificationForPost ¶
func TriggerNotificationForPost(post Post, sender bson.ObjectId, content bson.ObjectId, message string)
TriggerNotificationForPost sends a notification and a push notification to users targeted by the promotion. Push notifications are not sent in a local environment.
func TriggerNotificationForUserFromEvent ¶
func TriggerNotificationForUserFromEvent(sender bson.ObjectId, receiver bson.ObjectId, content bson.ObjectId, message string, comment Comment, tagType string)
TriggerNotificationForUserFromEvent sends a notification and a push notification to the given user. Push notifications are not sent in a local environment.
func TriggerNotificationForUserFromPost ¶
func TriggerNotificationForUserFromPost(sender bson.ObjectId, receiver bson.ObjectId, content bson.ObjectId, message string, comment Comment, tagType string)
TriggerNotificationForUserFromPost sends a notification and a push notification to the given user. Push notifications are not sent in a local environment.
func UncommentEventController ¶
func UncommentEventController(w http.ResponseWriter, r *http.Request)
UncommentEventController will answer a JSON of the event
func UncommentPostController ¶
func UncommentPostController(w http.ResponseWriter, r *http.Request)
UncommentPostController will answer a JSON of the post Should be protected
func UpdateAssociationController ¶
func UpdateAssociationController(w http.ResponseWriter, r *http.Request)
UpdateAssociationController will answer the JSON of the modified association (from the JSON Body) Should be protected
func UpdateEventController ¶
func UpdateEventController(w http.ResponseWriter, r *http.Request)
UpdateEventController will answer the JSON of the modified Event from the JSON body Should be protected
func UpdateNotificationUserController ¶
func UpdateNotificationUserController(w http.ResponseWriter, r *http.Request)
func UpdatePostController ¶
func UpdatePostController(w http.ResponseWriter, r *http.Request)
UpdatePostController will answer the JSON of the modified post (from the JSON Body) Should be protected
func UpdateUserController ¶
func UpdateUserController(w http.ResponseWriter, r *http.Request)
UpdateUserController will answer the JSON of the modified user (from the JSON Body) Should be protected
func UploadImage ¶
UploadImage will give a random name and upload the image
func UploadImageController ¶
func UploadImageController(w http.ResponseWriter, r *http.Request)
UploadImageController will upload a new image in the cdn
func UploadImageWithName ¶
UploadImageWithName will manage the upload image from a POST request
func UploadNewImageController ¶
func UploadNewImageController(w http.ResponseWriter, r *http.Request)
UploadNewImageController will upload a new image in the cdn
func VerifyEmail ¶
VerifyEmail return true if email is not already used
Types ¶
type Association ¶
type Association struct { ID bson.ObjectId `bson:"_id,omitempty"` Name string `json:"name"` Email string `json:"email"` Description string `json:"description"` Events []bson.ObjectId `json:"events"` Posts []bson.ObjectId `json:"posts"` Palette [][]int `json:"palette"` SelectedColor int `json:"selectedcolor"` Profile string `json:"profile"` ProfileUploaded string `json:"profileuploaded"` Cover string `json:"cover"` BgColor string `json:"bgcolor"` FgColor string `json:"fgcolor"` }
Association defines the model of a Association
func AddAssociation ¶
func AddAssociation(association Association) Association
AddAssociation will add the given Association to the database
func AddEventToAssociation ¶
func AddEventToAssociation(id bson.ObjectId, event bson.ObjectId) Association
AddEventToAssociation will add the given event ID to the given association
func AddPostToAssociation ¶
func AddPostToAssociation(id bson.ObjectId, post bson.ObjectId) Association
func DeleteAssociation ¶
func DeleteAssociation(id bson.ObjectId) Association
DeleteAssociation will delete the given association from the database
func GetAssociation ¶
func GetAssociation(id bson.ObjectId) Association
GetAssociation will return an Association object from the given ID
func GetAssociationFromEmail ¶
func GetAssociationFromEmail(email string) Association
GetAssociationFromEmail will return an Association object from the given email
func RemoveEventFromAssociation ¶
func RemoveEventFromAssociation(id bson.ObjectId, event bson.ObjectId) Association
RemoveEventFromAssociation will remove the given event ID from the given association
func RemovePostFromAssociation ¶
func RemovePostFromAssociation(id bson.ObjectId, post bson.ObjectId) Association
func UpdateAssociation ¶
func UpdateAssociation(id bson.ObjectId, association Association) Association
UpdateAssociation will update the given Association link to the given ID, with the field of the given Association, in the database
type AssociationLogin ¶
type AssociationLogin struct { Username string `json:"username"` Password string `json:"password"` }
AssociationLogin is the data provided by an association to authenticate.
type AssociationUser ¶
type AssociationUser struct { ID bson.ObjectId `bson:"_id,omitempty"` Username string `json:"username"` Association bson.ObjectId `json:"association" bson:"association"` Password string `json:"-"` Master bool `json:"master"` Owner bson.ObjectId `json:"owner" bson:"owner,omitempty"` }
AssociationUser defines how to model an AssociationUser
func GetAssociationUser ¶
func GetAssociationUser(id bson.ObjectId) AssociationUser
GetAssociationUser return the AssociationUser object with the given ID.
type Associations ¶
type Associations []Association
Associations is an array of Association
func GetAllAssociations ¶
func GetAllAssociations() Associations
GetAllAssociations will return an array of all the existing Association, hidding "Menu" association and sort by name asc
func SearchAssociation ¶
func SearchAssociation(name string) Associations
SearchAssociation return an array of all Association found with the given search string.
type Comment ¶
type Comment struct { ID bson.ObjectId `bson:"_id,omitempty"` User bson.ObjectId `json:"user"` Content string `json:"content"` Date time.Time `json:"date"` Tags Tags `json:"tags"` }
Comment defines how to model a Comment of a Post
type Config ¶
type Config struct { Domain string `json:"domain"` Environment string `json:"env"` GoogleEmail string `json:"google_email"` GooglePassword string `json:"google_password"` FirebaseKey string `json:"firebase_key"` DatabaseName string `json:"mongo_database_name"` DatabaseSource string `json:"mongo_database_source"` DatabaseUsername string `json:"mongo_database_username"` DatabasePassword string `json:"mongo_database_password"` PrivateKeyPath string `json:"private_key_path"` PublicKeyPath string `json:"public_key_path"` Port string `json:"port"` }
Config defines how to model a Config
type Event ¶
type Event struct { ID bson.ObjectId `bson:"_id,omitempty"` Name string `json:"name"` Association bson.ObjectId `json:"association" bson:"association"` Description string `json:"description"` Participants []bson.ObjectId `json:"participants" bson:"participants,omitempty"` Maybe []bson.ObjectId `json:"maybe" bson:"maybe,omitempty"` NotGoing []bson.ObjectId `json:"notgoing" bson:"notgoing,omitempty"` Comments Comments `json:"comments"` Status string `json:"status"` Palette [][]int `json:"palette"` SelectedColor int `json:"selectedcolor"` DateStart time.Time `json:"dateStart"` DateEnd time.Time `json:"dateEnd"` Image string `json:"image"` Promotions []string `json:"promotions"` Plateforms []string `json:"plateforms"` BgColor string `json:"bgColor"` FgColor string `json:"fgColor"` NoNotification bool `json:"nonotification"` }
Event defines what an Event is
type Events ¶
type Events []Event
Events is an array of Event
func GetEventsForAssociation ¶
GetEventsForAssociation returns an array of all Events from the given association ID
func GetFutureEvents ¶
func GetFutureEvents() Events
GetFutureEvents returns an array of Event that will happen after "NOW"
func SearchEvent ¶
type Middleware ¶
type Middleware func(http.HandlerFunc, string) http.HandlerFunc
Middleware is the type wrapping http handlers.
type Notification ¶
type Notification struct { ID bson.ObjectId `bson:"_id,omitempty"` Sender bson.ObjectId `json:"sender"` Receiver bson.ObjectId `json:"receiver"` Content bson.ObjectId `json:"content"` Comment Comment `json:"comment,omitempty" bson:",omitempty"` Message string `json:"message"` Seen bool `json:"seen"` Date time.Time `json:"date"` Type string `json:"type"` }
Notification defines how to model a Notification
func AddNotification ¶
func AddNotification(notification Notification) Notification
type NotificationUser ¶
type NotificationUser struct { ID bson.ObjectId `bson:"_id,omitempty"` UserId bson.ObjectId `json:"userid"` Token string `json:"token" bson:",omitempty"` Os string `json:"os"` }
NotificationUser defines how to model a NotificationUser
func GetNotificationUserForUser ¶
func GetNotificationUserForUser(userID bson.ObjectId) NotificationUser
type Notifications ¶
type Notifications []Notification
func GetNotificationsForUser ¶
func GetNotificationsForUser(userID bson.ObjectId) Notifications
func GetUnreadNotificationsForUser ¶
func GetUnreadNotificationsForUser(userID bson.ObjectId) Notifications
func ReadNotificationForUser ¶
func ReadNotificationForUser(userID bson.ObjectId, notifID bson.ObjectId) Notifications
type Post ¶
type Post struct { ID bson.ObjectId `bson:"_id,omitempty"` Title string `json:"title"` Association bson.ObjectId `json:"association"` Description string `json:"description"` Date time.Time `json:"date"` Likes []bson.ObjectId `json:"likes"` Comments Comments `json:"comments"` Promotions []string `json:"promotions"` Plateforms []string `json:"plateforms"` Image string `json:"image"` ImageSize bson.M `json:"imageSize"` NoNotification bool `json:"nonotification"` }
Post defines how to model a Post
func CommentPost ¶
CommentPost will add the given comment object to the list of comments of the post linked to the given id
func DeletePost ¶
DeletePost will delete the given Post from the database
func UncommentPost ¶
UncommentPost will remove the given comment object from the list of comments of the post linked to the given id
type Posts ¶
type Posts []Post
Posts is an array of Post
func GetLatestPosts ¶
GetLatestPosts will return an array of the last N Posts
func GetPostsForAssociation ¶
GetPostsForAssociation returns an array of Posts from the given association ID
func SearchPost ¶
type Route ¶
type Route struct { Method string Pattern string HandlerFunc http.HandlerFunc }
Route type is used to define a route of the API
type TokenClaims ¶
type TokenClaims struct { ID bson.ObjectId `json:"id"` Role string `json:"role"` jwt.StandardClaims }
TokenClaims is the JWT encoding format.
type User ¶
type User struct { ID bson.ObjectId `bson:"_id,omitempty"` Name string `json:"name"` Username string `json:"username"` Description string `json:"description"` Email string `json:"email"` EmailPublic bool `json:"emailpublic"` Promotion string `json:"promotion"` Gender string `json:"gender"` Events []bson.ObjectId `json:"events"` PostsLiked []bson.ObjectId `json:"postsliked"` }
User defines how to model a User
func AddEventToUser ¶
AddEventToUser will add the eventID to the list of the user's event linked to the given id
func DeleteUser ¶
DeleteUser will delete the given user from the database
func DislikePost ¶
DislikePost will remove the postID from the list of liked post of the user linked to the given id
func LikePost ¶
LikePost will add the postID to the list of liked post of the user linked to the given id
func RemoveEventFromUser ¶
RemoveEventFromUser will remove the eventID from the list of the user's event linked to the given ID.
Source Files ¶
- association.go
- associationController.go
- auth.go
- comment.go
- configuration.go
- event.go
- eventController.go
- image.go
- imageController.go
- index.go
- loginController.go
- mail.go
- notification.go
- notificationController.go
- notificationManager.go
- post.go
- postController.go
- routes.go
- searchController.go
- user.go
- userController.go
- utils.go