diff options
Diffstat (limited to 'user/user.go')
-rw-r--r-- | user/user.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/user/user.go b/user/user.go index 4d0ffcb..8f321eb 100644 --- a/user/user.go +++ b/user/user.go @@ -18,16 +18,17 @@ package user import ( - d "vidhukant.com/openbills/db" - e "vidhukant.com/openbills/errors" + "errors" + "github.com/spf13/viper" "golang.org/x/crypto/bcrypt" "gorm.io/gorm" - "github.com/spf13/viper" - "errors" + d "vidhukant.com/openbills/db" + e "vidhukant.com/openbills/errors" ) var COST int var db *gorm.DB + func init() { db = d.DB @@ -36,7 +37,7 @@ func init() { COST = viper.GetInt("cryptography.password_hashing_cost") } -var VALID_ROLES []string = []string { +var VALID_ROLES []string = []string{ "customer.*", "customer.read", "customer.write", "customer.delete", "item.*", "item.read", "item.write", "item.delete", "invoice.*", "invoice.read", "invoice.write", "invoice.delete", @@ -52,8 +53,8 @@ type Role struct { type User struct { ID uint TokenVersion uint // this can be incremented to disable existing refresh token(s) - Username string - Email string + Username string + Email string Password string Roles []Role `gorm:"constraint:OnDelete:CASCADE;"` } |