Upstream sync

This commit is contained in:
Senad Uka
2023-10-13 11:48:14 +02:00
parent 7369739bdd
commit d01c1a0232
29 changed files with 563 additions and 444 deletions

View File

@@ -57,7 +57,7 @@ func SaveDeviceInfo(c *gin.Context) {
} else {
log.Printf("Current device deleted at: %v", device.DeletedAt)
if device.DeletedAt != nil {
if device.DeletedAt.Valid {
// Use raw SQL to update the record
if err := shared.GetDb().Exec("UPDATE devices SET deleted_at = NULL, company_id = NULL WHERE id = ?", device.ID).Error; err != nil {
log.Printf("UNDELETE -Device DB Error: %v", err)
@@ -161,5 +161,5 @@ func GetDevicesByContract(c *gin.Context) {
return
}
// Respond with the devices
c.JSON(http.StatusOK,gin.H{"data" : models.ConvertDeviceToResponse(devices)})
c.JSON(http.StatusOK, gin.H{"data": models.ConvertDeviceToResponse(devices)})
}