handlers

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPage

func AddPage(c fiber.Ctx) error

AddPage creates a new page.

@Summary Create page @Description Create a new page with name, slug, and optional content @Tags Pages @Security BearerAuth @Accept json @Produce json @Param request body models.Page true "Page data" @Success 200 {object} webutil.HTTPResponse{result=models.Page} "Created page" @Failure 400 {object} webutil.HTTPResponse "Validation error" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/pages [post]

func AddProduct

func AddProduct(c fiber.Ctx) error

AddProduct creates a new product.

@Summary Create product @Description Create a new product with name, slug, price, and digital type @Tags Products @Security BearerAuth @Accept json @Produce json @Param request body models.Product true "Product data" @Success 200 {object} webutil.HTTPResponse{result=models.Product} "Created product" @Failure 400 {object} webutil.HTTPResponse "Validation error" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/products [post]

func AddProductDigital

func AddProductDigital(c fiber.Ctx) error

AddProductDigital adds digital content (file or data) to a product.

@Summary Add product digital content @Description Upload a digital file or create a license key entry @Tags Products @Security BearerAuth @Accept multipart/form-data @Produce json @Param product_id path string true "Product ID" @Param document formData file false "Digital file" @Success 200 {object} webutil.HTTPResponse "Digital content added" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/products/{product_id}/digital [post]

func AddProductImage

func AddProductImage(c fiber.Ctx) error

AddProductImage uploads and adds an image to a product.

@Summary Upload product image @Description Upload an image (PNG/JPEG) and create sm (147x147) and md (400x400) variants @Tags Products @Security BearerAuth @Accept multipart/form-data @Produce json @Param product_id path string true "Product ID" @Param document formData file true "Image file (PNG or JPEG)" @Success 200 {object} webutil.HTTPResponse{result=models.File} "Added image" @Failure 400 {object} webutil.HTTPResponse "Invalid file format" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/products/{product_id}/image [post]

func Cart

func Cart(c fiber.Ctx) error

Cart returns detailed cart information by cart_id.

@Summary Get cart @Description Get detailed cart information including product items @Tags Carts @Security BearerAuth @Produce json @Param cart_id path string true "Cart ID" @Success 200 {object} webutil.HTTPResponse "Cart details" @Failure 400 {object} webutil.HTTPResponse "Missing cart_id" @Failure 404 {object} webutil.HTTPResponse "Cart not found" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/carts/{cart_id} [get]

func CartSendMail

func CartSendMail(c fiber.Ctx) error

CartSendMail sends an email notification for a cart.

@Summary Send cart email @Description Re-send purchase confirmation email for a cart @Tags Carts @Security BearerAuth @Produce json @Param cart_id path string true "Cart ID" @Success 200 {object} webutil.HTTPResponse "Email sent" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/carts/{cart_id}/mail [post]

func Carts

func Carts(c fiber.Ctx) error

Carts returns a list of all carts.

@Summary List carts @Description Get paginated list of all carts @Tags Carts @Security BearerAuth @Produce json @Param page query int false "Page number" default(1) @Param limit query int false "Items per page" default(20) @Success 200 {object} webutil.HTTPResponse "Carts list with pagination" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/carts [get]

func DeletePage

func DeletePage(c fiber.Ctx) error

DeletePage deletes a page by ID.

@Summary Delete page @Description Delete a page by its ID @Tags Pages @Security BearerAuth @Produce json @Param page_id path string true "Page ID" @Success 200 {object} webutil.HTTPResponse "Page deleted" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/pages/{page_id} [delete]

func DeleteProduct

func DeleteProduct(c fiber.Ctx) error

DeleteProduct deletes a product by ID.

@Summary Delete product @Description Delete a product by its ID @Tags Products @Security BearerAuth @Produce json @Param product_id path string true "Product ID" @Success 200 {object} webutil.HTTPResponse "Product deleted" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/products/{product_id} [delete]

