initial commit

This commit is contained in:
2026-05-25 11:52:26 +05:30
commit 0d42ac84e1
53 changed files with 11222 additions and 0 deletions

7
models/common.go Normal file
View File

@@ -0,0 +1,7 @@
package models
type Result struct {
Code int `json:"code"`
Status bool `json:"status"`
Message string `json:"message"`
}

123
models/customer.go Normal file
View File

@@ -0,0 +1,123 @@
package models
import "time"
type Customers struct {
Customerid int `json:"customerid" gorm:"Primary_Key"`
Firstname string `json:"firstname"`
Lastname string `json:"lastname"`
Profileimage string `json:"profileimage"`
Gender string `json:"gender"`
Dob string `json:"dob"`
Dialcode string `json:"dialcode"`
Contactno string `json:"contactno"`
Email string `json:"email"`
Deviceid string `json:"deviceid"`
Devicetype string `json:"devicetype"`
Authmode int `json:"authmode"`
Configid int `json:"configid"`
Customertoken string `json:"customertoken"`
Address string `json:"address"`
Suburb string `json:"suburb"`
City string `json:"city"`
State string `json:"state"`
Landmark string `json:"landmark"`
Doorno string `json:"doorno"`
Postcode string `json:"postcode"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
Applocationid int `json:"applocationid"`
Locationid int `json:"locationid,omitempty" gorm:"-"`
Defaultaddress string `json:"defaultaddress,omitempty" gorm:"-"`
Primaryaddress int `json:"primaryaddress,omitempty" gorm:"-"`
Tenantid int `json:"tenantid,omitempty" gorm:"-"`
Status int `json:"status"`
Intro string `json:"intro"`
Qrmode int `json:"qrmode,omitempty" gorm:"-"`
}
type CustomerInfo struct {
Customerid int `json:"customerid"`
Firstname string `json:"firstname"`
Lastname string `json:"lastname"`
Profileimage string `json:"profileimage"`
Gender string `json:"gender"`
Dob string `json:"dob"`
Dialcode string `json:"dialcode"`
Contactno string `json:"contactno"`
Email string `json:"email"`
Deviceid string `json:"deviceid"`
Devicetype string `json:"devicetype"`
Authmode int `json:"authmode"`
Configid int `json:"configid"`
Customertoken string `json:"customertoken"`
Deliverylocationid int `json:"deliverylocationid"`
Address string `json:"address"`
Suburb string `json:"suburb"`
City string `json:"city"`
State string `json:"state"`
Landmark string `json:"landmark"`
Doorno string `json:"doorno"`
Postcode string `json:"postcode"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
Applocationid int `json:"applocationid"`
Allocationid int `json:"allocationid"`
Primaryaddress int `json:"primaryaddress"`
Tenantlocationid int `json:"tenantlocationid"`
Tenantid int `json:"tenantid"`
Status int `json:"status"`
Intro string `json:"intro"`
Selectedlatitude string `json:"selectedlatitude"`
Selectedlongitude string `json:"selectedlongitude"`
Radius string `json:"radius"`
Qrmode int `json:"qrmode"`
}
type CustomerLocationResult struct {
Code int `json:"code"`
Status bool `json:"status"`
Message string `json:"message"`
Details []Customerlocations `json:"details"`
}
type Customerlocations struct {
Locationid int `json:"locationid" gorm:"Primary_Key"`
Customerid int `json:"customerid"`
Applocationid int `json:"applocationid" gorm:"-"`
Address string `json:"address"`
Suburb string `json:"suburb"`
City string `json:"city"`
State string `json:"state"`
Landmark string `json:"landmark"`
Doorno string `json:"doorno"`
Postcode string `json:"postcode"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
Primaryaddress int `json:"primaryaddress"`
Status int `json:"status"`
}
type CustomerRequest struct {
Customerrequestid int `json:"customerrequestid" gorm:"primaryKey;autoIncrement"`
Referencedate time.Time `json:"referencedate"`
Referencetype string `json:"referencetype"`
Customerid int `json:"customerid"`
Tenantid int `json:"tenantid"`
Apptypeid int `json:"apptypeid"`
Locationid int `json:"locationid"`
Subject string `json:"subject"`
Remarks string `json:"remarks"`
Status int `json:"status"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
}
type Tenantcustomers struct {
Tenantcustomerid int `json:"tenantcustomerid" gorm:"Primary_Key"`
Tenantid int `json:"tenantid" `
Locationid int `json:"locationid"`
Customerid int `json:"customerid"`
Moduleid int `json:"moduleid"`
Status int `json:"status"`
}

243
models/deliveries.go Normal file
View File

