de30497f59
- Implemented tenant and user management features including: - Tenant creation and management with associated migrations. - User creation and management with associated migrations. - Tenant membership management with associated migrations. - Platform user roles management with associated migrations. - Quota management with associated migrations. - Article and template management with associated migrations. - Added HTTP handlers for templates and workspaces. - Created tests for protected and public routes. - Introduced a script to check tenant scope in SQL queries. - Documented task plan for backend completion and frontend foundation.
36 lines
1.4 KiB
Go
36 lines
1.4 KiB
Go
package response
|
|
|
|
import "net/http"
|
|
|
|
func ErrBadRequest(code int, message, detail string) *AppError {
|
|
return &AppError{HTTPStatus: http.StatusBadRequest, Code: code, Message: message, Detail: detail}
|
|
}
|
|
|
|
func ErrUnauthorized(code int, message, detail string) *AppError {
|
|
return &AppError{HTTPStatus: http.StatusUnauthorized, Code: code, Message: message, Detail: detail}
|
|
}
|
|
|
|
func ErrForbidden(code int, message, detail string) *AppError {
|
|
return &AppError{HTTPStatus: http.StatusForbidden, Code: code, Message: message, Detail: detail}
|
|
}
|
|
|
|
func ErrNotFound(code int, message, detail string) *AppError {
|
|
return &AppError{HTTPStatus: http.StatusNotFound, Code: code, Message: message, Detail: detail}
|
|
}
|
|
|
|
func ErrConflict(code int, message, detail string) *AppError {
|
|
return &AppError{HTTPStatus: http.StatusConflict, Code: code, Message: message, Detail: detail}
|
|
}
|
|
|
|
func ErrTooManyRequests(code int, message, detail string) *AppError {
|
|
return &AppError{HTTPStatus: http.StatusTooManyRequests, Code: code, Message: message, Detail: detail}
|
|
}
|
|
|
|
func ErrInternal(code int, message, detail string) *AppError {
|
|
return &AppError{HTTPStatus: http.StatusInternalServerError, Code: code, Message: message, Detail: detail}
|
|
}
|
|
|
|
func ErrServiceUnavailable(code int, message, detail string) *AppError {
|
|
return &AppError{HTTPStatus: http.StatusServiceUnavailable, Code: code, Message: message, Detail: detail}
|
|
}
|