// DeleteHandler Remove a post by ID.
DeleteHandler Remove a post by ID.
// DeleteHandler Remove a post by ID .
func (pr *PostRouter) DeleteHandler(w http.ResponseWriter, r *http.Request) {
	idStr := chi.URLParam(r, "id")
	id, err := strconv.Atoi(idStr)
	if err != nil {
		response.HTTPError(w, r, http.StatusBadRequest, err.Error())
		return
	}
	ctx := r.Context()
	err = pr.Repository.Delete(ctx, uint(id))
	if err != nil {
		response.HTTPError(w, r, http.StatusNotFound, err.Error())
		return
	}
	response.JSON(w, r, http.StatusOK, response.Map{})
}
func ( pr * PostRouter ) DeleteHandler ( w http . ResponseWriter , r * http . Request ) { idStr := chi . URLParam ( r , " " ) id , err := strconv . Atoi ( idStr ) if err != nil { response . HTTPError ( w , r , http . StatusBadRequest , err . Error ( ) ) return } ctx := r . Context ( ) err = pr . Repository . Delete ( ctx , uint ( id ) ) if err != nil { response . HTTPError ( w , r , http . StatusNotFound , err . Error ( ) ) return } response . JSON ( w , r , http . StatusOK , response . Map { } ) }
DeleteHandler Remove a post by ID.
DeleteHandler Remove a post by ID .