@@ -0,0 +1,243 @@
package models
type Deliveries struct {
Deliveryid int `json:"deliveryid" gorm:"Primary_Key"`
Orderheaderid int `json:"orderheaderid"`
Applocationid int `json:"applocationid"`
Configid int `json:"configid"`
Partnerid int `json:"partnerid"`
Tenantid int `json:"tenantid"`
Moduleid int `json:"moduleid"`
Locationid int `json:"locationid"`
Categoryid int `json:"categoryid"`
Userid int `json:"userid"`
Subcategoryid int `json:"subcategoryid"`
Orderid string `json:"orderid"`
Deliverydate string `json:"deliverydate"`
Orderstatus string `json:"orderstatus"`
Assigntime string `json:"assigntime"`
Starttime string `json:"starttime"`
Arrivaltime string `json:"arrivaltime"`
Pickuptime string `json:"pickuptime"`
Deliverytime string `json:"deliverytime"`
Canceltime string `json:"canceltime"`
Itemcount int `json:"itemcount"`
Orderamount float32 `json:"orderamount"`
Customerid int `json:"customerid"`
Pickupcustomer string `json:"pickupcustomer"`
Pickupcontactno string `json:"pickupcontactno"`
Pickuplocationid int `json:"pickuplocationid"`
Pickupaddress string `json:"Pickupaddress"`
Pickuplocation string `json:"pickuplocation"`
Pickuplat string `json:"pickuplat"`
Pickuplon string `json:"pickuplon"`
Deliverycustomerid int `json:"deliverycustomerid"`
Deliverylocationid int `json:"deliverylocationid"`
Deliverycustomer string `json:"deliverycustomer"`
Deliverycontactno string `json:"deliverycontactno"`
Deliveryaddress string `json:"deliveryaddress"`
Deliverylocation string `json:"deliverylocation"`
Droplat string `json:"droplat"`
Droplon string `json:"droplon"`
Deliverylat string `json:"deliverylat"`
Deliverylong string `json:"deliverylong"`
Deliverycharges float32 `json:"deliverycharges"`
Deliveryamt float32 `json:"deliveryamt"`
Deliverytype string `json:"deliverytype"`
Notes string `json:"notes"`
Ordernotes string `json:"ordernotes"`
Riderslat string `json:"riderslat"`
Riderslon string `json:"riderslon"`
Firstmilekm float32 `json:"firstmilekm"`
Firstmilecharges float32 `json:"firstmilecharges"`
Lastmilecharges float32 `json:"lastmilecharges"`
Ridercharges float32 `json:"ridercharges"`
Kms string `json:"kms"`
Actualkms string `json:"actualkms"`
Smsdelivery int `json:"smsdelivery"`
Paymenttype int `json:"paymenttype"`
}
type Deliveryqueues struct {
Queueid int `json:"queueid" gorm:"Primary_Key"`
Tenantid int `json:"tenantid"`
Locationid int `json:"locationid"`
Orderheaderid int `json:"orderheaderid"`
Deliveryid int `json:"deliveryid"`
Userid int `json:"userid"`
Partnerid int `json:"partnerid"`
Orderid string `json:"orderid"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
Accept int `json:"accept"`
Decline int `json:"decline"`
Queuestatus int `json:"queuestatus"`
}
type Updateorderstatus struct {
Orderheaderid int `json:"Orderheaderid"`
Orderstatus string `json:"Orderstatus"`
Pending string `json:"pending"`
Processing string `json:"processing"`
Cancelled string `json:"cancelled"`
Delivered string `json:"delivered"`
}
type UpdateDeliveryStatus struct {
Deliveryid int `json:"deliveryid"`
Deliverytype string `json:"deliverytype"`
Pickuplocationid int `json:"pickuplocationid"`
Deliverylocationid int `json:"deliverylocationid"`
Orderheaderid int `json:"orderheaderid"`
Userid int `json:"userid"`
Orderstatus string `json:"orderstatus"`
Assigntime string `json:"assigntime"`
Starttime string `json:"starttime"`
Arrivaltime string `json:"arrivaltime"`
Pickuptime string `json:"pickuptime"`
Deliverytime string `json:"deliverytime"`
Canceltime string `json:"canceltime"`
Pickuplat string `json:"pickuplat"`
Pickuplon string `json:"picklon"`
Riderslat string `json:"riderslat"`
Riderslon string `json:"riderslon"`
Deliverylat string `json:"deliverylat"`
Deliverylong string `json:"deliverylong"`
Address string `json:"address" gorm:"<-:false"`
Suburb string `json:"suburb" gorm:"<-:false"`
City string `json:"city" gorm:"<-:false"`
State string `json:"state" gorm:"<-:false"`
Postcode string `json:"postcode" gorm:"<-:false"`
Deliveryamt float32 `json:"deliveryamt"`
Kms string `json:"kms"`
Actualkms string `json:"actualkms"`
Riderkms string `json:"riderkms"`
Kmcal string `json:"kmcal"`
Notes string `json:"notes"`
Feedback string `json:"feedback"`
Smsdelivery int `json:"smsdelivery"`
}
type DeliverySummary struct {
Total int `json:"total"`
Created int `json:"created"`
Pending int `json:"pending"`
Accepted int `json:"accepted"`
Arrived int `json:"arrived"`
Picked int `json:"picked"`
Active int `json:"active"`
Delivered int `json:"delivered"`
Cancelled int `json:"cancelled"`
}
type ReportSummary struct {
Tenantid int `json:"tenantid"`
Tenantname string `json:"tenantname"`
Totalorders int `json:"totalorders"`
Orderscreated int `json:"orderscreated"`
Orderspending int `json:"Orderspending"`
Orderscompleted int `json:"orderscompleted"`
Orderscancelled int `json:"orderscancelled"`
Deliveriespending int `json:"deliveriespending"`
Deliveriescompleted int `json:"deliveriescompleted"`
Deliveriescancelled int `json:"deliveriescancelled"`
Paylater float32 `json:"paylater"`
Payondelivery float32 `json:"payondelivery"`
Kms float32 `json:"kms"`
Actualkms float32 `json:"actualkms"`
Charges float32 `json:"charges"`
}
type Ridersummary struct {
Userid int `json:"userid"`
Firstname string `json:"firstname"`
Lastname string `json:"lastname"`
Deliveries int `json:"deliveries"`
Assigned int `json:"Assigened"`
Accepted int `json:"Accepted"`
Picked int `json:"Picked"`
Delivered int `json:"delivered"`
Kms float32 `json:"kms"`
Actualkms float32 `json:"actualkms"`
Payondelivery float32 `json:"payondelivery"`
Paylater float32 `json:"Paylater"`
Deliveryamt float32 `json:"Deliveryamt"`
Status string `json:"status"`
}
type Deliveryinfo struct {
Deliveryid int `json:"deliveryid"`
Orderheaderid int `json:"orderheaderid"`
Applocationid int `json:"applocationid"`
Applocation string `json:"applocation"`
Configid int `json:"configid"`
Partnerid int `json:"partnerid"`
Tenantid int `json:"tenantid"`
Moduleid int `json:"moduleid"`
Locationid int `json:"locationid"`
Categoryid int `json:"categoryid"`
Userid int `json:"userid"`
Subcategoryid int `json:"subcategoryid"`
Orderid string `json:"orderid"`
Deliverydate string `json:"deliverydate"`
Orderstatus string `json:"orderstatus"`
Assigntime string `json:"assigntime"`
Starttime string `json:"starttime"`
Arrivaltime string `json:"arrivaltime"`
Pickuptime string `json:"pickuptime"`
Deliverytime string `json:"deliverytime"`
Canceltime string `json:"canceltime"`
Itemcount int `json:"itemcount"`
Orderamount float32 `json:"orderamount"`
Customerid int `json:"customerid"`
Pickupcustomer string `json:"pickupcustomer"`
Pickupcontactno string `json:"pickupcontactno"`
Pickuplocationid int `json:"pickuplocationid"`
Pickupaddress string `json:"Pickupaddress"`
Pickuplocation string `json:"pickuplocation"`
Pickuplat string `json:"pickuplat"`
Pickuplon string `json:"pickuplon"`
Deliverycustomerid int `json:"deliverycustomerid"`
Deliverylocationid int `json:"deliverylocationid"`
Deliverycustomer string `json:"deliverycustomer"`
Deliverycontactno string `json:"deliverycontactno"`
Deliveryaddress string `json:"deliveryaddress"`
Deliverylocation string `json:"deliverylocation"`
Droplat string `json:"droplat"`
Droplon string `json:"droplon"`
Deliverylat string `json:"deliverylat"`
Deliverylong string `json:"deliverylong"`
Deliverycharges float32 `json:"deliverycharges"`
Deliveryamt float32 `json:"deliveryamt"`
Deliverytype string `json:"deliverytype"`
Notes string `json:"notes"`
Ordernotes string `json:"ordernotes"`
Riderslat string `json:"riderslat"`
Riderslon string `json:"riderslon"`
Firstmilekm float32 `json:"firstmilekm"`
Firstmilecharges float32 `json:"firstmilecharges"`
Lastmilecharges float32 `json:"lastmilecharges"`
Ridercharges float32 `json:"ridercharges"`
Kms string `json:"kms"`
Actualkms string `json:"actualkms"`
Riderkms string `json:"riderkms"`
Paymenttype int `json:"paymenttype"`
Tenantname string `json:"tenantname"`
Tenantcontactno string `json:"tenantcontactno"`
Tenanttoken string `json:"tenanttoken"`
Tenantsuburb string `json:"tenantsuburb"`
Tenantcity string `json:"tenantcity"`
Locationname string `json:"locationname"`
Locationcontactno string `json:"locationcontactno"`
Locationsuburb string `json:"locationsuburb"`
Ridername string `json:"ridername"`
Userfcmtoken string `json:"userfcmtoken"`
Queueid int `json:"queueid"`
Smsdelivery int `json:"smsdelivery"`
Customertoken string `json:"customertoken"`
Ridercontact string `json:"ridercontact"`
Expecteddeliverytime string `json:"expecteddeliverytime"`
Profit int `json:"profit"`
Transitminutes int `json:"transitminutes"`
Calculationdistancekm int `json:"calculationdistancekm"`
}

440
models/order.go Normal file
View File

@@ -0,0 +1,440 @@
package models
import (
"database/sql/driver"
"encoding/json"
"fmt"
"strconv"
"gorm.io/gorm"
)
// FlexibleString handles JSON that could be either a number or a string,
// and ensures it can be saved/read from the database as a string.
type FlexibleString string
func (fs *FlexibleString) UnmarshalJSON(b []byte) error {
if len(b) == 0 {
return nil
}
// If it's a string in JSON
if b[0] == '"' {
var s string
if err := json.Unmarshal(b, &s); err != nil {
return err
}
*fs = FlexibleString(s)
return nil
}
// If it's a number in JSON
var f float64
if err := json.Unmarshal(b, &f); err != nil {
return err
}
*fs = FlexibleString(strconv.FormatFloat(f, 'f', -1, 64))
return nil
}
func (fs FlexibleString) MarshalJSON() ([]byte, error) {
return json.Marshal(string(fs))
}
// 🔥 Database Logic: Handle reading from DB
func (fs *FlexibleString) Scan(value interface{}) error {
if value == nil {
*fs = ""
return nil
}
switch v := value.(type) {
case []byte:
*fs = FlexibleString(v)
case string:
*fs = FlexibleString(v)
case float64:
*fs = FlexibleString(strconv.FormatFloat(v, 'f', -1, 64))
case int64:
*fs = FlexibleString(strconv.FormatInt(v, 10))
default:
*fs = FlexibleString(fmt.Sprintf("%v", v))
}
return nil
}
// 🔥 Database Logic: Handle writing to DB
func (fs FlexibleString) Value() (driver.Value, error) {
return string(fs), nil
}
func (fs FlexibleString) String() string {
return string(fs)
}
type OrderInfo struct {
Orderheaderid int `json:"orderheaderid"`
Applocationid int `json:"applocationid"`
Applocation string `json:"applocation"`
Tenantid int `json:"tenantid"`
Partnerid int `json:"partnerid"`
Locationid int `json:"locationid"`
Categoryid int `json:"categoryid"`
Subcategoryid int `json:"subcategoryid"`
Moduleid int `json:"moduleid"`
Configid int `json:"configid"`
Orderid string `json:"orderid"`
Orderdate string `json:"orderdate"`
Deliverydate string `json:"deliverydate"`
Orderstatus string `json:"orderstatus"`
Deliverystatus string `json:"deliverystatus"`
Deliveryamt float64 `json:"deliveryamt"`
Itemcount int `json:"itemcount"`
Ordernotes string `json:"ordernotes"`
Kms FlexibleString `json:"kms"`
Actualkms FlexibleString `json:"actualkms"`
Pending string `json:"Pending"`
Processing string `json:"processing"`
Ready string `json:"ready"`
Cancelled string `json:"cancelled"`
Delivered string `json:"delivered"`
Assigntime string `json:"assigntime"`
Starttime string `json:"starttime"`
Arrivaltime string `json:"arrivaltime"`
Pickuptime string `json:"pickuptime"`
Deliverytime string `json:"deliverytime"`
Canceltime string `json:"canceltime"`
Deliverycharge float32 `json:"deliverycharge"`
Orderamount float32 `json:"orderamount"`
Customerid int `json:"customerid"`
Pickupcustomer string `json:"pickupcustomer"`
Pickupcontactno string `json:"pickupcontactno"`
Pickuplocationid int `json:"pickuplocationid"`
Pickupaddress string `json:"pickupaddress"`
Pickupsuburb string `json:"pickupsuburb"`
Pickupcity string `json:"pickupcity"`
Pickuplat FlexibleString `json:"pickuplat"`
Pickuplong FlexibleString `json:"pickuplong"`
Deliveryid int `json:"deliveryid"`
Deliverycustomerid int `json:"deliverycustomerid"`
Deliverycustomer string `json:"deliverycustomer"`
Deliverycontactno string `json:"deliverycontactno"`
Deliverylocationid int `json:"deliverylocationid"`
Deliveryaddress string `json:"deliveryaddress"`
Deliverysuburb string `json:"deliverysuburb"`
Droplat FlexibleString `json:"droplat"`
Droplon FlexibleString `json:"droplon"`
Deliverylat FlexibleString `json:"deliverylat"`
Deliverylong FlexibleString `json:"deliverylong"`
Deliverytype string `json:"deliverytype"`
Paymenttype int `json:"paymenttype"`
Tenantname string `json:"tenantname"`
Tenanttoken string `json:"tenanttoken"`
Tenantsuburb string `json:"tenantsuburb"`
Tenantcity string `json:"tenantcity"`
Tenantcontactno string `json:"tenantcontactno"`
Tenantpostcode string `json:"tenantpostcode"`
Locationname string `json:"locationname"`
Locationsuburb string `json:"locationsuburb"`
Locationcity string `json:"locationcity"`
Locationcontactno string `json:"locationcontactno"`
Rider string `json:"rider"`
Ridercontactno string `json:"ridercontactno"`
Riderkms FlexibleString `json:"riderkms"`
Smsdelivery int `json:"smsdelivery"`
Customertoken string `json:"customertoken"`
Ridertoken string `json:"ridertoken"`
}
type DeliveryQuery struct {
Tenantid int
Customerid int
Partnerid int
UserID int
Appuserid int
Applocationid int
Moduleid int
Locationid int
Configid int
Fromdate string
ToDate string
Status string
Pageno int
Pagesize int
Conn *gorm.DB
Keyword string `json:"keyword"`
}
type Ordersummary struct {
Total int `json:"total"`
Created int `json:"created"`
Pending int `json:"pending"`
Processing int `json:"processing"`
Delivered int `json:"delivered"`
Cancelled int `json:"cancelled"`
// Locationid int `json:"locationid"`
Locationname string `json:"locationname"`
Applocationid string `json:"applocationid"`
}
type Ordersummarylocation struct {
Total int `json:"total"`
Created int `json:"created"`
Pending int `json:"pending"`
Processing int `json:"processing"`
Delivered int `json:"delivered"`
Cancelled int `json:"cancelled"`
Locationid int `json:"locationid"`
Locationname string `json:"locationname"`
}
type Ordersummarydaily struct {
Total int `json:"total"`
Created int `json:"created"`
Pending int `json:"pending"`
Processing int `json:"processing"`
Delivered int `json:"delivered"`
Cancelled int `json:"cancelled"`
Tenantid int `json:"tenantid"`
Tenantname string `json:"tenantname"`
Locationid int `json:"locationid"`
Locationname string `json:"locationname"`
}
type OrderInsight struct {
Applocationid int `json:"applocationid" gorm:"Primary_Key"`
Locationname string `json:"locationname"`
Ordermonths *Ordermonths `json:"ordermonths" gorm:"-"`
}
type OrderInsightv1 struct {
Locationid int `json:"locationid" gorm:"Primary_Key"`
Locationname string `json:"locationname"`
Ordermonths *Ordermonths `json:"ordermonths" gorm:"-"`
}
type Ordermonths struct {
Jan int `json:"jan"`
Feb int `json:"feb"`
Mar int `json:"mar"`
Apr int `json:"apr"`
May int `json:"may"`
Jun int `json:"jun"`
Jul int `json:"jul"`
Aug int `Json:"aug"`
Sep int `Json:"sep"`
Oct int `Json:"oct"`
Nov int `Json:"nov"`
Dece int `Json:"dece"`
// Applocationid int `json:"applocationid"`
}
type Orders struct {
Orderheaderid int `json:"orderheaderid" gorm:"Primary_Key"`
Tenantid int `json:"tenantid"`
Locationid int `json:"locationid"`
Applocationid int `json:"applocationid"`
Moduleid int `json:"moduleid"`
Partnerid int `json:"partnerid"`
Configid int `json:"configid"`
Categoryid int `json:"categoryid"`
Subcategoryid int `json:"subcategoryid"`
Orderid string `json:"orderid"`
Orderdate string `json:"orderdate,omitempty"`
Deliverytime string `json:"deliverytime"`
Deliverytype string `json:"deliverytype"`
Orderstatus string `json:"orderstatus"`
Pending string `json:"pending"`
Processing string `json:"processing"`
Ready string `json:"ready"`
Delivered string `json:"delivered"`
Cancelled string `json:"cancelled"`
Customerid int `json:"customerid"`
Pickupaddress string `json:"pickupaddress"`
Pickuplat FlexibleString `json:"pickuplat"`
Pickuplong FlexibleString `json:"pickuplong"`
Pickupcustomer string `json:"pickupcustomer"`
Pickupcontactno string `json:"pickupcontactno"`
Pickuplocation string `json:"pickupsuburb"` // alias
Pickupcity string `json:"pickupcity"`
Deliveryid int `json:"deliverycustomerid"` // alias
Deliverycustomer string `json:"deliverycustomer"`
Deliverycontactno string `json:"deliverycontactno"`
Deliveryaddress string `json:"deliveryaddress"`
Deliverylocation string `json:"deliverylocation"`
Deliverycity string `json:"deliverycity"`
Deliverylocationid int `json:"deliverylocationid"`
Deliverylat FlexibleString `json:"deliverylat"`
Deliverylong FlexibleString `json:"deliverylong"`
Promotionid int `json:"promotionid"`
Promoname string `json:"promoname"`
Promoterms string `json:"promoterms"`
Promovalue int `json:"promovalue"`
Promoamount float32 `json:"promoamount"`
Orderamount float32 `json:"orderamount"`
Taxamount float32 `json:"taxamount"`
Ordercharges float32 `json:"ordercharges"`
Ordervalue float32 `json:"ordervalue"`
Itemcount int `json:"itemcount"`
Paymenttype int `json:"paymenttype"`
Paymentstatus int `json:"paymentstatus"`
Deliverycharge float32 `json:"deliverycharge"`
Ordernotes string `json:"ordernotes"`
Kms FlexibleString `json:"kms"`
Remarks string `json:"remarks"`
Tenantuserid int `json:"tenantuserid"`
Partneruserid int `json:"partneruserid"`
Smsdelivery int `json:"smsdelivery" gorm:"default:0"`
Items []OrderDetail `json:"items" gorm:"-"`
}
type OrderDetails struct {
Orderdetailid int `json:"orderdetailid" gorm:"primaryKey;autoIncrement"`
Orderheaderid int `json:"orderheaderid"`
Tenantid int `json:"tenantid"`
Locationid int `json:"locationid"`
Productid int `json:"productid"`
Productname string `json:"productname"`
Productdescription string `json:"productdescription"`
Supplyqty float64 `json:"supplyqty"`
Balanceqty float64 `json:"balanceqty"`
Orderqty float64 `json:"orderqty"`
Price float64 `json:"price"`
Unitid int `json:"unitid"`
Unitname string `json:"unitname"`
Productaddonid int `json:"productaddonid"`
Addontypeid int `json:"addontypeid"`
Productmapid int `json:"productmapid"`
Productvariantid int `json:"productvariantid"`
Productaddondescription string `json:"productaddondescription"`
Discountid int `json:"discountid"`
Discountname string `json:"discountname"`
Discountcode string `json:"discountcode"`
Discountterms string `json:"discountterms"`
Discountpercentage float64 `json:"discountpercentage"`
Discountamount float64 `json:"discountamount"`
Landingamount float64 `json:"landingamount"`
Taxpercentage float64 `json:"taxpercentage"`
Taxamount float64 `json:"taxamount"`
Totaltaxamount float64 `json:"totaltaxamount"`
Productsumprice float64 `json:"productsumprice"`
Itemstatus string `json:"itemstatus"`
Delivered string `json:"delivered"`
Orderamount float64 `json:"Orderamount"`
Productimage string `json:"productimage"`
}
type OrderDetail struct {
Orderdetailid int `json:"orderdetailid" gorm:"primaryKey;autoIncrement"`
Orderheaderid int `json:"orderheaderid"`
Tenantid int `json:"tenantid"`
Locationid int `json:"locationid"`
Productid int `json:"productid"`
Productname string `json:"productname"`
Productdescription string `json:"productdescription"`
Supplyqty float64 `json:"supplyqty"`
Balanceqty float64 `json:"balanceqty"`
Orderqty float64 `json:"orderqty"`
Price float64 `json:"price"`
Unitid int `json:"unitid"`
Unitname string `json:"unitname"`
Productaddonid int `json:"productaddonid"`
Addontypeid int `json:"addontypeid"`
Productmapid int `json:"productmapid"`
Productvariantid int `json:"productvariantid"`
Productaddondescription string `json:"productaddondescription"`
Discountid int `json:"discountid"`
Discountname string `json:"discountname"`
Discountcode string `json:"discountcode"`
Discountterms string `json:"discountterms"`
Discountpercentage float64 `json:"discountpercentage"`
Discountamount float64 `json:"discountamount"`
Landingamount float64 `json:"landingamount"`
Taxpercentage float64 `json:"taxpercentage"`
Taxamount float64 `json:"taxamount"`
Productsumprice float64 `json:"productsumprice"`
Itemstatus string `json:"itemstatus"`
Delivered string `json:"delivered"`
Orderamount float64 `json:"-" gorm:"-"`
Productimage string `json:"productimage" gorm:"-"` // only for JSON
}
type CustomerOrder struct {
Orderheaderid int `json:"orderheaderid" gorm:"Primary_Key"`
Applocationid int `json:"applocationid"`
Tenantid int `json:"tenantid"`
Locationid int `json:"locationid"`
Partnerid int `json:"partnerid"`
Configid int `json:"configid"`
Categoryid int `json:"categoryid"`
Subcategoryid int `json:"subcategoryid"`
Moduleid int `json:"moduleid"`
Orderid string `json:"orderid"`
Orderstatus string `json:"orderstatus"`
Orderdate string `json:"orderdate,omitempty"`
Ordernotes string `json:"ordernotes"`
Itemcount int `json:"itemcount"`
Deliverytime string `json:"deliverytime"` // alias for delivered
Pending string `json:"pending"`
Processing string `json:"processing"`
Ready string `json:"ready"`
Delivered string `json:"delivered"` // original delivered column
Cancelled string `json:"cancelled"`
Deliverycharge float32 `json:"deliverycharge"`
Kms FlexibleString `json:"kms"`
Smsdelivery int `json:"smsdelivery"`
// Tenant Info
Tenantname string `json:"tenantname"`
Tenanttoken string `json:"tenanttoken"`
Tenantcontactno string `json:"tenantcontactno"`
Tenantpostcode string `json:"tenantpostcode"`
Tenantsuburb string `json:"tenantsuburb"`
Tenantcity string `json:"tenantcity"`
Registrationno string `json:"registrationno"`
// Location Info
Locationname string `json:"locationname"`
Locationcontactno string `json:"locationcontactno"`
Locationpostcode string `json:"locationpostcode"`
Locationsuburb string `json:"locationsuburb"`
Locationcity string `json:"locationcity"`
// App Location
Applocation string `json:"applocation"`
// Delivery Info (from `deliveries` table)
Deliverystatus string `json:"deliverystatus"`
DeliveryUserID int `json:"deliveryid"` // alias
Assigntime string `json:"assigntime"`
Starttime string `json:"starttime"`
Arrivaltime string `json:"arrivaltime"`
Pickuptime string `json:"pickuptime"`
Finaldeliverytime string `json:"finaldeliverytime"` // alias for f.deliverytime
Canceltime string `json:"canceltime"`
Riderkms FlexibleString `json:"riderkms"`
// Actualkms sql.NullFloat64 `json:"actualkms"`
// Actualkms sql.NullFloat64 `json:"actualkms"`
// Riderkms sql.NullFloat64 `json:"riderkms"`
// Deliveryamt sql.NullFloat64 `json:"deliveryamt"`
Droplat FlexibleString `json:"droplat"`
Droplon FlexibleString `json:"droplon"`
// Rider
Rider string `json:"rider"`
Orderamount float64 `json:"orderamount"`
Taxamount float64 `json:"taxamount"`
Totaltaxamount float64 `json:"totaltaxamount"`
Riderkms_v2 FlexibleString `json:"-" gorm:"column:riderkms"` // Extra safety
// Items if applicable
OrderDetails []OrderDetails `json:"orderdetails" gorm:"-"`
}
type Ordersequences struct {
Sequenceid int `json:"sequenceid" gorm:"Primary_Key"`
Tenantid int `json:"tenantid"`
Orderprefix string `json:"orderprefix" gorm:"default:ORD"`
Customerprefix string `json:"customerprefix" gorm:"default:CUS"`
Appointmentprefix string `json:"appointmentprefix" gorm:"default:ORD"`
Receiptprefix string `json:"receiptprefix" gorm:"default:REC"`
Paymentprefix string `json:"paymentprefix" gorm:"default:PAY"`
}

106
models/partner.go Normal file
View File

@@ -0,0 +1,106 @@
package models
type RiderInfo struct {
Userid int `json:"userid"`
Authname string `json:"authname"`
Configid int `json:"configid"`
Authmode int `json:"authmode"`
Roleid int `json:"roleid"`
Firstname string `json:"firstname"`
Lastname string `json:"lastname"`
Fullname string `json:"fullname"`
Password string `json:"password"`
Email string `json:"email"`
Contactno string `json:"contactno"`
Address string `json:"address"`
Suburb string `json:"suburb"`
City string `json:"city"`
State string `json:"state"`
Postcode string `json:"postcode"`
Userfcmtoken string `json:"userfcmtoken"`
Pin int `json:"pin"`
Partnerid int `json:"partnerid"`
Identificationno string `json:"identificationno"`
Vehiclename string `json:"vehiclename"`
Vehicleno string `json:"vehicleno"`
Licenseno string `json:"licenseno"`
Insuranceno string `json:"insoranceno"`
Insurancedate string `json:"insurancedate"`
Shiftid int `json:"shiftid"`
Starttime string `json:"starttime"`
Endtime string `json:"endtime"`
Shifthours float32 `json:"shifthours"`
Basefare float32 `json:"basefare"`
Additionalcharges float32 `json:"additionalcharges"`
Orders int `json:"orders"`
Fuelcharge float32 `json:"fuelcharge"`
Logdate string `json:"logdate"`
Applocationid int `json:"applocationid"`
Applocation string `json:"applocation"`
Logseconds int `json:"logseconds"`
Riderid int `json:"riderid"`
Status string `json:"status"`
Tenantid int `json:"tenantid"`
}
type Partnerinfo struct {
Partnerid int `json:"partnerid" gorm:"Primary_Key"`
Partnertypeid int `json:"partnertypeid"`
Applocationid int `json:"applocationid"`
Partnername string `json:"partnername"`
Registrationno string `json:"registrationno"`
Primarycontact string `json:"primartcontact"`
Primaryemail string `json:"primaryemail"`
Contactno string `json:"contactno"`
Bizcategoryid int `json:"bizcategoryid"`
Bizsubcategoryid int `json:"bizsubcategoryid"`
Adderss string `json:"address"`
Suburb string `json:"suburb"`
State string `json:"state"`
City string `json:"city"`
Postcode string `json:"postcode"`
Partnerinfo string `json:"partnerinfo"`
Partnerimage string `json:"partnerimage"`
}
type Ridershifts struct {
Shiftid int `json:"shiftid" gorm:"Primary_Key"`
Shiftdate string `json:"shiftdate"`
Starttime string `json:"starttime"`
Endtime string `json:"endtime"`
Shifthours float32 `json:"shifthours"`
Basefare float32 `json:"basefare"`
Additionalkm float32 `json:"additionalkm"`
Additionalcharges float32 `json:"additionalcharges"`
Orders int `json:"orders"`
Fuelcharge float32 `json:"fuelcharge"`
Shiftname string `json:"shiftname" gorm:"<-:false"`
}
type Locationconfigs struct {
Applocationid int `json:"applocationid"`
Configid int `json:"configid"`
Locationname string `json:"locationname"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
Status string `json:"status"`
}
type RiderlogDetails struct {
Logid int `json:"logid"`
Logdate string `json:"logdate"`
Userid int `json:"userid"`
Username string `json:"username"`
Partnerid int `json:"partnerid"`
Shiftid int `json:"shiftid"`
Shifthours float32 `json:"shifthours"`
Login string `json:"login"`
Logout string `json:"logout"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
Workhours float32 `json:"workhours"`
Shorthours float32 `json:"shorthours"`
Breakhours float32 `json:"breakhours"`
Logstatus int `json:"logstatus"`
}

284
models/product.go Normal file
View File

@@ -0,0 +1,284 @@
package models
import "time"
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"`
}
type Productcount struct {
Total int `json:"total"`
Available int `json:"available"`
Outofstock int `json:"outofstock"`
}
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 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 Products struct {
Productid int `json:"productid" gorm:"primaryKey;autoIncrement"`
AppLocationid int `json:"applocationid" gorm:"column:applocationid"`
Productlocationid int `json:"productlocationid" gorm:"->"`
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"`
Discountvalue float64 `json:"discountvalue"`
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"`
Productstatus string `json:"productstatus" `
// Status string `json:"status" gorm:"default:InActive"`
// Status string `json:"status" gorm:"-"`
}
type Locationproducts struct {
Productid int `json:"productid"`
AppLocationid int `json:"applocationid" gorm:"column:applocationid"`
Productlocationid int `json:"productlocationid" gorm:"->"`
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"`
Status string `json:"status" gorm:"default:outofstock"`
}
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 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 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 ProductSummary struct {
Subcategoryid int `json:"subcategoryid"`
Subcategroyname string `json:"subcategroyname"`
Image string `json:"image"`
Productcount int `json:"productcount"`
}
type Tenantproducts struct {
Tenant TenantInfo `json:"tenant"`
Products []Products `json:"products"`
// Locationproducts []Locationproducts `json:"locationproducts"`
}
type TenantInfo struct {
Tenantid int `json:"tenantid"`
Tenantname string `json:"tenantname"`
Userfcmtoken string `json:"userfcmtoken"`
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"`
Orderscount int `json:"orderscount"`
// Products []Products `json:"products" gorm:"-"`
ProductSubcategory []ProductSubcategory `json:"productsubcategory" gorm:"-"`
}
type SubcategoryProductResponse struct {
SubcategoryID int `json:"subcategoryid"`
SubcategoryName string `json:"subcategoryname"`
Image string `json:"image"`
Products []Products `json:"products"`
}
type ProductFilter struct {
CategoryID int
TenantID int
AppLocationID int
ProductID int
Keyword string
LocationID int
}
type Subcategory struct {
Subcategoryid int `json:"subcategoryid" gorm:"column:subcatid"`
Subcategoryname string `json:"subcategoryname" gorm:"column:subcatname"`
Categoryid int `json:"categoryid" gorm:"column:categoryid"`
Image string `json:"image" gorm:"column:image"`
}
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 ProductSubcategory struct {
Subcatid int `json:"subcatid"`
Categoryid int `json:"categoryid"`
Tenantid int `json:"tenantid"`
Subcatname string `json:"subcatname"`
Status string `json:"status"`
Sortorder int `json:"sortorder"`
Createdby int `json:"createdby"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
Image string `json:"image"`
}

218
models/tenant.go Normal file
View File

@@ -0,0 +1,218 @@
package models
import "time"
type Tenantinfo struct {
Tenantid int `json:"tenantid" gorm:"Primary_Key"`
Locationid int `json:"locationid"`
Tenantname string `json:"tenantname"`
Locationname string `json:"locationname"`
Tenanttype string `json:"tenanttype"`
Registrationno string `json:"registrationno"`
Tenanttoken string `json:"tenanttoken"`
Companyname string `json:"companyname"`
Primaryemail string `json:"primaryemail"`
Primarycontact string `json:"primarycontact"`
Locationcatact string `json:"locationcontact"`
Categoryid int `json:"categoryid"`
Subcategoryid int `json:"subcategoryid"`
Address string `json:"address"`
Suburb string `json:"suburb"`
City string `json:"city"`
State string `json:"state"`
Postcode string `json:"postcode"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
Tenantimage string `json:"tenantimage"`
Tenantinfo string `json:"tenantinfo"`
Paymenttype int `json:"paymenttype"`
Paymode1 int `json:"paymode1"`
Paymode2 int `json:"paymode2"`
Promotion int `json:"promotion"`
Partnerid int `json:"partnerid"`
Minorder int `json:"minorder"`
Applocationid int `json:"applolcationid"`
Applocation string `json:"applocation"`
Approved int `json:"approved"`
Moduleid int `json:"moduleid"`
Subcategoryname string `json:"subcategoryname"`
Firstname string `json:"firstname"`
Lastname string `json:"lastname"`
Accountname string `json:"Accountname"`
Status string `json:"status"`
Allocationid int `json:"allocationid"`
Allocationtype string `json:"allocationtype"`
Allocationmode int `json:"allocationmode"`
}
type Tenantlocations struct {
Locationid int `json:"locationid" gorm:"Primary_Key"`
Tenantid int `json:"tenantid"`
Applocationid int `json:"applocationid"`
Moduleid int `json:"moduleid"`
Roleid int `json:"roleid" gorm:"-"`
Locationname string `json:"locationname"`
Email string `json:"email"`
Contactno string `json:"contactno"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
Address string `json:"address"`
Suburb string `json:"suburb"`
City string `json:"city"`
State string `json:"state"`
Postcode string `json:"postcode"`
Opentime string `json:"opentime"`
Closetime string `json:"closetime"`
Partnerid int `json:"partnerid"`
Deliveryradius int `json:"deliveryradius"`
Deliverymins int `json:"deliverymins"`
Cancelsecs int `json:"cancelsecs"`
Status string `json:"status" gorm:"default:Active"`
}
type Tenantslot struct {
Slot1 string `json:"slot1"`
Slot2 string `json:"slot2"`
Slot3 string `json:"slot3"`
}
type CreateTenantCustomerRequest struct {
ModuleID int `json:"moduleid"`
TenantID int `json:"tenantid"`
LocationID int `json:"locationid"`
CustomerID int `json:"customerid"`
CustomerLocationID int `json:"customerlocationid"`
Status int `json:"status"`
}
type Tenantcustomer struct {
TenantCustomerID int `json:"tenantcustomerid" gorm:"primaryKey;column:tenantcustomerid"`
ModuleID int `json:"moduleid" gorm:"column:moduleid"`
TenantID int `json:"tenantid" gorm:"column:tenantid"`
LocationID int `json:"locationid" gorm:"column:locationid"`
CustomerID int `json:"customerid" gorm:"column:customerid"`
CustomerLocationID int `json:"customerlocationid" gorm:"column:customerlocationid"`
Status int `json:"status" gorm:"column:status"`
Created time.Time `json:"created" gorm:"column:created;autoCreateTime"`
Updated time.Time `json:"updated" gorm:"column:updated;autoUpdateTime"`
}
type CustomerTenantResponse struct {
// Customer Customers `json:"customer"`
Details []TenantInfo `json:"details"`
}
type Tenantpricing struct {
Tenantpricingid int `json:"tenantpricingid" gorm:"Primary_Key"`
Pricingid int `json:"pricingid"`
Tenantid int `json:"tenantid"`
Applocationid int `json:"applocationid"`
Pricingtypeid int `json:"pricingtypeid"`
Slab string `json:"slab"`
Configid int `json:"configid"`
Pricingdate string `json:"pricingdate"`
Baseprice float32 `json:"baseprice"`
Priceperkm float32 `json:"priceperkm"`
Minkm int `json:"minkm"`
Maxkm int `json:"maxkm"`
Orders int `json:"orders"`
Othercharges float32 `json:"othercharges"`
}
type StaffInfo struct {
Userid int `json:"userid"`
Authname string `json:"authname"`
Configid int `json:"configid"`
Authmode int `json:"authmode"`
Roleid int `json:"roleid"`
Firstname string `json:"firstname"`
Lastname string `json:"lastname"`
Fullname string `json:"fullname"`
Password string `json:"password"`
Email string `json:"email"`
Contactno string `json:"contactno"`
Address string `json:"address"`
Suburb string `json:"suburb"`
City string `json:"city"`
State string `json:"state"`
Postcode string `json:"postcode"`
Userfcmtoken string `json:"userfcmtoken"`
Pin int `json:"pin"`
Applocationid int `json:"applocationid"`
Partnerid int `json:"partnerid"`
Tenantid int `json:"tenantid"`
Locationid int `json:"locationid"`
Locationname string `json:"locationname"`
}
type Tenantuser struct {
Userid int `json:"userid" gorm:"Primary_Key"`
Authname string `json:"authname"`
Firstname string `json:"firstname"`
Lastname string `json:"lastname"`
Password string `json:"password"`
Email string `json:"email"`
Dialcode string `json:"dialcode"`
Contactno string `json:"contactno"`
Configid int `json:"configid"`
Authmode int `json:"authmode"`
Roleid int `json:"roleid"`
Pin int `json:"pin"`
Deviceid string `json:"deviceid"`
Devicetype string `json:"devicetype"`
Userfcmtoken string `json:"userfcmtoken"`
Address string `json:"address"`
Suburb string `json:"suburb"`
City string `json:"city"`
State string `json:"state"`
Postcode string `json:"postcode"`
Partnerid int `json:"partnerid"`
Tenantid int `json:"tenantid"`
Locationid int `json:"locationid"`
Applocationid int `json:"applocationid"`
Status string `json:"status"`
}
type Tenants struct {
Tenantid int `json:"tenantid" gorm:"Primary_Key"`
Tenantname string `json:"tenantname"`
Configid int `json:"configid"`
Partnerid int `json:"partnerid"`
Moduleid int `json:"moduleid"`
Tenanttype string `json:"tenanttype"`
Registrationno string `json:"registrationno"`
Tenanttoken string `json:"tenanttoken"`
Companyname string `json:"companyname"`
Devicetype string `json:"devicetype"`
Deviceid string `json:"deviceid"`
Firstname string `json:"firstname"`
Primaryemail string `json:"primaryemail"`
Primarycontact string `json:"primarycontact"`
Categoryid int `json:"categoryid"`
Subcategoryid int `json:"subcategoryid"`
Address string `json:"address"`
Suburb string `json:"suburb"`
City string `json:"city"`
State string `json:"state"`
Postcode string `json:"postcode"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
Tenantimage string `json:"tenantimage"`
Tenantinfo string `json:"tenantinfo"`
Paymode1 int `json:"paymode1"`
Paymode2 int `json:"paymode2"`
Promotion int `json:"promotion"`
Minorder int `json:"minorder"`
Applocationid int `json:"applocationid"`
Approved *int `json:"approved" gorm:"default:0"`
Status string `json:"status" gorm:"default:Active"`
Partneruserid int `json:"partneruserid"`
Tenantlocations Tenantlocations `json:"tenantlocations" gorm:"ForeignKey:tenantid"`
// Tenantsubscriptions Tenantsubscriptions `json:"tenantsubscriptions" gorm:"ForeignKey:tenantid"`
}
type TenantSearch struct {
Tenantname string `json:"tenantname"`
Productname string `json:"productname"`
Subcatname string `json:"subcatname"`
}

