repository

package
v0.0.0-...-689d12e Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCannotGetAllMenus = errors.New("could not get all menus from db")
	ErrGettingMenu       = errors.New("failed to get menu")
	ErrMenuNotFound      = errors.New("menu not found")
	ErrGettingMenuItem   = errors.New("failed to get menu item")
	ErrMenuItemNotFound  = errors.New("menu item not found")
	ErrCreatingMenu      = errors.New("could not create menu")
	ErrUpdatingMenu      = errors.New("could not update menu")
	ErrCreatingMenuItem  = errors.New("could not create menu item")
	ErrDeletingMenuItem  = errors.New("could not delete menu item")
	ErrDeletingMenu      = errors.New("could not delete menu")
)
View Source
var (
	ErrCannotGetAllOrder               = errors.New("could not get all orders from db")
	ErrOrderNotFound                   = errors.New("order not found")
	ErrGettingOrder                    = errors.New("could not get order from db")
	ErrCannotGetAllOrders              = errors.New("could not get all orders from db")
	ErrCannotGetAllOrderItems          = errors.New("could not get all order items from db")
	ErrGettingOrderItemsOrderAndUser   = errors.New("could not get order items for order and user")
	ErrGettingOrderItem                = errors.New("error getting order item")
	ErrOrderItemNotFound               = errors.New("order item not found")
	ErrCreatingOrderItem               = errors.New("could not create order item")
	ErrOrderNotOpen                    = errors.New("order is not in state open")
	ErrCreatingOrder                   = errors.New("could not create order")
	ErrActiveOrderForMenuAlreadyExists = errors.New("there is already an active order the specified menu")
	ErrUpdatingOrder                   = errors.New("could not update order")
	ErrOrderStateTransitionInvalid     = errors.New("invalid order state transition")
	ErrUpdatingOrderItem               = errors.New("could not update order item")
	ErrOrderUUIDChangeForbidden        = errors.New("changing order uuid is forbidden")
	ErrDeletingOrderItem               = errors.New("could not delete order item")
	ErrPaidChangeForbidden             = errors.New("paid status can only be changed by sugar person")
	ErrMenuItemUUIDMissing             = errors.New("menu item uuid missing")
	ErrMenuItemUUIDChangeForbidden     = errors.New("changing menu item uuid is forbidden")
	ErrUserChangeForbidden             = errors.New("changing user is forbidden")
	ErrSugarPersonNotSet               = errors.New("the sugar person has not been set")
)
View Source
var (
	ErrUserAlreadyExists = errors.New("user already exists")
	ErrCannotGetAllUsers = errors.New("could not get all users from db")
	ErrGettingUser       = errors.New("failed to get user")
	ErrUserNotFound      = errors.New("user not found")
	ErrCreatingUser      = errors.New("could not create user")
	ErrUpdatingUser      = errors.New("could not update users")
	ErrDeletingUser      = errors.New("could not delete user")
	ErrSettingPublicKey  = errors.New("setting public key for user")
)

Functions

This section is empty.

Types

type MenuRepository struct {
	DB *gorm.DB
}
func (r *MenuRepository) CreateMenu(ctx context.Context, menu *entity.Menu) (*entity.Menu, error)
func (r *MenuRepository) CreateMenuItem(ctx context.Context, menuItem *entity.MenuItem) (*entity.MenuItem, error)
func (r *MenuRepository) DeleteMenu(ctx context.Context, menuUUID *uuid.UUID) error
func (r *MenuRepository) DeleteMenuItem(ctx context.Context, menuItemUUID *uuid.UUID) error
func (r *MenuRepository) GetAllMenus(ctx context.Context) ([]entity.Menu, error)
func (r *MenuRepository) GetMenu(ctx context.Context, menuUUID *uuid.UUID) (*entity.Menu, error)
func (r *MenuRepository) GetMenuByName(ctx context.Context, name string) (*entity.Menu, error)
func (r *MenuRepository) GetMenuItem(ctx context.Context, menuItemUUID *uuid.UUID) (*entity.MenuItem, error)
func (r *MenuRepository) GetMenuItemByShortName(ctx context.Context, menuUUID *uuid.UUID, shortName string) (*entity.MenuItem, error)
func (r *MenuRepository) UpdateMenu(ctx context.Context, menuUUID *uuid.UUID, menu *entity.Menu) (*entity.Menu, error)

