Documentation
¶
Index ¶
- Constants
- func CompanyMiddleware(repo data.CompanyRepoer) echo.MiddlewareFunc
- func RegisterWebRoutes(g *echo.Group, repos *WebRepos, authSvc *service.AuthService, a *auth.Auth, ...)
- func RequireAuthMiddleware() echo.MiddlewareFunc
- func RequireRoleMiddleware(minimum auth.UserRole) echo.MiddlewareFunc
- type AuthHandler
- type ChangelogHandler
- type CustomerHandler
- type DashboardHandler
- type DiscountHandler
- type FinanceHandler
- type InventoryHandler
- type OrdersHandler
- type POSHandler
- type ProductHandler
- type ReportsHandler
- type SetupHandler
- type SupplierHandler
- type WebRepos
- type WebUserHandler
Constants ¶
const AuthCookieName = "auth"
AuthCookieName is the name of the HTTP cookie used to carry the access token for HTML routes. Exported so core/app.go can reference it when wiring the cookie-based JWT middleware onto the web route group.
Variables ¶
This section is empty.
Functions ¶
func CompanyMiddleware ¶
func CompanyMiddleware(repo data.CompanyRepoer) echo.MiddlewareFunc
CompanyMiddleware resolves the /@:handle URL segment to a Company, verifies that the authenticated user has access, and injects the company (and for owners, their full company list) into the Echo context.
func RegisterWebRoutes ¶
func RegisterWebRoutes( g *echo.Group, repos *WebRepos, authSvc *service.AuthService, a *auth.Auth, cfg *config.Config, )
RegisterWebRoutes mounts all HTML routes onto the given Echo group.
func RequireAuthMiddleware ¶
func RequireAuthMiddleware() echo.MiddlewareFunc
RequireAuthMiddleware redirects unauthenticated requests to /login.
func RequireRoleMiddleware ¶
func RequireRoleMiddleware(minimum auth.UserRole) echo.MiddlewareFunc
RequireRoleMiddleware renders a 403 error page if the authenticated user's role is below minimum. Also redirects unauthenticated requests to /login.
Types ¶
type AuthHandler ¶
type AuthHandler struct {
// contains filtered or unexported fields
}
AuthHandler handles HTML authentication routes.
func NewAuthHandler ¶
func NewAuthHandler(svc *service.AuthService) *AuthHandler
NewAuthHandler creates a new AuthHandler.
type ChangelogHandler ¶ added in v0.1.2
type ChangelogHandler struct{}
func NewChangelogHandler ¶ added in v0.1.2
func NewChangelogHandler() *ChangelogHandler
type CustomerHandler ¶
type CustomerHandler struct {
// contains filtered or unexported fields
}
func NewCustomerHandler ¶
func NewCustomerHandler(repos *WebRepos) *CustomerHandler
type DashboardHandler ¶
type DashboardHandler struct {
// contains filtered or unexported fields
}
func NewDashboardHandler ¶
func NewDashboardHandler( reportsRepo data.ReportsQuerier, orderRepo data.OrderRepoer, branchRepo data.BranchRepoer, stationRepo data.POSStationRepoer, userRepo data.UserRepoer, productRepo data.ProductRepoer, ) *DashboardHandler
type DiscountHandler ¶
type DiscountHandler struct {
// contains filtered or unexported fields
}
func NewDiscountHandler ¶
func NewDiscountHandler(repos *WebRepos) *DiscountHandler
type FinanceHandler ¶
type FinanceHandler struct {
// contains filtered or unexported fields
}
func NewFinanceHandler ¶
func NewFinanceHandler(repos *WebRepos) *FinanceHandler
type InventoryHandler ¶
type InventoryHandler struct {
// contains filtered or unexported fields
}
func NewInventoryHandler ¶
func NewInventoryHandler(repos *WebRepos) *InventoryHandler
type OrdersHandler ¶
type OrdersHandler struct {
// contains filtered or unexported fields
}
func NewOrdersHandler ¶
func NewOrdersHandler(repos *WebRepos) *OrdersHandler
type POSHandler ¶
type POSHandler struct {
// contains filtered or unexported fields
}
func NewPOSHandler ¶
func NewPOSHandler(repos *WebRepos) *POSHandler
type ProductHandler ¶
type ProductHandler struct {
// contains filtered or unexported fields
}
func NewProductHandler ¶
func NewProductHandler(repos *WebRepos, a *auth.Auth) *ProductHandler
type ReportsHandler ¶
type ReportsHandler struct {
// contains filtered or unexported fields
}
func NewReportsHandler ¶
func NewReportsHandler(repos *WebRepos) *ReportsHandler
type SetupHandler ¶
type SetupHandler struct {
// contains filtered or unexported fields
}
func NewSetupHandler ¶
func NewSetupHandler(repos *WebRepos, a *auth.Auth) *SetupHandler
type SupplierHandler ¶
type SupplierHandler struct {
// contains filtered or unexported fields
}
func NewSupplierHandler ¶
func NewSupplierHandler(repos *WebRepos) *SupplierHandler
type WebRepos ¶
type WebRepos struct {
UserRepo data.UserRepoer
ReportsRepo data.ReportsQuerier
OrderRepo data.OrderRepoer
SessionRepo data.SessionRepoer
StationRepo data.POSStationRepoer
ProductRepo data.ProductRepoer
DiscountRepo data.DiscountRepoer
InventoryRepo data.InventoryRepoer
ExpenseRepo data.ExpenseRepoer
CompanyRepo data.CompanyRepoer
BranchRepo data.BranchRepoer
CustomerRepo data.CustomerRepoer
SupplierRepo data.SupplierRepoer
SupplierPaymentRepo data.SupplierPaymentRepoer
FileRepo data.FileRepoer
FileStorage data.FileStorage
FileAccessTTL time.Duration
IsDemo bool
}
WebRepos holds the repo implementations for the HTML layer.
type WebUserHandler ¶
type WebUserHandler struct {
// contains filtered or unexported fields
}
WebUserHandler renders HTML pages for user management, scoped to the company resolved from the /@:handle URL segment (see companyFromContext).
func NewWebUserHandler ¶
func NewWebUserHandler(svc *service.UserService) *WebUserHandler
NewWebUserHandler creates a new WebUserHandler.
Source Files
¶
- auth_handler.go
- changelog_handler.go
- context.go
- customer_handler.go
- dashboard_handler.go
- discount_handler.go
- entry.go
- errors.go
- finance_handler.go
- inventory_handler.go
- middleware.go
- onboarding.go
- orders_handler.go
- pagination.go
- pos_handler.go
- product_handler.go
- reports_handler.go
- setup_handler.go
- supplier_handler.go
- user_handler.go