func DeleteProductDigital

func DeleteProductDigital(c fiber.Ctx) error

DeleteProductDigital deletes digital content from a product.

@Summary Delete product digital content @Description Delete a digital content entry by product and digital ID @Tags Products @Security BearerAuth @Produce json @Param product_id path string true "Product ID" @Param digital_id path string true "Digital ID" @Success 200 {object} webutil.HTTPResponse "Digital content deleted" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/products/{product_id}/digital/{digital_id} [delete]

func DeleteProductImage

func DeleteProductImage(c fiber.Ctx) error

DeleteProductImage deletes an image from a product.

@Summary Delete product image @Description Delete a product image by product and image ID @Tags Products @Security BearerAuth @Produce json @Param product_id path string true "Product ID" @Param image_id path string true "Image ID" @Success 200 {object} webutil.HTTPResponse "Image deleted" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/products/{product_id}/image/{image_id} [delete]

func DownloadProductDigital added in v0.2.10

func DownloadProductDigital(c fiber.Ctx) error

DownloadProductDigital streams a digital file to an authenticated admin. Replaces the former public /secrets static mount.

@Summary Download digital file @Description Stream a product digital file as an attachment @Tags Products @Security BearerAuth @Param product_id path string true "Product ID" @Param digital_id path string true "Digital file ID" @Success 200 {file} file "File content" @Failure 404 {object} webutil.HTTPResponse "File not found" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/products/{product_id}/digital/{digital_id}/download [get]

func ExportProducts added in v0.2.10

func ExportProducts(c fiber.Ctx) error

ExportProducts exports products to CSV

@Summary Export products to CSV @Description Download all products as CSV file @Tags Products @Security BearerAuth @Produce text/csv @Success 200 {file} file "CSV file" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/products/export [get]

func GenerateSlug added in v0.2.10

func GenerateSlug(c fiber.Ctx) error

GenerateSlug generates a unique slug from product name

@Summary Generate product slug @Description Generate URL-friendly slug from product name with uniqueness check @Tags Products @Security BearerAuth @Accept json @Produce json @Param request body object{name=string,exclude_id=string} true "Slug generation request" @Success 200 {object} webutil.HTTPResponse{result=object{slug=string}} "Generated slug" @Failure 400 {object} webutil.HTTPResponse "Validation error" @Router /api/_/products/slug/generate [post]

func GetPage

func GetPage(c fiber.Ctx) error

GetPage returns a single page by ID.

@Summary Get page @Description Get a single page by its ID @Tags Pages @Security BearerAuth @Produce json @Param page_id path string true "Page ID" @Success 200 {object} webutil.HTTPResponse{result=models.Page} "Page details" @Failure 404 {object} webutil.HTTPResponse "Page not found" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/pages/{page_id} [get]

func GetSetting

func GetSetting(c fiber.Ctx) error

GetSetting returns a setting value by key.

@Summary Get setting @Description Get a setting group or individual setting by key @Tags Settings @Security BearerAuth @Produce json @Param setting_key path string true "Setting key (main, social, auth, jwt, webhook, payment, stripe, paypal, spectrocoin, coinbase, dummy, mail, or custom key)" @Success 200 {object} webutil.HTTPResponse "Setting value" @Failure 404 {object} webutil.HTTPResponse "Setting not found" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/settings/{setting_key} [get]

func ImportPreview added in v0.2.10

func ImportPreview(c fiber.Ctx) error

ImportPreview validates and previews CSV import without executing

@Summary Preview CSV import @Description Validate CSV file and preview what will be imported @Tags Products @Security BearerAuth @Accept multipart/form-data @Produce json @Param file formData file true "CSV file" @Success 200 {object} webutil.HTTPResponse{result=csvimport.ImportResult} "Preview results" @Failure 400 {object} webutil.HTTPResponse "Validation error" @Router /api/_/products/import/preview [post]

