Documentation ¶
Index ¶
- Constants
- type Customer
- func (customerService Customer) CreateCustomer(ctx context.Context, customer model.Customer) (*model.Customer, error)
- func (customerService Customer) DeleteCustomer(ctx context.Context, customer model.Customer) error
- func (customerService Customer) FindCustomerByID(ctx context.Context, customerID uint) (*model.Customer, error)
- func (customerService Customer) FindCustomerByUserName(ctx context.Context, userName string) (*model.Customer, error)
- func (customerService Customer) FindCustomerByVetOrg(ctx context.Context, vetOrg model.VetOrg) ([]model.Customer, error)
- func (customerService Customer) Login(ctx context.Context, userName string, password string) (*model.Customer, error)
- func (customerService Customer) UpdateCustomer(ctx context.Context, customer model.Customer) (*model.Customer, error)
- func (customerService Customer) UpdatePassword(ctx context.Context, customer model.Customer, password string) (*model.Customer, error)
- type CustomerRepo
- type DiagnosticReportRepo
- type DiagnosticRequestRepo
- type User
- func (userService User) CreateUser(ctx context.Context, user model.User) (*model.User, error)
- func (userService User) DeleteUser(ctx context.Context, user model.User) error
- func (userService User) FindUserByID(ctx context.Context, userID uint) (*model.User, error)
- func (userService User) FindUserByUserName(ctx context.Context, userName string) (*model.User, error)
- func (userService User) Login(ctx context.Context, userName string, password string) (*model.User, error)
- func (userService User) UpdatePassword(ctx context.Context, user model.User, password string) (*model.User, error)
- func (userService User) UpdateUser(ctx context.Context, user model.User) (*model.User, error)
- type UserRepo
- type VetOrg
- func (vetOrgService VetOrg) AddCustomerToVetOrg(ctx context.Context, user model.Customer, vetOrg model.VetOrg) (*model.Customer, error)
- func (vetOrgService VetOrg) CreateVetOrg(ctx context.Context, vetOrg model.VetOrg) (*model.VetOrg, error)
- func (vetOrgService VetOrg) DeleteVetOrg(ctx context.Context, vetOrg model.VetOrg) error
- func (vetOrgService VetOrg) FindVetOrgByID(ctx context.Context, orgID uint) (*model.VetOrg, error)
- func (vetOrgService VetOrg) FindVetOrgByName(ctx context.Context, orgName string) ([]model.VetOrg, error)
- func (vetOrgService VetOrg) RemoveCustomerFromVetOrg(ctx context.Context, user model.Customer, vetOrg model.VetOrg) (*model.Customer, error)
- func (vetOrgService VetOrg) UpdateVetOrg(ctx context.Context, vetOrg model.VetOrg) (*model.VetOrg, error)
- type VetOrgRepo
Constants ¶
const ( MissingContext = "context is required" PasswordTooShort = "password should be at least 8 characters" HashingFailed = "failed to salt and hash password: %s" UserOrPasswordFail = "user or password mismatch" VetOrgRequired = "vetOrg ID is required" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Customer ¶
type Customer struct {
CustomerRepo CustomerRepo
}
Customer implements the api.CustomerService interface
func (Customer) CreateCustomer ¶
func (customerService Customer) CreateCustomer(ctx context.Context, customer model.Customer) (*model.Customer, error)
CreateCustomer creates a new model.Customer in the vetlab system The assumption is that for a new customer, the password has not been encrypted up until this point so this is done before storing it in the repository.
func (Customer) DeleteCustomer ¶
DeleteCustomer deletes a model.Customer from the vetlab system
func (Customer) FindCustomerByID ¶
func (customerService Customer) FindCustomerByID(ctx context.Context, customerID uint) (*model.Customer, error)
FindCustomerByID finds customers by their unique ID
func (Customer) FindCustomerByUserName ¶
func (customerService Customer) FindCustomerByUserName(ctx context.Context, userName string) (*model.Customer, error)
FindCustomerByUserName attempts to find customers by their userName
func (Customer) FindCustomerByVetOrg ¶
func (customerService Customer) FindCustomerByVetOrg(ctx context.Context, vetOrg model.VetOrg) ([]model.Customer, error)
FindCustomerByVetOrg attempts to find customers by the VetOrg they belong to
func (Customer) Login ¶
func (customerService Customer) Login(ctx context.Context, userName string, password string) (*model.Customer, error)
Login tries to log in a customer into the vetlab system
func (Customer) UpdateCustomer ¶
func (customerService Customer) UpdateCustomer(ctx context.Context, customer model.Customer) (*model.Customer, error)
UpdateCustomer updates a model.Customer in the vetlab system
func (Customer) UpdatePassword ¶
func (customerService Customer) UpdatePassword(ctx context.Context, customer model.Customer, password string) (*model.Customer, error)
UpdatePassword allows for the change of a customer password We do not check the old password when changing to a new one since we assume the customer has been authenticated
type CustomerRepo ¶
type CustomerRepo interface { Create(*model.Customer) error Update(*model.Customer) error Delete(*model.Customer) error GetByID(uint) (*model.Customer, error) GetByVetOrgID(uint) ([]model.Customer, error) GetByUserName(string) (*model.Customer, error) }
CustomerRepo declares the persistence interface for the Customer struct
type DiagnosticReportRepo ¶
type DiagnosticReportRepo interface { Create(*model.DiagnosticReport) error Update(*model.DiagnosticReport) error Delete(report *model.DiagnosticReport) error GetByID(uint) (*model.DiagnosticReport, error) GetByVetOrgID(uint) ([]model.DiagnosticReport, error) GetByUserID(uint) ([]model.DiagnosticReport, error) GetByCustomerID(uint) ([]model.DiagnosticReport, error) }
DiagnosticReportRepo describes the persistence interface for a veterinary lab report
type DiagnosticRequestRepo ¶
type DiagnosticRequestRepo interface { Create(*model.DiagnosticRequest) error Update(*model.DiagnosticRequest) error Delete(*model.DiagnosticRequest) error GetByID(uint) (*model.DiagnosticRequest, error) GetByVetOrgID(uint) ([]model.DiagnosticRequest, error) GetByUserID(uint) ([]model.DiagnosticRequest, error) GetByCustomerID(uint) ([]model.DiagnosticRequest, error) }
DiagnosticRequestRepo describes the persistence interface for diagnostic requests
type User ¶
type User struct {
UserRepo UserRepo
}
User implements the api.UserService interface
func (User) CreateUser ¶
CreateUser creates a new model.User in the vetlab system The assumption is that for a new user, the password has not been encrypted up until this point so this is done before storing it in the repository.
func (User) DeleteUser ¶
DeleteUser delets a model.User from the vetlab system
func (User) FindUserByID ¶
FindUserByID finds users by their unique ID
func (User) FindUserByUserName ¶
func (userService User) FindUserByUserName(ctx context.Context, userName string) (*model.User, error)
FindUserByUserName attempts to find users by their userName
func (User) Login ¶
func (userService User) Login(ctx context.Context, userName string, password string) (*model.User, error)
Login tries to login a user into the vetlab system
func (User) UpdatePassword ¶
func (userService User) UpdatePassword(ctx context.Context, user model.User, password string) (*model.User, error)
UpdatePassword allows for the change of a user password We do not check the old password when changing to a new one since we assume the user has been authenticated
type UserRepo ¶
type UserRepo interface { Create(*model.User) error Update(*model.User) error Delete(*model.User) error GetByID(uint) (*model.User, error) GetByUserName(string) (*model.User, error) }
UserRepo declares the persistence interface for the User struct
type VetOrg ¶
type VetOrg struct {
VetOrgRepo VetOrgRepo
}
VetOrg implements the api.VetOrgService interface