102
models/users.go Normal file
View File

@@ -0,0 +1,102 @@
package models
type UserInfo struct {
Userid int `json:"userid"`
Authname string `json:"authname"`
Configid int `json:"configid"`
Authmode int `json:"authmode"`
Roleid int `json:"roleid"`
Firstname string `json:"firstname"`
Lastname string `json:"lastname"`
Fullname string `json:"fullname"`
Password string `json:"password"`
Email string `json:"email"`
Contactno string `json:"contactno"`
Address string `json:"address"`
Suburb string `json:"suburb"`
City string `json:"city"`
State string `json:"state"`
Postcode string `json:"postcode"`
Userfcmtoken string `json:"userfcmtoken"`
Shiftid int `json:"shiftid"`
Shiftname string `json:"shiftname"`
Pin int `json:"pin"`
Partnerid int `json:"partnerid"`
Tenantid int `json:"tenantid"`
Locationid int `json:"locationid"`
Applocationid int `json:"applocationid"`
Applocation string `json:"applocation"`
Applatitude string `json:"applatitude"`
Applongitude string `json:"applongitude"`
Appradius int `json:"appradius"`
Status string `json:"status"`
}
type User struct {
Userid int `json:"userid" gorm:"Primary_Key"`
Authname string `json:"authname"`
Firstname string `json:"firstname"`
Lastname string `json:"lastname"`
Password string `json:"password"`
Email string `json:"email"`
Dialcode string `json:"dialcode"`
Contactno string `json:"contactno"`
Configid int `json:"configid"`
Authmode int `json:"authmode"`
Roleid int `json:"roleid"`
Pin int `json:"pin"`
Deviceid string `json:"deviceid"`
Devicetype string `json:"devicetype"`
Userfcmtoken string `json:"userfcmtoken"`
Address string `json:"address"`
Suburb string `json:"suburb"`
City string `json:"city"`
State string `json:"state"`
Postcode string `json:"postcode"`
Partnerid int `json:"partnerid"`
Tenantid int `json:"tenantid"`
Locationid int `json:"locationid"`
Applocationid int `json:"applocationid"`
Status string `json:"status"`
Shiftid int `json:"shiftid"`
}
type TenantUserInfo struct {
Userid int `json:"userid"`
Authname string `json:"authname"`
Configid int `json:"configid"`
Authmode int `json:"authmode"`
Roleid int `json:"roleid"`
Firstname string `json:"firstname"`
Lastname string `json:"lastname"`
Fullname string `json:"fullname"`
Password string `json:"password"`
Email string `json:"email"`
Contactno string `json:"contactno"`
Address string `json:"address"`
Suburb string `json:"suburb"`
City string `json:"city"`
State string `json:"state"`
Postcode string `json:"postcode"`
Userfcmtoken string `json:"userfcmtoken"`
Pin int `json:"pin"`
Partnerid int `json:"partnerid"`
Locationid int `json:"locationid"`
Applocationid int `json:"applocationid"`
Tenantid int `json:"tenantid"`
Tenantname string `json:"tenantname"`
Tenantaddress string `json:"tenantaddress"`
Tenantcity string `json:"tenantcity"`
Tenantpostcode string `json:"tenantpostcode"`
Tenantlat string `json:"tenantlat"`
Tenantlong string `json:"tenantlong"`
Locationname string `json:"locationname"`
Applocation string `json:"applocation"`
Applatitude string `json:"applatitude"`
Applongitude string `json:"applongitude"`
Appradius int `json:"appradius"`
Moduleid int `json:"moduleid"`
Categoryid int `json:"categoryid"`
Categoryname string `json:"categoryname"`
Subcategoryid int `json:"subcategoryid"`
}

