Small improvements

This commit is contained in:
cdricms
2025-01-16 14:42:20 +01:00
parent 9bbd992e95
commit 2fc8a3f347
7 changed files with 1 additions and 50 deletions

1
backend/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
tmp

View File

@@ -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,

View File

@@ -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)).

View File

@@ -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().

View File

@@ -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).

View File

@@ -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{

View File

@@ -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)
}