aboutsummaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
authorAlexander NeonXP Kiryukhin <i@neonxp.ru>2024-07-21 19:26:56 +0300
committerAlexander NeonXP Kiryukhin <i@neonxp.ru>2024-07-21 19:28:56 +0300
commitce3111b0efe91e275ce070f9511b5b1b9801a46d (patch)
tree09fa4f10dfb1e17761339c798eefa73c6b18484f /models
parente9a64f3b41b5eae47dec7c0ecfd1caae83136abc (diff)
Множество улучшенийv0.0.2
Diffstat (limited to 'models')
-rw-r--r--models/node.go1
-rw-r--r--models/user.go9
2 files changed, 10 insertions, 0 deletions
diff --git a/models/node.go b/models/node.go
index 16e426a..98a8d4e 100644
--- a/models/node.go
+++ b/models/node.go
@@ -21,6 +21,7 @@ type Node struct {
CreatedAt int64 `bun:",nullzero,notnull,default:current_timestamp"`
UpdatedAt int64 `bun:",nullzero,notnull,default:current_timestamp"`
DeletedAt int64
+ Children []*Node `bun:"rel:has-many,join:id=parent_id"`
}
var _ bun.BeforeAppendModelHook = (*Node)(nil)
diff --git a/models/user.go b/models/user.go
index 73afdce..73358fe 100644
--- a/models/user.go
+++ b/models/user.go
@@ -18,4 +18,13 @@ type User struct {
Password string
Username string
Photo *string
+ Role UserRole
}
+
+type UserRole int
+
+const (
+ RoleUser UserRole = iota
+ RoleModerator
+ RoleAdmin
+)