summaryrefslogtreecommitdiff
path: root/internal/models/models.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-03-29 14:28:41 +0300
committerGrail Finder <wohilas@gmail.com>2025-03-29 14:28:41 +0300
commitcb8b8e80d774608c6aa7a1d28f6d948828fea806 (patch)
treec6a6b99cb2f03b69d142930ca720c24f22b8351c /internal/models/models.go
parent7a3a73f2a7f2498c61c71f3242a0fcd6c56dfb69 (diff)
Chore: cleaning
Diffstat (limited to 'internal/models/models.go')
-rw-r--r--internal/models/models.go50
1 files changed, 11 insertions, 39 deletions
diff --git a/internal/models/models.go b/internal/models/models.go
index 5bc120b..8dc113c 100644
--- a/internal/models/models.go
+++ b/internal/models/models.go
@@ -1,45 +1,17 @@
package models
-import "time"
-
-type ActionType string
-
-const (
- ActionTypePlus ActionType = "ActionTypePlus"
- ActionTypeMinus ActionType = "ActionTypeMinus"
-)
-
type (
- UserScore struct {
- ID uint32 `db:"id"`
- Username string `db:"username"`
- Password string `db:"password"`
- Actions []Action
- Recommendations []Action
- BurnTime time.Time `db:"burn_time"`
- Score int8 `db:"score"`
- CreatedAt time.Time `db:"created_at"`
+ Question struct {
+ ID uint32
+ Text string
+ Options []string
+ CorrectIndex uint8
+ TopicID uint32
}
- Action struct {
- ID uint32 `db:"id"`
- Name string `db:"name"`
- Magnitude uint8 `db:"magnitude"`
- Repeatable bool `db:"repeatable"`
- Type ActionType `db:"type"`
- Done bool `db:"done"`
- Username string `db:"username"`
- CreatedAt time.Time `db:"created_at"`
+ //
+ Topic struct {
+ ID uint32
+ Name string
+ Level uint32
}
)
-
-func (us *UserScore) UpdateScore(act *Action) {
- switch act.Type {
- case ActionTypePlus:
- us.Score += int8(act.Magnitude)
- if !act.Repeatable {
- act.Done = true
- }
- case ActionTypeMinus:
- us.Score -= int8(act.Magnitude)
- }
-}