v0.30: product pages, categories, sale prices and order status timeline
This commit is contained in:
+8
-2
@@ -34,6 +34,7 @@ func main() {
|
||||
}
|
||||
|
||||
productRepo := repository.NewProductRepository(pool)
|
||||
categoryRepo := repository.NewCategoryRepository(pool)
|
||||
adminRepo := repository.NewAdminRepository(pool)
|
||||
statsRepo := repository.NewStatsRepository(pool)
|
||||
userRepo := repository.NewUserRepository(pool)
|
||||
@@ -62,10 +63,10 @@ func main() {
|
||||
cartSession := auth.NewSession(cfg.SessionSecret, "shop_cart_key", "/")
|
||||
|
||||
customer := handlers.NewCustomerHandler(
|
||||
productRepo, userRepo, cartRepo, orderRepo, statsRepo,
|
||||
productRepo, categoryRepo, userRepo, cartRepo, orderRepo, statsRepo,
|
||||
userSession, cartSession, tmpl,
|
||||
)
|
||||
admin := handlers.NewAdminHandler(adminRepo, productRepo, statsRepo, storage, adminSession, tmpl)
|
||||
admin := handlers.NewAdminHandler(adminRepo, productRepo, categoryRepo, statsRepo, storage, adminSession, tmpl)
|
||||
|
||||
mux := http.NewServeMux()
|
||||
mux.Handle("GET /static/", http.StripPrefix("/static/", handlers.StaticHandler()))
|
||||
@@ -73,6 +74,8 @@ func main() {
|
||||
mux.HandleFunc("GET /health", customer.Health)
|
||||
|
||||
mux.HandleFunc("GET /{$}", customer.Home)
|
||||
mux.HandleFunc("GET /product/{id}", customer.ProductPage)
|
||||
mux.HandleFunc("GET /category/{slug}", customer.CategoryPage)
|
||||
mux.HandleFunc("GET /register", customer.RegisterPage)
|
||||
mux.HandleFunc("POST /register", customer.Register)
|
||||
mux.HandleFunc("GET /login", customer.LoginPage)
|
||||
@@ -97,6 +100,9 @@ func main() {
|
||||
mux.HandleFunc("GET /admin/products/{id}/edit", admin.ProductEdit)
|
||||
mux.HandleFunc("POST /admin/products/{id}/delete", admin.ProductDelete)
|
||||
mux.HandleFunc("POST /admin/products/{id}/images/{imageId}/delete", admin.ImageDelete)
|
||||
mux.HandleFunc("GET /admin/categories", admin.CategoryList)
|
||||
mux.HandleFunc("POST /admin/categories", admin.CategoryCreate)
|
||||
mux.HandleFunc("POST /admin/categories/{id}/delete", admin.CategoryDelete)
|
||||
|
||||
addr := ":" + getEnv("APP_PORT", "8080")
|
||||
srv := &http.Server{
|
||||
|
||||
Reference in New Issue
Block a user