type OrderRepository

type OrderRepository struct {
	DB             *gorm.DB
	MenuRepository MenuRepository
}

func (*OrderRepository) CreateOrder

func (r *OrderRepository) CreateOrder(ctx context.Context, order *entity.Order) (*entity.Order, error)

func (*OrderRepository) CreateOrderItem

func (r *OrderRepository) CreateOrderItem(
	ctx context.Context,
	orderUUID *uuid.UUID,
	orderItem *entity.OrderItem,
) (*entity.OrderItem, error)

func (*OrderRepository) DeleteOrder

func (r *OrderRepository) DeleteOrder(ctx context.Context, orderUUID *uuid.UUID) error

func (*OrderRepository) DeleteOrderItem

func (r *OrderRepository) DeleteOrderItem(ctx context.Context, orderItemUUID *uuid.UUID) error

func (*OrderRepository) GetActiveOrderByMenu

func (r *OrderRepository) GetActiveOrderByMenu(ctx context.Context, menuUUID *uuid.UUID) (*entity.Order, error)

func (*OrderRepository) GetActiveOrderByMenuName

func (r *OrderRepository) GetActiveOrderByMenuName(ctx context.Context, menuName string) (*entity.Order, error)

func (*OrderRepository) GetAllOrderItems

func (r *OrderRepository) GetAllOrderItems(ctx context.Context, orderUUID *uuid.UUID) ([]entity.OrderItem, error)

func (*OrderRepository) GetAllOrderItemsForOrderAndUser

func (r *OrderRepository) GetAllOrderItemsForOrderAndUser(ctx context.Context, orderUUID, userUUID *uuid.UUID) ([]entity.OrderItem, error)

func (*OrderRepository) GetAllOrders

func (r *OrderRepository) GetAllOrders(ctx context.Context) ([]entity.Order, error)

func (*OrderRepository) GetOrder

func (r *OrderRepository) GetOrder(ctx context.Context, uuid *uuid.UUID) (*entity.Order, error)

func (*OrderRepository) GetOrderItem

func (r *OrderRepository) GetOrderItem(ctx context.Context, uuid *uuid.UUID) (*entity.OrderItem, error)

func (*OrderRepository) UpdateOrder

func (r *OrderRepository) UpdateOrder(ctx context.Context, orderUUID, currentUser *uuid.UUID, order *entity.Order) (*entity.Order, error)

func (*OrderRepository) UpdateOrderItem

func (r *OrderRepository) UpdateOrderItem(
	ctx context.Context,
	orderItemUUID,
	userUUID *uuid.UUID,
	orderItem *entity.OrderItem,
) (*entity.OrderItem, error)

type UserRepository

type UserRepository struct {
	DB *gorm.DB
}

func (*UserRepository) CreateMatrixUser

func (r *UserRepository) CreateMatrixUser(ctx context.Context, matrixUser *entity.MatrixUser) (*entity.MatrixUser, error)

func (*UserRepository) CreatePasswordUser

func (r *UserRepository) CreatePasswordUser(ctx context.Context, passwordUser *entity.PasswordUser) (*entity.PasswordUser, error)

func (*UserRepository) CreateSSHUser

func (r *UserRepository) CreateSSHUser(ctx context.Context, sshUser *entity.SSHUser) (*entity.SSHUser, error)

func (*UserRepository) CreateUser

func (r *UserRepository) CreateUser(ctx context.Context, user *entity.User) (*entity.User, error)

