Upstream sync

This commit is contained in:
Senad Uka
2023-10-24 05:48:19 +02:00
parent 2c267b71e4
commit fd880aeaa2
8 changed files with 83 additions and 77 deletions

View File

@@ -8,34 +8,34 @@ import (
type Contract struct {
BaseModel
Name string `json:"name"`
DeviceIDs pq.Int64Array `json:"deviceIds" gorm:"type:integer[]"`
BuyerID uint `json:"buyerId"`
SellerID uint `json:"sellerId"`
Description string `json:"description"`
StartPlaceName string `json:"startPlaceName"`
StartLat float64 `json:"startLat"`
StartLon float64 `json:"startLon"`
EndPlaceName string `json:"endPlaceName"`
EndLat float64 `json:"endLat"`
EndLon float64 `json:"endLon"`
StartTime time.Time `json:"startTime"`
EndTime time.Time `json:"endTime"`
Status string `json:"status"`
BlockchainID string `json:"blockchainId"`
ContractInfos []ContractInfo `json:"contractInfos"`
ProductID uint `json:"productId"`
TemplateID uint `json:"templateId"`
MaxTemp float64 `json:"maxTemp"`
MinTemp float64 `json:"minTemp"`
ArrivalDate time.Time `json:"arrivalDate"`
PenaltyType string `json:"penaltyType"`
PenaltyValue int `json:"penaltyValue"`
PenaltyRec string `json:"penaltyRec"`
BuyerName string `json:"buyerName" gorm:"-"`
SellerName string `json:"sellerName" gorm:"-"`
ProductName string `json:"productName" gorm:"-"`
NumberOfDevices int `json:"numberOfDevices" gorm:"-"`
Name string `json:"name"`
DeviceIDs pq.Int64Array `json:"deviceIds" gorm:"type:integer[]"`
BuyerID uint `json:"buyerId"`
SellerID uint `json:"sellerId"`
Description string `json:"description"`
StartPlaceName string `json:"startPlaceName"`
StartLat float64 `json:"startLat"`
StartLon float64 `json:"startLon"`
EndPlaceName string `json:"endPlaceName"`
EndLat float64 `json:"endLat"`
EndLon float64 `json:"endLon"`
StartTime time.Time `json:"startTime"`
EndTime time.Time `json:"endTime"`
Status string `json:"status"`
BlockchainSecret string `json:"blockchainSecret"`
ContractInfos []ContractInfo `json:"contractInfos"`
ProductID uint `json:"productId"`
TemplateID uint `json:"templateId"`
MaxTemp float64 `json:"maxTemp"`
MinTemp float64 `json:"minTemp"`
ArrivalDate time.Time `json:"arrivalDate"`
PenaltyType string `json:"penaltyType"`
PenaltyValue int `json:"penaltyValue"`
PenaltyRec string `json:"penaltyRec"`
BuyerName string `json:"buyerName" gorm:"-"`
SellerName string `json:"sellerName" gorm:"-"`
ProductName string `json:"productName" gorm:"-"`
NumberOfDevices int `json:"numberOfDevices" gorm:"-"`
}
type DashboardContractResponse struct {
@@ -164,7 +164,7 @@ func ConvertContractToContractResponse(contract Contract) ContractResponse {
},
Description: contract.Description,
Status: contract.Status,
BlockchainID: contract.BlockchainID,
BlockchainID: contract.BlockchainSecret,
ContractInfos: contract.ContractInfos,
MaxTemp: contract.MaxTemp,
MinTemp: contract.MinTemp,
@@ -198,7 +198,7 @@ func ConvertContractToDashboardResponse(contracts []Contract) []DashboardContrac
StartTime: contract.StartTime,
EndTime: contract.EndTime,
Status: contract.Status,
BlockchainID: contract.BlockchainID,
BlockchainID: contract.BlockchainSecret,
ContractInfos: contract.ContractInfos,
ProductID: contract.ProductID,
MaxTemp: contract.MaxTemp,
@@ -236,6 +236,7 @@ func ConvertContractToListResponse(contracts []Contract) []ListContractResponse
Status: KeyValue{Key: status.Key, Value: status.Value},
Buyer: CompanyShortResponse{ID: int(contract.BuyerID), Name: contract.BuyerName},
ContractID: int(contract.ID),
ContractName: contract.Name,
DateCreated: contract.CreatedAt,
NumberOfDevices: contract.NumberOfDevices,
}
@@ -280,6 +281,7 @@ type ListContractResponse struct {
Status KeyValue `json:"status"`
Buyer CompanyShortResponse `json:"buyer"`
ContractID int `json:"contractID"`
ContractName string `json:"contractName"`
NumberOfDevices int `json:"numberOfDevices"`
DateCreated time.Time `json:"dateCreated"`
}