This commit is contained in:
[Valentino Heman Budiarto]
2026-06-23 00:25:52 +07:00
parent 50795d806e
commit 387b098aad
3 changed files with 6 additions and 177 deletions
+2 -9
View File
@@ -14,9 +14,6 @@ func main() {
// 1. Konek Database
config.ConnectDatabase()
// 🌟 TAMBAHAN UNTUK TIMER: Nyalakan mesin Cron Timer di background
controllers.StartPowerCronWorker()
// 2. AutoMigrate
config.DB.AutoMigrate(&models.User{}, &models.Room{}, &models.Booking{}, &models.ClassSchedule{})
@@ -67,7 +64,7 @@ func main() {
protected.PUT("/schedules/:id", controllers.UpdateSchedule)
protected.DELETE("/schedules/:id", controllers.DeleteSchedule)
}
// 5. Jalur IoT ESP32 & Kontrol Daya
r.POST("/api/sensor/energy", controllers.UpdateRoomPower)
r.POST("/api/hardware/verify", controllers.VerifyHardwareCode)
@@ -76,10 +73,6 @@ func main() {
r.GET("/api/hardware/power-status", controllers.GetPowerStatus)
r.POST("/api/power/global", controllers.GlobalPowerControl)
// 🌟 RUTE BARU UNTUK TIMER AUTO-CUTOFF
r.GET("/api/power/timer", controllers.GetTimerConfig)
r.POST("/api/power/timer", controllers.SetTimerConfig)
r.Run(":8080")
}
@@ -100,4 +93,4 @@ func CORSMiddleware() gin.HandlerFunc {
}
c.Next()
}
}
}