Files
doormile_backend/models/transit.go
2026-06-22 17:43:40 +05:30

63 lines
3.4 KiB
Go

package models
import (
"time"
)
type Tripsheet struct {
Tripsheetid int `json:"tripsheetid" gorm:"primaryKey;column:tripsheetid"`
Tripsheetno string `json:"tripsheetno" gorm:"column:tripsheetno;unique;not null"`
Sourcehubid int `json:"sourcehubid" gorm:"column:sourcehubid;not null"`
Destinationhubid int `json:"destinationhubid" gorm:"column:destinationhubid;not null"`
Vehicleid *int `json:"vehicleid" gorm:"column:vehicleid"`
Driveruserid *int `json:"driveruserid" gorm:"column:driveruserid"`
Dispatchtime *time.Time `json:"dispatchtime" gorm:"column:dispatchtime"`
Arrivaltime *time.Time `json:"arrivaltime" gorm:"column:arrivaltime"`
Status string `json:"status" gorm:"column:status;default:Draft"` // Draft, Dispatched, Arrived, Cancelled
Createdat time.Time `json:"createdat" gorm:"column:createdat;default:CURRENT_TIMESTAMP"`
Updatedat time.Time `json:"updatedat" gorm:"column:updatedat;default:CURRENT_TIMESTAMP"`
Createdby int `json:"createdby" gorm:"column:createdby"`
Updatedby int `json:"updatedby" gorm:"column:updatedby"`
Deletedat *time.Time `json:"deletedat,omitempty" gorm:"column:deletedat"`
}
func (Tripsheet) TableName() string {
return "tripsheets"
}
type TripsheetItem struct {
Tripsheetitemid int `json:"tripsheetitemid" gorm:"primaryKey;column:tripsheetitemid"`
Tripsheetid int `json:"tripsheetid" gorm:"column:tripsheetid;not null"`
Consignmentid int `json:"consignmentid" gorm:"column:consignmentid;not null"`
Scanstatus string `json:"scanstatus" gorm:"column:scanstatus;default:Pending"` // Pending, Loaded, Unloaded, Discrepancy
Scannedat *time.Time `json:"scannedat" gorm:"column:scannedat"`
Createdat time.Time `json:"createdat" gorm:"column:createdat;default:CURRENT_TIMESTAMP"`
Updatedat time.Time `json:"updatedat" gorm:"column:updatedat;default:CURRENT_TIMESTAMP"`
Createdby int `json:"createdby" gorm:"column:createdby"`
Updatedby int `json:"updatedby" gorm:"column:updatedby"`
Deletedat *time.Time `json:"deletedat,omitempty" gorm:"column:deletedat"`
}
func (TripsheetItem) TableName() string {
return "tripsheetitems"
}
type DeliveryProof struct {
Proofid int `json:"proofid" gorm:"primaryKey;column:proofid"`
Consignmentid int `json:"consignmentid" gorm:"column:consignmentid;unique;not null"`
Tripsheetid *int `json:"tripsheetid" gorm:"column:tripsheetid"`
Deliveredat time.Time `json:"deliveredat" gorm:"column:deliveredat;not null"`
Deliveredtoname string `json:"deliveredtoname" gorm:"column:deliveredtoname;not null"`
Receiversignatureurl string `json:"receiversignatureurl" gorm:"column:receiversignatureurl"`
Photourl string `json:"photourl" gorm:"column:photourl"`
Otpverified bool `json:"otpverified" gorm:"column:otpverified;default:false"`
Geolatitude float64 `json:"geolatitude" gorm:"column:geolatitude"`
Geolongitude float64 `json:"geolongitude" gorm:"column:geolongitude"`
Createdat time.Time `json:"createdat" gorm:"column:createdat;default:CURRENT_TIMESTAMP"`
Createdby int `json:"createdby" gorm:"column:createdby"`
}
func (DeliveryProof) TableName() string {
return "deliveryproofs"
}