upstream sync

This commit is contained in:
Senad Uka
2023-10-10 08:39:50 +02:00
parent 598f706958
commit d3011d77ff
5 changed files with 139 additions and 58 deletions

View File

@@ -111,18 +111,27 @@ func GetContracts(status []string, companyName string, companyAddress string,
return contracts, total, http.StatusOK, nil
}
func UpdateContract(contract models.Contract) (models.Contract, int, error) {
// Update contract
if err := shared.GetDb().Update(contract).Error; err != nil {
log.Printf("UpdateContractByID Error: Could not update contract: %v", err)
return contract, http.StatusInternalServerError, err
}
return GetContractByID(uint64(contract.ID))
func GetContractByID(contractID uint64) (models.Contract, int ,error) {
}
func GetContractByID(contractID uint64) (models.Contract, int, error) {
// Fetch the contract creation date based on contractID
var contract models.Contract
if err := shared.GetDb().Where("id = ?", contractID).First(&contract).Error; err != nil {
log.Printf("GetDeviceData Error: Could not fetch contract: %v", err)
log.Printf("GetContractByID Error: Could not fetch contract: %v", err)
return contract, http.StatusInternalServerError, err
}
return contract , http.StatusOK, nil
return contract, http.StatusOK, nil
}