diff options
| author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-10-12 23:30:08 +0530 | 
|---|---|---|
| committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-10-12 23:30:08 +0530 | 
| commit | 327a32f563394f92313e4a751515d69d90f4e7f5 (patch) | |
| tree | 9b49fd41ac852fa459b623f7fbe7c79aaac24418 /user/user.go | |
| parent | 029fe2c7a3532bc3bf435f257cdade240c8f3568 (diff) | |
formatted code
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;"`  }  |