refactor: use GetValidatedDTO for user create validation
This commit is contained in:
@@ -93,9 +93,8 @@ func (h *UserHandler) GetUser(w http.ResponseWriter, r *http.Request) {
|
|||||||
// @Failure 500 {object} UserResponse "Internal server error"
|
// @Failure 500 {object} UserResponse "Internal server error"
|
||||||
// @Router /api/users [post]
|
// @Router /api/users [post]
|
||||||
func (h *UserHandler) CreateUser(w http.ResponseWriter, r *http.Request) {
|
func (h *UserHandler) CreateUser(w http.ResponseWriter, r *http.Request) {
|
||||||
req, ok := GetValidatedDTO[dto.RegisterRequest](r)
|
req, ok := GetValidatedDTO[dto.RegisterRequest](w, r)
|
||||||
if !ok {
|
if !ok {
|
||||||
SendErrorResponse(w, "Invalid request", http.StatusBadRequest)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user