Documentation ¶
Index ¶
- type DbServiceImpl
- func (d *DbServiceImpl) AddProduct(ctx context.Context, product *domain.Product) (*domain.Product, error)
- func (d *DbServiceImpl) AddSaleRecord(ctx context.Context, sale *domain.Sale) (*domain.Sale, error)
- func (d *DbServiceImpl) GetDailySale(ctx context.Context) ([]*domain.Sale, error)
- func (d *DbServiceImpl) GetProductByID(ctx context.Context, id string) (*domain.Product, error)
- func (d *DbServiceImpl) GetUserPINByUserID(ctx context.Context, userID string, flavour enums.Flavour) (*domain.UserPIN, error)
- func (d *DbServiceImpl) GetUserProfileByPhoneNumber(ctx context.Context, phoneNumber string, flavour enums.Flavour) (*domain.User, error)
- func (d *DbServiceImpl) GetUserProfileByUserID(ctx context.Context, userID string) (*domain.User, error)
- func (d *DbServiceImpl) InvalidatePIN(ctx context.Context, userID string, flavour enums.Flavour) error
- func (d *DbServiceImpl) RegisterUser(ctx context.Context, user *domain.User, contact *domain.Contact) (*domain.User, error)
- func (d *DbServiceImpl) SaveOTP(ctx context.Context, otp *domain.OTP) (*domain.OTP, error)
- func (d *DbServiceImpl) SavePIN(ctx context.Context, pinInput *domain.UserPIN) (*domain.UserPIN, error)
- func (d *DbServiceImpl) SearchProduct(ctx context.Context, searchTerm string) (*domain.Product, error)
- func (d *DbServiceImpl) SearchUser(ctx context.Context, searchTerm string) ([]*domain.User, error)
- func (d *DbServiceImpl) UpdateProduct(ctx context.Context, product *domain.Product, ...) error
- func (d *DbServiceImpl) UpdateUser(ctx context.Context, user *domain.User, updateData map[string]interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DbServiceImpl ¶
type DbServiceImpl struct {
// contains filtered or unexported fields
}
DbServiceImpl is an implementation of the database repository It is implementation agnostic i.e logic should be handled using the preferred database
func NewDBService ¶
NewDBService creates a new database service
func (*DbServiceImpl) AddProduct ¶
func (d *DbServiceImpl) AddProduct(ctx context.Context, product *domain.Product) (*domain.Product, error)
Adds a product into the database
func (*DbServiceImpl) AddSaleRecord ¶
AddSaleRecord adds sale record in the database
func (*DbServiceImpl) GetDailySale ¶
GetDailySale retrieves daily sales
func (*DbServiceImpl) GetProductByID ¶
GetProductByID retrieves a product using its ID
func (*DbServiceImpl) GetUserPINByUserID ¶
func (d *DbServiceImpl) GetUserPINByUserID(ctx context.Context, userID string, flavour enums.Flavour) (*domain.UserPIN, error)
GetUserPINByUserID fetches and returns a user PIN using their user ID
func (*DbServiceImpl) GetUserProfileByPhoneNumber ¶
func (d *DbServiceImpl) GetUserProfileByPhoneNumber(ctx context.Context, phoneNumber string, flavour enums.Flavour) (*domain.User, error)
GetUserProfileByPhoneNumber fetches and returns a userprofile using their phone number
func (*DbServiceImpl) GetUserProfileByUserID ¶
func (d *DbServiceImpl) GetUserProfileByUserID(ctx context.Context, userID string) (*domain.User, error)
GetUserProfileByUserID fetches and returns a userprofile using their user ID
func (*DbServiceImpl) InvalidatePIN ¶
func (d *DbServiceImpl) InvalidatePIN(ctx context.Context, userID string, flavour enums.Flavour) error
InvalidatePIN invalidates a pin that is linked to the user profile. This is done by toggling the IsValid field to false
func (*DbServiceImpl) RegisterUser ¶
func (d *DbServiceImpl) RegisterUser(ctx context.Context, user *domain.User, contact *domain.Contact) (*domain.User, error)
RegisterUser registers a new user in the database
func (*DbServiceImpl) SavePIN ¶
func (d *DbServiceImpl) SavePIN(ctx context.Context, pinInput *domain.UserPIN) (*domain.UserPIN, error)
SavePIN saves a PIN in the database
func (*DbServiceImpl) SearchProduct ¶
func (d *DbServiceImpl) SearchProduct(ctx context.Context, searchTerm string) (*domain.Product, error)
SearchProduct searches a product using the term provided by the user
func (*DbServiceImpl) SearchUser ¶
SearchUser searches for users in the system using a search term
func (*DbServiceImpl) UpdateProduct ¶
func (d *DbServiceImpl) UpdateProduct(ctx context.Context, product *domain.Product, updateData map[string]interface{}) error
UpdateProduct updates product details in the database
func (*DbServiceImpl) UpdateUser ¶
func (d *DbServiceImpl) UpdateUser(ctx context.Context, user *domain.User, updateData map[string]interface{}) error
UpdateUser updates a user record