changed the delete to handle parameter differently

This commit is contained in:
Nik Afiq 2025-11-22 20:26:30 +09:00
parent d819b04020
commit 009e79332a

View File

@ -121,9 +121,9 @@ func NewRouter(svc service.EpisodeService) *gin.Engine {
c.JSON(http.StatusOK, items)
})
// DELETE /v1/shows/:id — delete a row from "current" by id
v1.DELETE("/shows/:id", func(c *gin.Context) {
idStr := c.Param("id")
// DELETE /v1/shows — delete a row from "current" by id
v1.DELETE("/shows", func(c *gin.Context) {
idStr := c.Query("id")
id, err := strconv.ParseInt(idStr, 10, 64)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "invalid id"})