intial commit
This commit is contained in:
258
models/product.go
Normal file
258
models/product.go
Normal file
@@ -0,0 +1,258 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Products struct {
|
||||
Productid int `json:"productid"`
|
||||
AppLocationid int `json:"applocationid" gorm:"column:applocationid"`
|
||||
Tenantid *int `json:"tenantid,omitempty"`
|
||||
Categoryid int `json:"categoryid"`
|
||||
Categoryname string `json:"categoryname" gorm:"->"`
|
||||
Subcategoryid *int `json:"subcategoryid,omitempty"`
|
||||
Subcategoryname string `json:"Subcategoryname" gorm:"->"`
|
||||
Catalogueid *int `json:"catalogueid,omitempty"`
|
||||
Addonid *int `json:"addonid,omitempty"`
|
||||
Discountid *int `json:"discountid,omitempty"`
|
||||
Pricingid *int `json:"pricingid,omitempty"`
|
||||
Productname *string `json:"productname,omitempty"`
|
||||
Productimage *string `json:"productimage,omitempty"`
|
||||
Productdesc *string `json:"productdesc,omitempty"`
|
||||
Productsku *string `json:"productsku,omitempty"`
|
||||
Brandid *int `json:"brandid,omitempty"`
|
||||
Productbrand *string `json:"productbrand,omitempty"`
|
||||
Productunit *string `json:"productunit,omitempty"`
|
||||
Unitvalue *string `json:"unitvalue,omitempty"`
|
||||
Toppicks *string `json:"toppicks,omitempty"`
|
||||
Productcost *float64 `json:"productcost,omitempty"`
|
||||
Taxamount *float64 `json:"taxamount,omitempty"`
|
||||
Taxpercent *float64 `json:"taxpercent,omitempty"`
|
||||
Producttax *int `json:"producttax" gorm:"default:0"`
|
||||
Productstock *int `json:"productstock" gorm:"default:0"`
|
||||
Productcombo *int `json:"productcombo" gorm:"default:0"`
|
||||
Variants int `json:"variants" gorm:"default:0"`
|
||||
Quantity int `json:"quantity"`
|
||||
Retailprice float64 `json:"retailprice,omitempty"`
|
||||
Diffprice float64 `json:"diffprice,omitempty"`
|
||||
Diffpercent float64 `json:"diffpercent,omitempty"`
|
||||
Othercost float64 `json:"othercost,omitempty"`
|
||||
Approve *int `json:"approve" gorm:"default:0"`
|
||||
Productstatus string `json:"productstatus" gorm:"default:available"`
|
||||
}
|
||||
|
||||
type ProductCategory struct {
|
||||
Categoryid int `json:"categoryid"`
|
||||
Moduleid int `json:"moduleid"`
|
||||
Tenantid *int `json:"tenantid,omitempty"`
|
||||
Categorytypeid *int `json:"categorytypeid,omitempty"`
|
||||
Categoryname *string `json:"categoryname,omitempty"`
|
||||
Image *string `json:"image,omitempty"`
|
||||
Catalougecategoryid *int `json:"catalougecategoryid,omitempty"`
|
||||
Sortorder *int `json:"sortorder,omitempty"`
|
||||
Status string `json:"status"`
|
||||
Createdby *int `json:"createdby,omitempty"`
|
||||
Created time.Time `json:"created"`
|
||||
Updated time.Time `json:"updated"`
|
||||
}
|
||||
|
||||
type Productstockstatement struct {
|
||||
Productid int `json:"productid"`
|
||||
Productname string `json:"productname"`
|
||||
Productimage string `json:"productimage"`
|
||||
Categoryid int `json:"categoryid"`
|
||||
Subcategoryid int `json:"subcategoryid"`
|
||||
Productunit string `json:"productunit"`
|
||||
Unitvalue string `json:"unitvalue"`
|
||||
Productcost float32 `json:"productcost"`
|
||||
Taxpercent float32 `json:"taxpercent"`
|
||||
Taxamount float32 `json:"taxamount"`
|
||||
Retailprice float32 `json:"retailprice"`
|
||||
Tenantid int `json:"tenantid"`
|
||||
Locationid int `json:"locationid"`
|
||||
Opening int `json:"opening"`
|
||||
Credit int `json:"credit"`
|
||||
Debit int `json:"debit"`
|
||||
Closing int `json:"closing"`
|
||||
}
|
||||
|
||||
type Productcount struct {
|
||||
Total int `json:"total"`
|
||||
Available int `json:"available"`
|
||||
Outofstock int `json:"outofstock"`
|
||||
}
|
||||
|
||||
type ProductSubCategory struct {
|
||||
Subcatid int `json:"subcatid"`
|
||||
Categoryid int `json:"categoryid,omitempty"`
|
||||
Tenantid int `json:"tenantid,omitempty"`
|
||||
Subcatname string `json:"subcatname,omitempty"`
|
||||
Image string `json:"image,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
Sortorder int `json:"sortorder,omitempty"`
|
||||
Createdby int `json:"createdby,omitempty"`
|
||||
Created time.Time `json:"created,omitempty"`
|
||||
Updated time.Time `json:"updated,omitempty"`
|
||||
}
|
||||
|
||||
// Struct to match the `productsubcategories` table
|
||||
type Subcategory struct {
|
||||
Subcategoryid int `json:"subcategoryid" gorm:"column:subcatid"`
|
||||
Subcategoryname string `json:"subcategoryname" gorm:"column:subcatname"`
|
||||
Categoryid int `json:"categoryid" gorm:"column:categoryid"`
|
||||
}
|
||||
|
||||
// Response format
|
||||
type SubcategoryProductResponse struct {
|
||||
SubcategoryID int `json:"subcategoryid"`
|
||||
SubcategoryName string `json:"subcategoryname"`
|
||||
Products []Products `json:"products"`
|
||||
}
|
||||
type TenantInfo struct {
|
||||
Tenantid int `json:"tenantid"`
|
||||
Tenantname string `json:"tenantname"`
|
||||
Address string `json:"address"`
|
||||
Licenseno string `json:"licenseno"`
|
||||
Primaryemail string `json:"primaryemail"`
|
||||
Primarycontact string `json:"primarycontact"`
|
||||
Pickuplocationid int `json:"pickuplocationid"`
|
||||
Applocationid int `json:"applocationid"`
|
||||
Suburb string `json:"suburb"`
|
||||
City string `json:"city"`
|
||||
Latitude string `json:"latitude"`
|
||||
Longitude string `json:"longitude"`
|
||||
Postcode string `json:"postcode"`
|
||||
Tenantimage string `json:"tenantimage"`
|
||||
Locationid int `json:"locationid"`
|
||||
Locationname string `json:"locationname"`
|
||||
Subcategoryid int `json:"subcategoryid"`
|
||||
Categoryid int `json:"categoryid"`
|
||||
Registrationno string `json:"registrationno"`
|
||||
}
|
||||
|
||||
type ProductListResponse struct {
|
||||
Tenantid int `json:"tenantid"`
|
||||
Tenantname string `json:"tenantname"`
|
||||
Address string `json:"address"`
|
||||
Licenseno string `json:"licenseno"`
|
||||
Primaryemail string `json:"primaryemail"`
|
||||
Pickupcontactno string `json:"primarycontact"`
|
||||
Applocationid int `json:"applocationid"`
|
||||
Pickuplocationid int `json:"pickuplocationid"`
|
||||
Pickupsuburb string `json:"suburb"`
|
||||
Pickupcity string `json:"city"`
|
||||
Pickuplat string `json:"pickuplat"`
|
||||
Pickuplong string `json:"pickuplong"`
|
||||
Tenantpostcode string `json:"postcode"`
|
||||
Locationname string `json:"locationname"`
|
||||
Categoryname string `json:"categoryname"`
|
||||
Products []Products `json:"products"`
|
||||
}
|
||||
|
||||
type Tenantproducts struct {
|
||||
Tenant TenantInfo `json:"tenant"`
|
||||
Products []Products `json:"products"`
|
||||
}
|
||||
|
||||
type Productvariant struct {
|
||||
Variantid int `json:"variantid" gorm:"Primary_Key"`
|
||||
Tenantid int `json:"tenantid"`
|
||||
Variantname string `json:"variantname"`
|
||||
Categoryid int `json:"categoryid" gorm:"default:0"`
|
||||
Categoryname string `json:"categoryname" gorm:"-"`
|
||||
Subcategoryid int `json:"subcategoryid"`
|
||||
Status string `json:"status" gorm:"default:active"`
|
||||
}
|
||||
|
||||
type Productlocations struct {
|
||||
Productlocationid int `json:"productlocationid" gorm:"Primary_Key"`
|
||||
Tenantid int `json:"tenantid"`
|
||||
Locationid int `json:"locationid"`
|
||||
Productid int `json:"productid"`
|
||||
Catlougeid int `json:"catlougeid"`
|
||||
Minquantity int `json:"minquantity" gorm:"default:0"`
|
||||
Maxquantity int `json:"maxquantity" gorm:"default:0"`
|
||||
Price float32 `json:"price" gorm:"default:0.0"`
|
||||
Quantity int `json:"quantity" gorm:"<-:false"`
|
||||
Stocktype string `json:"stocktype" gorm:"<-:false"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
type Productstock struct {
|
||||
Productstockid int `json:"productstockid" gorm:"Primary_Key"`
|
||||
Tenantid int `json:"tenantid"`
|
||||
Stockdate time.Time `json:"stockdate"`
|
||||
Locationid int `json:"locationid"`
|
||||
Productid int `json:"productid"`
|
||||
Quantity int `json:"quantity"`
|
||||
Stocktype string `json:"stocktype"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
type Productstocks struct {
|
||||
Productstockid int `json:"productstockid" gorm:"Primary_Key"`
|
||||
Locationid int `json:"locationid"`
|
||||
Tenantid int `json:"tenantid"`
|
||||
Stockdate string `json:"stockdate"`
|
||||
Productid int `json:"productid"`
|
||||
Quantity int `json:"quantity"`
|
||||
Stocktype string `json:"stocktype"`
|
||||
Status string `json:"status"`
|
||||
AppLocationid int `json:"applocationid"`
|
||||
Categoryid int `json:"categoryid"`
|
||||
Categoryname string `json:"categoryname" gorm:"->"`
|
||||
Subcategoryid int `json:"subcategoryid,omitempty"`
|
||||
Subcategoryname string `json:"Subcategoryname" `
|
||||
Productname string `json:"productname,omitempty"`
|
||||
Productimage string `json:"productimage,omitempty"`
|
||||
Productdesc *string `json:"productdesc,omitempty"`
|
||||
Productsku *string `json:"productsku,omitempty"`
|
||||
Brandid *int `json:"brandid,omitempty"`
|
||||
Productbrand *string `json:"productbrand,omitempty"`
|
||||
Productunit *string `json:"productunit,omitempty"`
|
||||
Unitvalue *string `json:"unitvalue,omitempty"`
|
||||
Toppicks *string `json:"toppicks,omitempty"`
|
||||
Productcost *float64 `json:"productcost,omitempty"`
|
||||
Taxamount *float64 `json:"taxamount,omitempty"`
|
||||
Taxpercent *float64 `json:"taxpercent,omitempty"`
|
||||
Producttax *int `json:"producttax,omitempty"`
|
||||
Productstock *int `json:"productstock,omitempty"`
|
||||
Productcombo *int `json:"productcombo,omitempty"`
|
||||
Variants int `json:"variants"`
|
||||
Retailprice float64 `json:"retailprice,omitempty"`
|
||||
Diffprice float64 `json:"diffprice,omitempty"`
|
||||
Diffpercent float64 `json:"diffpercent,omitempty"`
|
||||
Othercost float64 `json:"othercost,omitempty"`
|
||||
Approve *int `json:"approve"`
|
||||
}
|
||||
|
||||
type SubCategorySummary struct {
|
||||
SubCategoryID int `json:"subcategoryid"`
|
||||
SubCategoryName string `json:"subcatname"`
|
||||
Image string `json:"image"`
|
||||
ProductCount int `json:"productcount"`
|
||||
}
|
||||
|
||||
type ProductSummary struct {
|
||||
Subcategoryid int `json:"subcategoryid"`
|
||||
Subcategroyname string `json:"subcategroyname"`
|
||||
Image string `json:"image"`
|
||||
Productcount int `json:"productcount"`
|
||||
}
|
||||
|
||||
type ProductDiscount struct {
|
||||
Discountid int `json:"discountid" gorm:"column:discountid;primaryKey"`
|
||||
Discounttypeid int `json:"discounttypeid" gorm:"column:discounttypeid"`
|
||||
Tenantid int `json:"tenantid" gorm:"column:tenantid"`
|
||||
Moduleid int `json:"moduleid" gorm:"column:moduleid"`
|
||||
Productid int `json:"productid" gorm:"column:productid"`
|
||||
Locationid []string `json:"locationid" gorm:"-"`
|
||||
LocationidStr string `json:"-" gorm:"column:locationid"`
|
||||
Discountname string `json:"discountname" gorm:"column:discountname"`
|
||||
Discountcode string `json:"discountcode" gorm:"column:discountcode"`
|
||||
Discountterms string `json:"discountterms" gorm:"column:discountterms"`
|
||||
Discountvalue float64 `json:"discountvalue" gorm:"column:discountvalue"`
|
||||
Startdate string `json:"startdate" gorm:"column:startdate"`
|
||||
Enddate string `json:"enddate" gorm:"column:enddate"`
|
||||
Status string `json:"status" gorm:"column:status"`
|
||||
}
|
||||
Reference in New Issue
Block a user