func ImportProducts added in v0.2.10

func ImportProducts(c fiber.Ctx) error

ImportProducts executes CSV import

@Summary Import products from CSV @Description Execute CSV import after preview validation @Tags Products @Security BearerAuth @Accept multipart/form-data @Produce json @Param file formData file true "CSV file" @Success 200 {object} webutil.HTTPResponse{result=csvimport.ImportResult} "Import results" @Failure 400 {object} webutil.HTTPResponse "Validation error" @Router /api/_/products/import [post]

func Install

func Install(c fiber.Ctx) error

Install performs the initial installation of the application.

@Summary Install application @Description Perform initial setup with admin credentials and domain @Tags Install @Accept json @Produce json @Param request body models.Install true "Installation data" @Success 200 {object} webutil.HTTPResponse "Cart installed" @Failure 400 {object} webutil.HTTPResponse "Validation error" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/install [post]

func InstallStatus added in v0.2.8

func InstallStatus(c fiber.Ctx) error

InstallStatus reports whether first-time setup has been completed.

@Summary Installation status @Description Returns whether the cart has been installed @Tags Install @Produce json @Success 200 {object} webutil.HTTPResponse{result=installStatus} @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/install/status [get]

func Pages

func Pages(c fiber.Ctx) error

Pages returns a list of all pages.

@Summary List pages @Description Get paginated list of all pages (including inactive) @Tags Pages @Security BearerAuth @Produce json @Param page query int false "Page number" default(1) @Param limit query int false "Items per page" default(20) @Success 200 {object} webutil.HTTPResponse "Pages list with pagination" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/pages [get]

func Product

func Product(c fiber.Ctx) error

Product returns a single product by ID.

@Summary Get product @Description Get a single product by its ID (including inactive) @Tags Products @Security BearerAuth @Produce json @Param product_id path string true "Product ID" @Success 200 {object} webutil.HTTPResponse{result=models.Product} "Product details" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/products/{product_id} [get]

func ProductDigital

func ProductDigital(c fiber.Ctx) error

ProductDigital returns digital content for a product.

@Summary Get product digital content @Description Get digital files or license keys for a product @Tags Products @Security BearerAuth @Produce json @Param product_id path string true "Product ID" @Success 200 {object} webutil.HTTPResponse{result=models.Digital} "Digital content" @Failure 404 {object} webutil.HTTPResponse "Product not found" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/products/{product_id}/digital [get]

func ProductImages

func ProductImages(c fiber.Ctx) error

ProductImages returns a list of images for a product.

@Summary List product images @Description Get all images for a product @Tags Products @Security BearerAuth @Produce json @Param product_id path string true "Product ID" @Success 200 {object} webutil.HTTPResponse{result=[]models.File} "Product images" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/products/{product_id}/image [get]

func Products

func Products(c fiber.Ctx) error

Products returns a list of all products.

@Summary List products @Description Get paginated list of all products (including inactive) @Tags Products @Security BearerAuth @Produce json @Param page query int false "Page number" default(1) @Param limit query int false "Items per page" default(20) @Success 200 {object} webutil.HTTPResponse{result=models.Products} "Products list" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/products [get]

func SignIn

func SignIn(c fiber.Ctx) error

func SignOut

func SignOut(c fiber.Ctx) error

SignOut invalidates the user session and clears the authentication token.

@Summary Sign out @Description Invalidate current session and clear token cookie @Tags Auth @Security BearerAuth @Success 204 "Session invalidated" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/sign/out [post]

func TestLetter

func TestLetter(c fiber.Ctx) error

TestLetter sends a test email letter.

@Summary Send test letter @Description Send a test email using configured SMTP settings @Tags Settings @Security BearerAuth @Produce json @Param letter_name path string true "Letter template name" @Success 200 {object} webutil.HTTPResponse{result=string} "Message sent" @Failure 400 {object} webutil.HTTPResponse "Sending failed" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/test/letter/{letter_name} [get]

