feat(http): implement missing findByID methods (#1635)

* feat(http): implement missing methods

* general cleanup
* unify param handling
* handle not found errors
* unify err handlers

* fix(http): fmt type
This commit is contained in:
ze0s 2024-08-29 12:22:03 +02:00 committed by GitHub
parent accc875960
commit acb91e8709
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 379 additions and 422 deletions

View file

@ -20,7 +20,7 @@ type statusResponse struct {
Status int `json:"status,omitempty"`
}
func (e encoder) StatusResponse(w http.ResponseWriter, status int, response interface{}) {
func (e encoder) StatusResponse(w http.ResponseWriter, status int, response any) {
if response != nil {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.WriteHeader(status)
@ -52,7 +52,7 @@ func (e encoder) StatusCreated(w http.ResponseWriter) {
w.WriteHeader(http.StatusCreated)
}
func (e encoder) StatusCreatedData(w http.ResponseWriter, data interface{}) {
func (e encoder) StatusCreatedData(w http.ResponseWriter, data any) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.WriteHeader(http.StatusCreated)