controllers

package
v0.0.0-...-da5f288 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateItem

func CreateItem(w http.ResponseWriter, r *http.Request)

CreateItem creates a new item and then return the item if it is successful It expects an URL that it can use to parse into an item object

func CreateItemFromURL

func CreateItemFromURL(w http.ResponseWriter, r *http.Request)

CreateItemFromURL creates a new item and then return the item if it is successful It expects an URL that it can use to parse into an item object

func CreateUser

func CreateUser(w http.ResponseWriter, r *http.Request)

CreateUser creates a new User and returns a logged in session back to the client as an acknowledgement. It generates a new uuid when called.

func CreateUserItem

func CreateUserItem(w http.ResponseWriter, r *http.Request)

CreateUserItem adds an item to an user

func DeleteUser

func DeleteUser(w http.ResponseWriter, r *http.Request)

DeleteUser deletes a user from the database

func GetItem

func GetItem(w http.ResponseWriter, r *http.Request)

GetItem returns a specific Item with id.

func GetItemWithPrice

func GetItemWithPrice(w http.ResponseWriter, r *http.Request)

GetItemWithPrice returns a specific Item with its latest price.

func GetItems

func GetItems(w http.ResponseWriter, r *http.Request)

GetItems returns all items.

func GetItemsWithPrice

func GetItemsWithPrice(w http.ResponseWriter, r *http.Request)

GetItemsWithPrice returns all items with prices.

func GetPrice

func GetPrice(w http.ResponseWriter, r *http.Request)

GetPrice returns the most current price for item with id.

func GetPrices

func GetPrices(w http.ResponseWriter, r *http.Request)

GetPrices returns all prices for item with id

func GetUser

func GetUser(w http.ResponseWriter, r *http.Request)

GetUser returns a specific User.

func GetUserItem

func GetUserItem(w http.ResponseWriter, r *http.Request)

GetUserItem returns the itemID if the given itemID is in the user's list and nothing otherwise

func GetUserItems

func GetUserItems(w http.ResponseWriter, r *http.Request)

GetUserItems gets all items for a certain user

func LoginUser

func LoginUser(w http.ResponseWriter, r *http.Request)

LoginUser logs in a new user based on the provided credentials

func SearchItems

func SearchItems(w http.ResponseWriter, r *http.Request)

SearchItems returns items with prices matching the search query

func SessionCtx

func SessionCtx(next http.Handler) http.Handler

SessionCtx middleware is used to load an Session object from the authorization token passed through as the request. In case the User could not be found, we stop here and return a 404.

func Subscribe

func Subscribe(w http.ResponseWriter, r *http.Request)

Subscribe subscribes an user to email notifications for when the items price goes below a certain price

func Unsubscribe

func Unsubscribe(w http.ResponseWriter, r *http.Request)

Unsubscribe unsubscribes an user from email notifications

func UpdateUser

func UpdateUser(w http.ResponseWriter, r *http.Request)

UpdateUser updates an user password/username It returns the updated user

func ValidateURL

func ValidateURL(w http.ResponseWriter, r *http.Request)

ValidateURL checks if an URL is supported

Types

This section is empty.

Jump to

Keyboard shortcuts

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