func UpdatePage

func UpdatePage(c fiber.Ctx) error

UpdatePage updates an existing page.

@Summary Update page @Description Update page metadata (name, slug, position, SEO) @Tags Pages @Security BearerAuth @Accept json @Produce json @Param page_id path string true "Page ID" @Param request body models.Page true "Page data" @Success 200 {object} webutil.HTTPResponse "Page updated" @Failure 400 {object} webutil.HTTPResponse "Validation error" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/pages/{page_id} [patch]

func UpdatePageActive

func UpdatePageActive(c fiber.Ctx) error

UpdatePageActive updates the active status of a page.

@Summary Toggle page active @Description Toggle the active/inactive status of a page @Tags Pages @Security BearerAuth @Produce json @Param page_id path string true "Page ID" @Success 200 {object} webutil.HTTPResponse{result=models.Page} "Updated page" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/pages/{page_id}/active [patch]

func UpdatePageContent

func UpdatePageContent(c fiber.Ctx) error

UpdatePageContent updates the content of a page.

@Summary Update page content @Description Update only the HTML content of a page @Tags Pages @Security BearerAuth @Accept json @Produce json @Param page_id path string true "Page ID" @Param request body object{content=string} true "Content" @Success 200 {object} webutil.HTTPResponse "Content updated" @Failure 400 {object} webutil.HTTPResponse "Validation error" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/pages/{page_id}/content [patch]

func UpdateProduct

func UpdateProduct(c fiber.Ctx) error

UpdateProduct updates an existing product.

@Summary Update product @Description Update product metadata and return the updated product @Tags Products @Security BearerAuth @Accept json @Produce json @Param product_id path string true "Product ID" @Param request body models.Product true "Product data" @Success 200 {object} webutil.HTTPResponse{result=models.Product} "Updated product" @Failure 400 {object} webutil.HTTPResponse "Validation error" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/products/{product_id} [patch]

func UpdateProductActive

func UpdateProductActive(c fiber.Ctx) error

UpdateProductActive updates the active status of a product.

@Summary Toggle product active @Description Toggle the active/inactive status of a product @Tags Products @Security BearerAuth @Produce json @Param product_id path string true "Product ID" @Success 200 {object} webutil.HTTPResponse "Product active updated" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/products/{product_id}/active [patch]

func UpdateProductDigital

func UpdateProductDigital(c fiber.Ctx) error

UpdateProductDigital updates digital content for a product.

@Summary Update product digital content @Description Update the content of a digital data entry (license key) @Tags Products @Security BearerAuth @Accept json @Produce json @Param product_id path string true "Product ID" @Param digital_id path string true "Digital ID" @Param request body models.Data true "Digital data" @Success 200 {object} webutil.HTTPResponse "Digital content updated" @Failure 400 {object} webutil.HTTPResponse "Validation error" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/products/{product_id}/digital/{digital_id} [patch]

func UpdateSetting

func UpdateSetting(c fiber.Ctx) error

UpdateSetting updates a setting value by key.

@Summary Update setting @Description Update a setting group or individual setting by key @Tags Settings @Security BearerAuth @Accept json @Produce json @Param setting_key path string true "Setting key" @Param request body object true "Setting value (structure depends on key)" @Success 200 {object} webutil.HTTPResponse "Setting updated" @Failure 400 {object} webutil.HTTPResponse "Validation error" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/settings/{setting_key} [patch]

func Version

func Version(c fiber.Ctx) error

Version returns the current application version and update information.

@Summary Get version @Description Get current app version and available updates (cached 24h) @Tags Settings @Security BearerAuth @Produce json @Success 200 {object} webutil.HTTPResponse "Version info" @Failure 500 {object} webutil.HTTPResponse "Internal server error" @Router /api/_/version [get]

Types

This section is empty.

Jump to

Keyboard shortcuts

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