stores

package
v0.0.0-...-e6b71c9 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddUserToStore

func AddUserToStore(user models.User, storeID interface{}) (su models.StoreUser, err error)

DEPRECATED AddUserToStore properly associates a user with a store by userID by removing the email value and adding the userID value

func AddUserToStoreWithCode

func AddUserToStoreWithCode(user models.User, code string, appScheme string) (su models.StoreUser, err error)

func CreateStore

func CreateStore(userID uuid.UUID, name string) (models.Store, error)

CreateStore creates a store for a user if it does not already exist by name

func DeleteStore

func DeleteStore(storeID interface{}, userID uuid.UUID) (deletedStore models.Store, err error)

DeleteStore handles deletion of a store record Note: Associated trips, items, store users etc. are deleted in the AfterDelete hook on the model

func InviteToStoreByEmail

func InviteToStoreByEmail(storeID interface{}, invitedEmail string) (storeUser models.StoreUser, err error)

InviteToStoreByEmail creates a store_users record for this store ID and email

The store user will be considered pending until the invitation is accepted by the user in the app, at which point they are associated by userID instead.

func RemoveStapleItem

func RemoveStapleItem(itemID uuid.UUID) (staple models.StoreStapleItem, err error)

RemoveStapleItem dissocates any staple_item_id from items for this staple item and deletes the staple item

func RemoveUserFromStore

func RemoveUserFromStore(user models.User, storeID interface{}) (interface{}, error)

RemoveUserFromStore removes a user from a store either by userID or email, whichever is present

Used for declining a store invite, and simply removing a user from a store

func RetrieveInvitedUserStores

func RetrieveInvitedUserStores(user models.User) (stores []models.Store, err error)

RetrieveInvitedUserStores retrieves stores that the userID has created or has been added to

func RetrieveStoreCreator

func RetrieveStoreCreator(storeID uuid.UUID) (interface{}, error)

RetrieveStoreCreator returns the store user who created a given store

func RetrieveStoreForUser

func RetrieveStoreForUser(storeID interface{}, userID uuid.UUID) (store models.Store, err error)

RetrieveStoreForUser retrieves a specific store by storeID and userID

func RetrieveStoreForUserByName

func RetrieveStoreForUserByName(name string, userID uuid.UUID) (models.Store, error)

RetrieveStoreForUserByName retrieves a specific store by name and userID. It is used in resolvers.CreateStoreResolver to determine whether a store with a given name already exists in the user's account, to avoid duplicates.

func RetrieveStoreUserID

func RetrieveStoreUserID(storeID interface{}, userID uuid.UUID) (storeUserID uuid.UUID, err error)

RetrieveStoreUserID retrieves the ID of the store_users record associated with a storeID and userID

func RetrieveStoreUserPrefs

func RetrieveStoreUserPrefs(storeUserID uuid.UUID) (sup models.StoreUserPreference, err error)

RetrieveStoreUserPrefs updates store user preferences

func RetrieveStoreUsers

func RetrieveStoreUsers(storeID uuid.UUID) (storeUsers []models.StoreUser, err error)

RetrieveStoreUsers finds all store users in a store by storeID

func RetrieveUserStores

func RetrieveUserStores(user models.User) (stores []models.Store, err error)

RetrieveUserStores retrieves stores that the userID has created or has been added to

func SaveStapleItem

func SaveStapleItem(storeID uuid.UUID, itemID uuid.UUID) (staple models.StoreStapleItem, err error)

SaveStapleItem saves an item as a staple in the store ID provided

func UpdateStoreForUser

func UpdateStoreForUser(userID uuid.UUID, args map[string]interface{}) (interface{}, error)

UpdateStoreForUser updates a store for the given userID with the provided args

func UpdateStoreUserPrefs

func UpdateStoreUserPrefs(storeUserID uuid.UUID, args map[string]interface{}) (sup models.StoreUserPreference, err error)

UpdateStoreUserPrefs updates store user preferences

Types

This section is empty.

Jump to

Keyboard shortcuts

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