Documentation ¶
Index ¶
- Variables
- func APIRequestAnalytics(isAuthorized bool) []*models.EndpointRequest
- func InitDB()
- func LogEndpointRequest(request models.EndpointRequest)
- func QuickSortUserProfits(recipes []models.UserProfits, left int, right int)
- type Analytics
- type Home
- type ItemInfo
- type UserInfo
- func (c UserInfo) Login(DiscordToken *models.DiscordToken) revel.Result
- func (c UserInfo) Logout() revel.Result
- func (c UserInfo) Obtain() revel.Result
- func (c UserInfo) ObtainUserProfit() revel.Result
- func (c UserInfo) Store(UserSubmission *models.UserSubmission) revel.Result
- func (c UserInfo) TestLogin(DiscordToken *models.DiscordToken) revel.Result
Constants ¶
This section is empty.
Variables ¶
var APIAnalytics *mongo.Collection
APIAnalytics should hold client request info to a specific API endpoint
var DB mongoDB.Collections
DB holds the mongo collection for Recipes in our database.
var UserStorageCollection mongoDB.UserStorageCollection
UserStorageCollection holds the User Storage collection from our database.
Functions ¶
func APIRequestAnalytics ¶
func APIRequestAnalytics(isAuthorized bool) []*models.EndpointRequest
APIRequestAnalytics returns all IPs and endpoints stored in the database
func InitDB ¶
func InitDB()
InitDB initializes DB so it would give the Clients so that we can access the database
func LogEndpointRequest ¶
func LogEndpointRequest(request models.EndpointRequest)
LogEndpointRequest submits to the database the client IP and endpoint called.
func QuickSortUserProfits ¶
func QuickSortUserProfits(recipes []models.UserProfits, left int, right int)
QuickSortUserProfits sorts using quicksort, except it targets percentageProfit inside a UserProfits array.
Types ¶
type Analytics ¶
type Analytics struct {
*revel.Controller
}
Analytics for visitors to the API
func (Analytics) RequestAnalytics ¶
RequestAnalytics is the endpoint that a user should call for analytics stored in the database
type ItemInfo ¶
type ItemInfo struct {
*revel.Controller
}
ItemInfo handles the endpoints for a specific item, without any user information
type UserInfo ¶
type UserInfo struct {
*revel.Controller
}
UserInfo controls all User Info related endpoints.
func (UserInfo) Login ¶
func (c UserInfo) Login(DiscordToken *models.DiscordToken) revel.Result
Login stores you into a session, which is really just a cookie, given a POST request with just an access token from Discord
func (UserInfo) Obtain ¶
Obtain returns a user's storage document, or nil if there are no user in the database. Or returns an empty object if there's no recipe in the database.
func (UserInfo) ObtainUserProfit ¶
ObtainUserProfit returns the top 20 recipes with most profit for a user.