controllers

package
v0.0.0-...-e3537d7 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APIAnalytics *mongo.Collection

APIAnalytics should hold client request info to a specific API endpoint

DB holds the mongo collection for Recipes in our database.

View Source
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

func (c Analytics) RequestAnalytics() revel.Result

RequestAnalytics is the endpoint that a user should call for analytics stored in the database

type Home

type Home struct {
	*revel.Controller
}

Home is the home route of the API

func (Home) Index

func (c Home) Index() revel.Result

type ItemInfo

type ItemInfo struct {
	*revel.Controller
}

ItemInfo handles the endpoints for a specific item, without any user information

func (ItemInfo) Obtain

func (c ItemInfo) Obtain(recipeID int) revel.Result

Obtain grabs all recipe information from XIVAPI, and returns all of the information about the materials and main recipe.

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

func (c UserInfo) Logout() revel.Result

Logout removes you from the session

func (UserInfo) Obtain

func (c UserInfo) Obtain() revel.Result

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

func (c UserInfo) ObtainUserProfit() revel.Result

ObtainUserProfit returns the top 20 recipes with most profit for a user.

func (UserInfo) Store

func (c UserInfo) Store(UserSubmission *models.UserSubmission) revel.Result

Store handles the data by storing info to the Database given a POST request with UserSubmission data,

func (UserInfo) TestLogin

func (c UserInfo) TestLogin(DiscordToken *models.DiscordToken) revel.Result

TestLogin allows you to login in for testing environment, and test the other functions without getting 403'd.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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