Files
backend_jupiter/models/tenant.go
2026-05-25 11:45:56 +05:30

411 lines
17 KiB
Go

package models
import "time"
type TenantResult struct {
Status bool `json:"status"`
Code int `json:"code"`
Message string `json:"message"`
Details Tenants `json:"Details"`
}
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 TenantUser struct {
Tenantid int `json:"tenantid" gorm:"Primary_Key"`
Tenantname string `json:"tenantname"`
Tenanttype string `json:"tenanttype"`
Registrationno string `json:"registrationno"`
Tenanttoken string `json:"tenanttoken"`
Companyname string `json:"companyname"`
Primaryperson string `json:"primaryperson"`
Primaryemail string `json:"primaryemail"`
Primarycontact string `json:"primarycontact"`
Bizcategoryid int `json:"Bizcategoryid"`
Bizsubcategoryid int `json:"Bizsubcategoryid"`
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"`
Partnerid int `json:"partnerid"`
Minorder int `json:"minorder"`
Applocationid int `json:"applocationid"`
Approved int `json:"approved"`
Moduleid int `json:"moduleid"`
Tenantlocations Tenantlocations `json:"tenantlocations" gorm:"ForeignKey:tenantid"`
Tenantsubscriptions Tenantsubscriptions `json:"tenantsubscriptions" gorm:"ForeignKey:tenantid"`
}
type Tenantinfo struct {
Tenantid int `json:"tenantid" gorm:"Primary_Key"`
Locationid int `json:"locationid"`
Tenantname string `json:"tenantname"`
Tenanttype string `json:"tenanttype"`
Registrationno string `json:"registrationno"`
Tenanttoken string `json:"tenanttoken"`
Companyname string `json:"companyname"`
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"`
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"`
Categoryname string `json:"categoryname"`
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"`
Slab string `json:"slab"`
Pricingdate string `json:"pricingdate"`
Baseprice float32 `json:"baseprice"`
Minkm int `json:"minkm"`
Priceperkm float32 `json:"priceperkm"`
Maxkm int `json:"maxkm"`
Orders int `json:"orders"`
Othercharges float32 `json:"othercharges"`
Surgecharges float32 `json:"surgecharges"`
}
type Tenantsubscriptions struct {
Subscriptionid int `json:"subscriptionid" gorm:"Primary_Key"`
Tenantid int `json:"tenantid"`
Transactiondate string `json:"transactiondate"`
Moduleid int `json:"moduleid"`
Applocationid int `json:"applocationid"`
Promoid int `json:"promoid"`
Categoryid int `json:"categoryid"`
Subcategoryid int `json:"subcategoryid"`
Promoprice float32 `json:"float32"`
Subscriptionprice float32 `json:"subscriptionprice"`
Quantity int `json:"quantity"`
Taxpercent int `json:"taxpercent"`
Taxamount float32 `json:"taxamount"`
Totalamount float32 `json:"totalamount"`
Validitydate string `json:"validitydate"`
}
type Tenantlocationinfo struct {
Locationid int `json:"locationid" gorm:"Primary_Key"`
Tenantid int `json:"tenantid"`
Moduleid int `json:"moduleid"`
Locationname string `json:"locationname"`
Locationemail string `json:"locationemail" gorm:"column:email"`
Locationcontact string `json:"locationcontact" gorm:"column:contactno"`
Locationlatitude string `json:"locationlatitude" gorm:"column:latitude"`
Locationlong string `json:"locationlong" gorm:"column:longitude"`
Locationaddress string `json:"locationaddress" gorm:"column:address"`
Locationsuburb string `json:"locationsuburb" gorm:"column:suburb"`
Locationstate string `json:"locationstate" gorm:"column:state"`
Locationcity string `json:"locationcity" gorm:"column:city"`
Locationpostcode string `json:"locationpostcode" gorm:"column: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"`
Applocationid int `json:"applocationid"`
Slot1 string `json:"slot1"`
Slot2 string `json:"slot2"`
Slot3 string `json:"slot3"`
Status string `json:"status"`
Roleid int `json:"roleid"`
}
func (Tenantlocationinfo) TableName() string {
return "tenantlocations"
}
type Tenantslot struct {
// Slotid int `json:"slotid" gorm:"Primary_Key"`
Slot1 string `json:"slot1"`
Slot2 string `json:"slot2"`
Slot3 string `json:"slot3"`
}
type TenantLocationSummary struct {
Locationid int `json:"locationid"`
Locationname string `json:"locationname"`
Locationsuburb string `json:"locationsuburb"`
Total int `json:"total"`
Created int `json:"created"`
Pending int `json:"pending"`
Delivered int `json:"delivered"`
Cancelled int `json:"cancelled"`
}
type Tenantlocations struct {
Locationid int `json:"locationid" gorm:"Primary_Key"`
Tenantid int `json:"tenantid"`
Applocationid int `json:"applocationid"`
Moduleid int `json:"moduleid"`
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"`
Slot1 string `json:"slot1"`
Slot2 string `json:"slot2"`
Slot3 string `json:"slot3"`
Slot4 string `json:"slot4"`
Slot5 string `json:"slot5"`
Status string `json:"status" gorm:"default:Active"`
}
type Tenantlocation struct {
Locationid int `json:"locationid" gorm:"Primary_Key"`
Tenantid int `json:"tenantid"`
Applocationid int `json:"applocationid"`
Moduleid int `json:"moduleid"`
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 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"`
Surgecharges float32 `json:"surgecharges"`
}
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"`
}
// If needed, define the table name explicitly
func (TenantCustomer) TableName() string {
return "tenantcustomers"
}
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 CustomerInfo struct {
// Customerid int `json:"customerid"`
// Customername string `json:"customername"`
// Contactno string `json:"contactno"`
// }
// type TenantInfo struct {
// Tenantid int `json:"tenantid"`
// Tenantname string `json:"tenantname"`
// }
type CustomerTenantResponse struct {
Customer Customers `json:"customer"`
// Tenants []TenantInfo `json:"tenants"`
Tenantlocations []LocationDetails `json:"locations"`
}
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 LocationSummary struct {
ActiveCount int `json:"active"`
InactiveCount int `json:"inactive"`
TotalCount int `json:"total"`
}
type TenantUserSummary struct {
ActiveCount int `json:"active"`
InactiveCount int `json:"inactive"`
TotalCount int `json:"total"`
}
type TenantRequest struct {
Requestid int `json:"requestid"`
Requestdate time.Time `json:"requestdate"`
Requesttype int `json:"requesttype"`
Subject string `json:"subject"`
Apptypeid int `json:"apptypeid"`
Userid int `json:"userid"`
Tenantid int `json:"tenantid"`
Referenceid int `json:"referenceid"`
Referencetype string `json:"referencetype"`
Remarks string `json:"remarks"`
Resolution string `json:"resolution"`
Orderheaderid int `json:"orderheaderid"`
Eventname string `json:"eventname"`
Status int `json:"status"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
}
type LocationDetails struct {
Locationid int `json:"locationid"`
Locationname string `json:"locationname"`
Tenantid int `json:"tenantid"`
Tenantname string `json:"tenantname"`
Address string `json:"address"`
Email string `json:"email"`
Contactno string `json:"contactno"`
Applocationid int `json:"applocationid"`
Suburb string `json:"suburb"`
City string `json:"city"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
Postcode string `json:"postcode"`
}
type Tenantpromotions struct {
Promotionid int `json:"promotionid" gorm:"primaryKey"`
Promotiontypeid int `json:"promotiontypeid"`
Tenantid int `json:"tenantid"`
Locationid []string `json:"locationid" gorm:"-"`
LocationidStr string `json:"-" gorm:"column:locationid"`
Applocationid int `json:"applocationid"`
Moduleid int `json:"moduleid"`
Categoryid int `json:"categoryid"`
Promoname string `json:"promoname"`
Promocode string `json:"promocode"`
Description string `json:"description"`
Product string `json:"product"`
Productimage string `json:"productimage"`
Promoamount float32 `json:"promoamount"`
Promovalue float32 `json:"promovalue"`
Purchasevalue float32 `json:"purchasevalue"`
Startdate string `json:"startdate"`
Enddate string `json:"enddate"`
}