diff --git a/backend/.gitignore b/backend/.gitignore new file mode 100644 index 0000000..a9a5aec --- /dev/null +++ b/backend/.gitignore @@ -0,0 +1 @@ +tmp diff --git a/backend/api/auth.go b/backend/api/auth.go index 663950c..74d55ce 100644 --- a/backend/api/auth.go +++ b/backend/api/auth.go @@ -27,14 +27,6 @@ type Claims struct { } func HandleLogin(w http.ResponseWriter, r *http.Request) { - // if r.Method != http.MethodPost { - // core.JSONError{ - // Status: core.Error, - // Message: "Method is not allowed", - // }.Respond(w, http.StatusMethodNotAllowed) - // return - // } - if r.Body == nil { core.JSONError{ Status: core.Error, diff --git a/backend/api/delete_user.go b/backend/api/delete_user.go index 996c89d..23f1ffd 100644 --- a/backend/api/delete_user.go +++ b/backend/api/delete_user.go @@ -8,14 +8,6 @@ import ( ) func HandleDeleteUser(w http.ResponseWriter, r *http.Request) { - if r.Method != http.MethodDelete { - core.JSONError{ - Status: core.Error, - Message: "Method is not allowed.", - }.Respond(w, http.StatusMethodNotAllowed) - return - } - uuid := r.PathValue("user_uuid") _, err := core.DB.NewDelete(). Model((*core.User)(nil)). diff --git a/backend/api/get_user.go b/backend/api/get_user.go index 1cf5b75..71b8eb9 100644 --- a/backend/api/get_user.go +++ b/backend/api/get_user.go @@ -8,14 +8,6 @@ import ( ) func HandleGetUser(w http.ResponseWriter, r *http.Request) { - if r.Method != http.MethodGet { - core.JSONError{ - Status: core.Error, - Message: "Method is not allowed.", - }.Respond(w, http.StatusMethodNotAllowed) - return - } - uuid := r.PathValue("user_uuid") var user core.User count, err := core.DB.NewSelect(). diff --git a/backend/api/get_users.go b/backend/api/get_users.go index 12a8179..707807e 100644 --- a/backend/api/get_users.go +++ b/backend/api/get_users.go @@ -9,14 +9,6 @@ import ( ) func HandleGetUsers(w http.ResponseWriter, r *http.Request) { - if r.Method != http.MethodGet { - core.JSONError{ - Status: core.Error, - Message: "Method is not allowed.", - }.Respond(w, http.StatusMethodNotAllowed) - return - } - var users []core.User count, err := core.DB.NewSelect(). Model(&users). diff --git a/backend/api/new_user.go b/backend/api/new_user.go index c450172..0dbd6d2 100644 --- a/backend/api/new_user.go +++ b/backend/api/new_user.go @@ -11,15 +11,6 @@ import ( ) func HandleCreateUser(w http.ResponseWriter, r *http.Request) { - - if r.Method != http.MethodPost { - core.JSONError{ - Status: core.Error, - Message: "This method is not allowed", - }.Respond(w, http.StatusMethodNotAllowed) - return - } - body, err := io.ReadAll(r.Body) if err != nil { core.JSONError{ diff --git a/backend/api/update_user.go b/backend/api/update_user.go index 6dd5256..3c7c915 100644 --- a/backend/api/update_user.go +++ b/backend/api/update_user.go @@ -23,14 +23,6 @@ type UpdateUserArgs struct { } func HandleUpdateUser(w http.ResponseWriter, r *http.Request) { - if r.Method != http.MethodPatch { - core.JSONError{ - Status: core.Error, - Message: "Method is not allowed.", - }.Respond(w, http.StatusMethodNotAllowed) - return - } - var updateArgs UpdateUserArgs body, err := io.ReadAll(r.Body) if err != nil { @@ -94,4 +86,3 @@ func HandleUpdateUser(w http.ResponseWriter, r *http.Request) { Data: user, }.Respond(w, http.StatusOK) } -