Enhance cursor rules and add user management functionality
- Updated cursor rules to emphasize the importance of dependency injection and logging practices. - Introduced a new user management domain, including entities, services, handlers, and validation. - Implemented user authentication features such as login, registration, and role-based access control. - Added Redis integration for token management and caching. - Enhanced API documentation with Swagger for user-related endpoints. - Updated configuration to support new JWT settings and Redis connection parameters.
This commit is contained in:
@@ -3,6 +3,7 @@ package response
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/asaskevich/govalidator"
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
@@ -156,3 +157,17 @@ func ServiceUnavailable(c echo.Context, message string) error {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// Parse parses the form and validates it
|
||||
func Parse[T any](c echo.Context) (*T, error) {
|
||||
var form T
|
||||
if err := c.Bind(&form); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if _, err := govalidator.ValidateStruct(form); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &form, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user