func (*UserRepository) DeleteMatrixUser

func (r *UserRepository) DeleteMatrixUser(ctx context.Context, userUUID *uuid.UUID) error

func (*UserRepository) DeletePasswordUser

func (r *UserRepository) DeletePasswordUser(ctx context.Context, userUUID *uuid.UUID) error

func (*UserRepository) DeleteSSHUser

func (r *UserRepository) DeleteSSHUser(ctx context.Context, userUUID *uuid.UUID) error

func (*UserRepository) DeleteUser

func (r *UserRepository) DeleteUser(ctx context.Context, userUUID *uuid.UUID) error

func (*UserRepository) FindPasswordUser

func (r *UserRepository) FindPasswordUser(ctx context.Context, username string) (*entity.PasswordUser, error)

func (*UserRepository) GetAllMatrixUsers

func (r *UserRepository) GetAllMatrixUsers(ctx context.Context) ([]entity.MatrixUser, error)

func (*UserRepository) GetAllPasswordUsers

func (r *UserRepository) GetAllPasswordUsers(ctx context.Context) ([]entity.PasswordUser, error)

func (*UserRepository) GetAllSSHUsers

func (r *UserRepository) GetAllSSHUsers(ctx context.Context) ([]entity.SSHUser, error)

func (*UserRepository) GetAllUsers

func (r *UserRepository) GetAllUsers(ctx context.Context) ([]entity.User, error)

func (*UserRepository) GetMatrixUser

func (r *UserRepository) GetMatrixUser(ctx context.Context, matrixUserUUID *uuid.UUID) (*entity.MatrixUser, error)

func (*UserRepository) GetMatrixUserByUsername

func (r *UserRepository) GetMatrixUserByUsername(ctx context.Context, username string) (*entity.MatrixUser, error)

func (*UserRepository) GetPasswordUser

func (r *UserRepository) GetPasswordUser(ctx context.Context, passwordUserUUID *uuid.UUID) (*entity.PasswordUser, error)

func (*UserRepository) GetSSHUser

func (r *UserRepository) GetSSHUser(ctx context.Context, sshUserUUID *uuid.UUID) (*entity.SSHUser, error)

func (*UserRepository) GetSSHUserByPublicKey

func (r *UserRepository) GetSSHUserByPublicKey(ctx context.Context, publicKey string) (*entity.SSHUser, error)

func (*UserRepository) GetUser

func (r *UserRepository) GetUser(ctx context.Context, userUUID *uuid.UUID) (*entity.User, error)

func (*UserRepository) GetUserByName

func (r *UserRepository) GetUserByName(ctx context.Context, name string) (*entity.User, error)

func (*UserRepository) RegisterMatrixUser

func (r *UserRepository) RegisterMatrixUser(ctx context.Context, username string) (*entity.User, error)

func (*UserRepository) SetPublicKey

func (r *UserRepository) SetPublicKey(ctx context.Context, userUUID *uuid.UUID, publicKey string) error

func (*UserRepository) UpdateMatrixUser

func (r *UserRepository) UpdateMatrixUser(
	ctx context.Context,
	matrixUserUUID *uuid.UUID,
	matrixUser *entity.MatrixUser,
) (*entity.MatrixUser, error)

func (*UserRepository) UpdatePasswordUser

func (r *UserRepository) UpdatePasswordUser(
	ctx context.Context,
	passwordUserUUID *uuid.UUID,
	passwordUser *entity.PasswordUser,
) (*entity.PasswordUser, error)

func (*UserRepository) UpdateSSHUser

func (r *UserRepository) UpdateSSHUser(ctx context.Context, sshUserUUID *uuid.UUID, sshUser *entity.SSHUser) (*entity.SSHUser, error)

func (*UserRepository) UpdateUser

func (r *UserRepository) UpdateUser(ctx context.Context, userUUID *uuid.UUID, user *entity.User) (*entity.User, error)

Jump to

Keyboard shortcuts

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