-
Notifications
You must be signed in to change notification settings - Fork 13
/
otp_tracker_entity.go
83 lines (71 loc) · 2.83 KB
/
otp_tracker_entity.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package entity
import (
"time"
"github.com/latolukasz/beeorm"
)
const (
OTPTrackerTypeSMS = "sms"
OTPTrackerTypeEmail = "email"
)
type otpTrackerTypeAll struct {
OTPTrackerTypeSMS string
OTPTrackerTypeEmail string
}
var OTPTrackerTypeAll = otpTrackerTypeAll{
OTPTrackerTypeSMS: OTPTrackerTypeSMS,
OTPTrackerTypeEmail: OTPTrackerTypeEmail,
}
const (
OTPTrackerGatewaySendStatusNew = "new"
OTPTrackerGatewaySendStatusGatewayError = "gateway_error"
OTPTrackerGatewaySendStatusSent = "sent"
)
type OTPTrackerGatewaySendStatus struct {
OTPTrackerGatewaySendStatusNew string
OTPTrackerGatewaySendStatusGatewayError string
OTPTrackerGatewaySendStatusSent string
}
var OTPTrackerGatewaySendStatusAll = OTPTrackerGatewaySendStatus{
OTPTrackerGatewaySendStatusNew: OTPTrackerGatewaySendStatusNew,
OTPTrackerGatewaySendStatusGatewayError: OTPTrackerGatewaySendStatusGatewayError,
OTPTrackerGatewaySendStatusSent: OTPTrackerGatewaySendStatusSent,
}
const (
OTPTrackerGatewayVerifyStatusNew = "new"
OTPTrackerGatewayVerifyStatusGatewayError = "gateway_error"
OTPTrackerGatewayVerifyStatusInvalidCode = "invalid_code"
OTPTrackerGatewayVerifyStatusSuccess = "success"
OTPTrackerGatewayVerifyStatusExpired = "expired"
)
type OTPTrackerGatewayVerifyStatus struct {
OTPTrackerGatewayVerifyStatusNewError string
OTPTrackerGatewayVerifyStatusGatewayError string
OTPTrackerGatewayVerifyStatusInvalidCode string
OTPTrackerGatewayVerifyStatusSuccess string
OTPTrackerGatewayVerifyStatusExpired string
}
var OTPTrackerGatewayVerifyStatusAll = OTPTrackerGatewayVerifyStatus{
OTPTrackerGatewayVerifyStatusNewError: OTPTrackerGatewayVerifyStatusNew,
OTPTrackerGatewayVerifyStatusGatewayError: OTPTrackerGatewayVerifyStatusGatewayError,
OTPTrackerGatewayVerifyStatusInvalidCode: OTPTrackerGatewayVerifyStatusInvalidCode,
OTPTrackerGatewayVerifyStatusSuccess: OTPTrackerGatewayVerifyStatusSuccess,
OTPTrackerGatewayVerifyStatusExpired: OTPTrackerGatewayVerifyStatusExpired,
}
type OTPTrackerEntity struct {
beeorm.ORM `orm:"table=otp_tracker"`
ID uint64
Type string `orm:"enum=entity.OTPTrackerTypeAll;required"`
To string `orm:"length=50"`
Code string
GatewayName string
GatewayPriority uint8
GatewaySendStatus string `orm:"enum=entity.OTPTrackerGatewaySendStatusAll;required"`
GatewaySendRequest string `orm:"length=max"`
GatewaySendResponse string `orm:"length=max"`
GatewayVerifyStatus string `orm:"enum=entity.OTPTrackerGatewayVerifyStatusAll;required"`
GatewayVerifyRequest string `orm:"length=max"`
GatewayVerifyResponse string `orm:"length=max"`
RetryCount int
MaxRetriesReached bool
SentAt time.Time `orm:"time"`
}