fix: make user signup work for the minimum
A lot of work is still to be done ...
This commit is contained in:
		@ -22,6 +22,18 @@
 | 
			
		||||
 | 
			
		||||
package core
 | 
			
		||||
 | 
			
		||||
import "time"
 | 
			
		||||
 | 
			
		||||
type Context interface {
 | 
			
		||||
	// Context
 | 
			
		||||
	Deadline() (deadline time.Time, ok bool)
 | 
			
		||||
	Done() <-chan struct{}
 | 
			
		||||
	Err() error
 | 
			
		||||
	Value(key any) any
 | 
			
		||||
 | 
			
		||||
	// Request
 | 
			
		||||
	Bind(obj any) error
 | 
			
		||||
 | 
			
		||||
	// Response
 | 
			
		||||
	JSON(code int, obj any)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -24,18 +24,28 @@ package errno
 | 
			
		||||
 | 
			
		||||
import "net/http"
 | 
			
		||||
 | 
			
		||||
type PlatformLevelErrCode string
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	InternalErrorCode    = "InternalError"
 | 
			
		||||
	InvalidParameterCode = "InvalidParameter"
 | 
			
		||||
	AuthFailureCode      = "AuthFailure"
 | 
			
		||||
	ResourceNotFoundCode = "ResourceNotFound"
 | 
			
		||||
	FailedOperationCode  = "FailedOperation"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	OK = &Errno{HTTP: http.StatusOK, Code: "", Message: ""}
 | 
			
		||||
 | 
			
		||||
	InternalServerErr = &Errno{
 | 
			
		||||
		HTTP:    http.StatusInternalServerError,
 | 
			
		||||
		Code:    "InternalError",
 | 
			
		||||
		Code:    InternalErrorCode,
 | 
			
		||||
		Message: "Internal server error",
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	PageNotFoundErr = &Errno{
 | 
			
		||||
		HTTP:    http.StatusNotFound,
 | 
			
		||||
		Code:    "ResourceNotFound.PageNotFound",
 | 
			
		||||
		Code:    ErrorCode(ResourceNotFoundCode, "PageNotFound"),
 | 
			
		||||
		Message: "Page not found",
 | 
			
		||||
	}
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@ -28,6 +28,10 @@ type Errno struct {
 | 
			
		||||
	Message string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func ErrorCode(platformErrCode string, resourceErrCode string) string {
 | 
			
		||||
	return platformErrCode + "." + resourceErrCode
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Error implements Error() method in error interface
 | 
			
		||||
func (err *Errno) Error() string {
 | 
			
		||||
	return err.Message
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user