services

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const EMAIL_REGEX = "" /* 490-byte string literal not displayed */

Variables

This section is empty.

Functions

func CreateMultiplePhotos

func CreateMultiplePhotos(photos []models.Photo) ([]string, []string, error)

CreateMultiplePhotos creates multiple photos

func CreateNewUser

func CreateNewUser(user models.User) (string, error)

CreateNewUser creates a new user

func CreateNewUserAuth

func CreateNewUserAuth(userAuth *models.UserAuth) (string, error)

CreateNewUserAuth creates a new UserAuth

func CreatePhoto

func CreatePhoto(photo models.Photo) (string, error)

CreatePhoto creates a new photo

func CreateToken

func CreateToken(userAuth *models.UserAuth) (string, error)

CreateToken creates a JWT token for a given user

func DeletePhoto

func DeletePhoto(currentUserID string, photoID string) error

DeletePhoto deletes a photo

func DeleteUser

func DeleteUser(id string) error

DeleteUser deletes a user and unsubscribes every user who is subscribed to them

func DeleteUserAuth

func DeleteUserAuth(id string) error

DeleteUserAuth removes a UserAuth associated with the ID

func GetAllPhotosFromOwner

func GetAllPhotosFromOwner(currentUserID string, ownerID string) ([]models.Photo, error)
GetAllPhotosFromOwner returns all the pictures from a user, given that the currently authenticated user is subscribed

to the owner of the pictures

func GetAllUsers

func GetAllUsers() ([]models.User, error)

GetAllUsers returns all users registered to this platform

func GetPasswordHash

func GetPasswordHash(email string, password string) string

GetPasswordHash returns the hash for a given password. Uses email las prepend salt

func GetPhotoByID

func GetPhotoByID(currentUserID string, photoID string) (*models.Photo, error)

GetPhotoByID returns a saved photo by its ID

func GetUserAuthByEmail

func GetUserAuthByEmail(email string) (*models.UserAuth, error)

GetAuthByEmail returns the UserAuth associated with the email address

func GetUserById

func GetUserById(id string) (*models.User, error)

GetUserById returns a given user by its id

func ModifyUserAuth

func ModifyUserAuth(id string, userAuth *models.UserAuth) (bool, error)

ModifyUserAuth modifies a UserAuth

func PaySubscription

func PaySubscription(user *models.User)

PaySubscription Pays all users to whom a users is subscribed to

func PaySubscriptionTo

func PaySubscriptionTo(user *models.User, subscribedToID string) error

PaySubscriptionTo transfers balance of the amount in SubscriptionPrice to a user is subscribed to

func SearchPhotosOfOwnerByName

func SearchPhotosOfOwnerByName(currentUserID string, ownerID string, name string) ([]models.Photo, error)
SearchPhotosOfOwnerByName will search all photos from a given owner for photos where the name partially match the

name provided

func SubscribeTo

func SubscribeTo(currentUserID string, newSubscriptionID string) (bool, error)

SubscribeTo subscribes the current user to another user

func UnsubscribeFrom

func UnsubscribeFrom(currentUserID string, subscriptionIDToRemove string) (bool, error)

UnsubscribeFrom unsubscribes the current user from another user

func UpdateUser

func UpdateUser(currentUserID string, user models.User) (bool, error)

UpdateUser updates a user with new information. The user performing the action must be owner of this account

func ValidateLoginRequest

func ValidateLoginRequest(loginRequest *models.LoginRequest, userAuth *models.UserAuth) (token string, err error)

ValidateLoginRequest checks that the login request is valid and that the credentials match

func ValidateSignUpRequest

func ValidateSignUpRequest(req models.SignUpRequest) error

ValidateSignUpRequest checks that the sign up request is valid

Types

This section is empty.

Jump to

Keyboard shortcuts

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