-
Notifications
You must be signed in to change notification settings - Fork 1
/
db_model.go
38 lines (34 loc) · 1.06 KB
/
db_model.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
package main
import (
"github.com/jinzhu/gorm"
"time"
)
type User struct {
ID int `gorm:"primary_key;AUTO_INCREMENT:false"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt *time.Time `sql:"index"`
RBInfo RuBoardInfo
RBInfoID uint
UserID int // Telegram user ID
UserName string // Telegram user name
ChatID int64 // Chat ID with user
Registered bool // User pass registration procedure
LastCommand string // Last command to track multistep commands
}
// RU-Board user information
type RuBoardInfo struct {
gorm.Model
Login string `gorm:"size:50"` // Forum login
RegisteredAt *time.Time // Registration date
ConfirmationCode string // Generated registration confirmation code
ConfirmTryCount int // Confirmation try count
RegPoints int
WarezPoints int
BonusPoints int
TotalPoints int
PointsCheckedAt *time.Time // When last message count check was performed
}
func (i *RuBoardInfo) RecalcPoints() {
i.TotalPoints = i.RegPoints + i.WarezPoints + i.BonusPoints
}