84
models/utils.go Normal file
View File

@@ -0,0 +1,84 @@
package models
// Utils model
type Utils struct {
AppVersion string `json:"app_version"`
}
type Apptypes struct {
Apptypeid int `json:"apptypeid"`
Typename string `json:"typename"`
Mapid int `json:"mapid"`
Tag string `json:"tag"`
Status string `json:"status"`
}
type FcmNotification struct {
Title string `json:"title"`
Body string `json:"body"`
}
type Appsubcategories struct {
Subcategoryid int `json:"subcategoryid"`
Categoryid int `json:"categoryid"`
Subcategoryname string `json:"subcategoryname"`
Categoryname string `json:"catgeoryname"`
Moduleid int `json:"moduleid"`
Status string `json:"status"`
}
type Applocations struct {
Applocationid int `json:"applocationid" gorm:"Primary_Key"`
Locationname string `json:"locationname"`
Image string `json:"image"`
City string `json:"city"`
State string `json:"state"`
Postcode string `json:"postcode"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
Opentime string `json:"opentime"`
Closetime string `json:"closetime"`
Radius int `json:"radius"`
Applocationadmins []Applocationadmins `json:"applocationadmins" gorm:"ForeignKey:applocationid"`
}
type Applocationadmins struct {
Applocationconfigid int `json:"applocationconfigid" gorm:"Primary_Key"`
Applocationid int `json:"applocationid"`
Userid int `json:"userid"`
Userfcmtoken string `json:"userfcmtokem"`
Notify string `json:"notify"`
}
type Appconfig struct {
Configid int `json:"configid"`
Appname string `json:"appname"`
Paymentdevkey string `json:"paymentdevkey"`
Paymentlivekey string `json:"paymentlivekey"`
Fcmkey string `json:"fcmkey"`
Googleapikey string `json:"googleapikey"`
Applocationradius int `json:"applocationradius"`
Smsproviderid int `json:"smsproviderid"`
Providerapi string `json:"providerapi"`
Providerkey string `json:"providerkey"`
Sender string `json:"sender"`
Templateid string `json:"templateid"`
Defaultprovider int `json:"defaultprovider"`
Created string `json:"created"`
Updated string `json:"updated"`
}
type AppCategory struct {
Categoryid int `json:"categoryid" gorm:"Primary_Key"`
Categoryname string `json:"categoryname"`
Categorytype int `json:"categorytype"`
Sortorder int `json:"sortorder"`
Imageurl string `json:"imageurl"`
Iconurl string `json:"iconurl"`
Profileurl string `json:"profileurl"`
Crossaxis int `json:"crossaxis"`
Mainaxis int `json:"mainaxis"`
Status string `json:"status"`
Created string `json:"created"`
Updated string `json:"updated"`
}