modified: .env
modified: bot.db modified: db/db.go modified: go.mod modified: go.sum modified: handlers/dashboard.go modified: main.go modified: services/openrouter.go modified: templates/dashboard.html
This commit is contained in:
@@ -49,6 +49,26 @@ func TestAIHandler(c *gin.Context) {
|
||||
c.JSON(200, gin.H{"response": response})
|
||||
}
|
||||
|
||||
// Add this to handlers/dashboard.go
|
||||
func CreateAppointmentHandler(c *gin.Context) {
|
||||
var body struct {
|
||||
Phone string `json:"phone"`
|
||||
Date string `json:"date"`
|
||||
}
|
||||
if err := c.BindJSON(&body); err != nil {
|
||||
c.Status(400)
|
||||
return
|
||||
}
|
||||
|
||||
// Use the helper function instead of raw SQL here
|
||||
if err := db.SaveAppointment(body.Phone, body.Date); err != nil {
|
||||
c.JSON(500, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.Status(200)
|
||||
}
|
||||
|
||||
// Manage/Delete Appointment
|
||||
func DeleteAppointmentHandler(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
|
||||
Reference in New Issue
Block a user