-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
globals.go
29 lines (23 loc) · 1.12 KB
/
globals.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package view
import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/neoxelox/odin/internal"
"github.com/neoxelox/odin/pkg/model"
)
var (
ExcOTPAlreadySent = internal.NewException(http.StatusForbidden, "ERR_OTP_ALREADY_SENT")
ExcOTPMaxAttempts = internal.NewException(http.StatusForbidden, "ERR_OTP_MAX_ATTEMPTS")
ExcOTPWrongCode = internal.NewException(http.StatusForbidden, "ERR_OTP_WRONG_CODE")
ExcUserAlreadyJoined = internal.NewException(http.StatusForbidden, "ERR_USER_ALREADY_JOINED")
ExcUserNotBelongs = internal.NewException(http.StatusForbidden, "ERR_USER_NOT_BELONGS")
ExcUserNotPermission = internal.NewException(http.StatusForbidden, "ERR_USER_NOT_PERMISSION")
ExcUserAlreadyInvited = internal.NewException(http.StatusForbidden, "ERR_USER_ALREADY_INVITED")
ExcUserAlreadyVoted = internal.NewException(http.StatusForbidden, "ERR_USER_ALREADY_VOTED")
)
func RequestSession(ctx echo.Context) *model.Session {
return ctx.Get(string(model.CONTEXT_SESSION_KEY)).(*model.Session)
}
func RequestUser(ctx echo.Context) *model.User {
return ctx.Get(string(model.CONTEXT_USER_KEY)).(*model.User)
}