Added temperature exceded event
This commit is contained in:
@@ -11,20 +11,20 @@ import (
|
||||
)
|
||||
|
||||
func GetNotifications(c *gin.Context) {
|
||||
// Get the User ID and Time from query parameters
|
||||
userIDStr := c.DefaultQuery("user_id", "")
|
||||
// Get the Company ID and Time from query parameters
|
||||
companyIDStr := c.DefaultQuery("company_id", "")
|
||||
timeStr := c.DefaultQuery("time", "")
|
||||
|
||||
if userIDStr == "" || timeStr == "" {
|
||||
log.Printf("GetNotifications Error: User ID and Time are required")
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "User ID and Time are required"})
|
||||
if companyIDStr == "" || timeStr == "" {
|
||||
log.Printf("GetNotifications Error: Company ID and Time are required")
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "Company ID and Time are required"})
|
||||
return
|
||||
}
|
||||
|
||||
// Convert string to int for UserID
|
||||
userID, err := strconv.Atoi(userIDStr)
|
||||
userID, err := strconv.Atoi(companyIDStr)
|
||||
if err != nil {
|
||||
log.Printf("GetNotifications Error: Invalid User ID: %v", err)
|
||||
log.Printf("GetNotifications Error: Invalid Company ID: %v", err)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid User ID"})
|
||||
return
|
||||
}
|
||||
@@ -37,8 +37,8 @@ func GetNotifications(c *gin.Context) {
|
||||
}
|
||||
afterTime := time.Unix(timestamp, 0)
|
||||
|
||||
log.Printf("This is the User ID: %v and Time: %v", userID, afterTime)
|
||||
notifications, st, err := notification.GetNotificationsForUserID(userID, afterTime)
|
||||
log.Printf("This is the Company ID: %v and Time: %v", userID, afterTime)
|
||||
notifications, st, err := notification.GetNotificationsForCompanyID(userID, afterTime)
|
||||
|
||||
if err != nil {
|
||||
c.JSON(st, gin.H{"error": err.Error()})
|
||||
|
||||
Reference in New Issue
Block a user