upstream sync

This commit is contained in:
Senad Uka
2023-10-17 10:32:52 +02:00
parent 3cff15ed25
commit 7c3407c86d
6 changed files with 56 additions and 33 deletions

View File

@@ -33,6 +33,8 @@ type Contract struct {
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:"-"`
}
@@ -91,11 +93,6 @@ type ContractResponse struct {
ID uint `json:"id"`
Name string `json:"name"`
} `json:"product"`
Template struct {
ID uint `json:"id"`
Name string `json:"name"`
Value string `json:"value"`
} `json:"template"`
Description string `json:"description"`
Status string `json:"status"`
BlockchainID string `json:"blockchainId"`
@@ -118,7 +115,6 @@ func ConvertContractsToContractResponse(contracts []Contract) []ContractResponse
}
func ConvertContractToContractResponse(contract Contract) ContractResponse {
contractResponse := ContractResponse{
BaseModel: BaseModel{ID: contract.ID, CreatedAt: contract.CreatedAt, UpdatedAt: contract.UpdatedAt},
Name: contract.Name,
@@ -128,12 +124,14 @@ func ConvertContractToContractResponse(contract Contract) ContractResponse {
Name string "json:\"name\""
}{
ID: contract.SellerID,
Name: contract.SellerName,
},
Buyer: struct {
ID uint "json:\"id\""
Name string "json:\"name\""
}{
ID: contract.BuyerID,
Name: contract.BuyerName,
},
Start: struct {
Name string "json:\"name\""
@@ -162,13 +160,7 @@ func ConvertContractToContractResponse(contract Contract) ContractResponse {
Name string "json:\"name\""
}{
ID: contract.ProductID,
},
Template: struct {
ID uint "json:\"id\""
Name string "json:\"name\""
Value string "json:\"value\""
}{
ID: contract.TemplateID,
Name: contract.ProductName,
},
Description: contract.Description,
Status: contract.Status,