23 lines
472 B
Go
23 lines
472 B
Go
|
package reports
|
||
|
|
||
|
import (
|
||
|
"strconv"
|
||
|
db "ttime/internal/database"
|
||
|
|
||
|
"github.com/gofiber/fiber/v2"
|
||
|
)
|
||
|
|
||
|
func DeleteReport(c *fiber.Ctx) error {
|
||
|
reportID := c.Params("reportID")
|
||
|
reportIDInt, err := strconv.Atoi(reportID)
|
||
|
if err != nil {
|
||
|
return c.Status(400).SendString("Invalid report ID")
|
||
|
}
|
||
|
|
||
|
if err := db.GetDb(c).DeleteReport(reportIDInt); err != nil {
|
||
|
return c.Status(500).SendString((err.Error()))
|
||
|
}
|
||
|
|
||
|
return c.Status(200).SendString("Weekly report deleted")
|
||
|
}
|