Add refund order

This commit is contained in:
aditya.siregar
2025-06-14 21:17:13 +07:00
parent 58d3b32c40
commit ebb33186b8
42 changed files with 1152 additions and 2094 deletions
+18
View File
@@ -0,0 +1,18 @@
package request
import "enaklo-pos-be/internal/entity"
type OpenCashierSessionRequest struct {
OpeningAmount float64 `json:"opening_amount" validate:"required,gt=0"`
}
type CloseCashierSessionRequest struct {
ClosingAmount float64 `json:"closing_amount" validate:"required"`
}
func (o *OpenCashierSessionRequest) ToEntity(cashierID int64) *entity.CashierSession {
return &entity.CashierSession{
CashierID: cashierID,
OpeningAmount: o.OpeningAmount,
}
}
+14
View File
@@ -0,0 +1,14 @@
package request
import "enaklo-pos-be/internal/entity"
type CategoryRequest struct {
Name string `json:"name" binding:"required"`
}
func (r *CategoryRequest) ToEntity(partnerID int64) *entity.Category {
return &entity.Category{
PartnerID: partnerID,
Name: r.Name,
}
}
+19 -15
View File
@@ -6,24 +6,26 @@ import (
)
type ProductParam struct {
Search string `form:"search" json:"search" example:"Nasi Goreng"`
Name string `form:"name" json:"name" example:"Nasi Goreng"`
Type product.ProductType `form:"type" json:"type" example:"FOOD/BEVERAGE"`
BranchID int64 `form:"branch_id" json:"branch_id" example:"1"`
Available product.ProductStock `form:"available" json:"available" example:"1" example:"AVAILABLE/UNAVAILABLE"`
Limit int `form:"limit" json:"limit" example:"10"`
Offset int `form:"offset" json:"offset" example:"0"`
Search string `form:"search" json:"search" example:"Nasi Goreng"`
Name string `form:"name" json:"name" example:"Nasi Goreng"`
Type product.ProductType `form:"type" json:"type" example:"FOOD/BEVERAGE"`
BranchID int64 `form:"branch_id" json:"branch_id" example:"1"`
Available product.ProductStock `form:"available" json:"available" example:"1" example:"AVAILABLE/UNAVAILABLE"`
Limit int `form:"limit" json:"limit" example:"10"`
Offset int `form:"offset" json:"offset" example:"0"`
CategoryID int64 `form:"category_id" json:"category_id" example:"1"`
}
func (p *ProductParam) ToEntity() entity.ProductSearch {
func (p *ProductParam) ToEntity(partnerID int64) entity.ProductSearch {
return entity.ProductSearch{
Search: p.Search,
Name: p.Name,
Type: p.Type,
BranchID: p.BranchID,
Available: p.Available,
Limit: p.Limit,
Offset: p.Offset,
Search: p.Search,
Name: p.Name,
Type: p.Type,
PartnerID: partnerID,
Available: p.Available,
Limit: p.Limit,
Offset: p.Offset,
CategoryID: p.CategoryID,
}
}
@@ -40,6 +42,7 @@ type Product struct {
Description string `json:"description"`
Stock int64 `json:"stock"`
Image string `json:"image"`
CategoryID int64 `json:"category_id"`
}
func (e *Product) ToEntity() *entity.Product {
@@ -51,5 +54,6 @@ func (e *Product) ToEntity() *entity.Product {
Description: e.Description,
PartnerID: e.PartnerID,
Image: e.Image,
CategoryID: &e.CategoryID,
}
}