diff options
author | Alexander NeonXP Kiryukhin <i@neonxp.ru> | 2024-07-21 19:26:56 +0300 |
---|---|---|
committer | Alexander NeonXP Kiryukhin <i@neonxp.ru> | 2024-07-21 19:28:56 +0300 |
commit | ce3111b0efe91e275ce070f9511b5b1b9801a46d (patch) | |
tree | 09fa4f10dfb1e17761339c798eefa73c6b18484f /models | |
parent | e9a64f3b41b5eae47dec7c0ecfd1caae83136abc (diff) |
Множество улучшенийv0.0.2
Diffstat (limited to 'models')
-rw-r--r-- | models/node.go | 1 | ||||
-rw-r--r-- | models/user.go | 9 |
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 +) |