merged main, dev, and i guess got accounts working??
i am so good at commit messages :3
This commit is contained in:
commit
5566a795da
53 changed files with 1366 additions and 398 deletions
43
model/account.go
Normal file
43
model/account.go
Normal file
|
@ -0,0 +1,43 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type (
|
||||
Account struct {
|
||||
ID string `json:"id" db:"id"`
|
||||
Username string `json:"username" db:"username"`
|
||||
Password []byte `json:"password" db:"password"`
|
||||
Email string `json:"email" db:"email"`
|
||||
AvatarURL string `json:"avatar_url" db:"avatar_url"`
|
||||
Privileges []AccountPrivilege `json:"privileges"`
|
||||
}
|
||||
|
||||
AccountPrivilege string
|
||||
|
||||
Invite struct {
|
||||
Code string `db:"code"`
|
||||
CreatedByID string `db:"created_by"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
ExpiresAt time.Time `db:"expires_at"`
|
||||
}
|
||||
)
|
||||
|
||||
const (
|
||||
Root AccountPrivilege = "root" // grants all permissions. very dangerous to grant!
|
||||
|
||||
// unused for now
|
||||
CreateInvites AccountPrivilege = "create_invites"
|
||||
ReadAccounts AccountPrivilege = "read_accounts"
|
||||
EditAccounts AccountPrivilege = "edit_accounts"
|
||||
|
||||
ReadReleases AccountPrivilege = "read_releases"
|
||||
EditReleases AccountPrivilege = "edit_releases"
|
||||
|
||||
ReadTracks AccountPrivilege = "read_tracks"
|
||||
EditTracks AccountPrivilege = "edit_tracks"
|
||||
|
||||
ReadArtists AccountPrivilege = "read_artists"
|
||||
EditArtists AccountPrivilege = "edit_artists"
|
||||
)
|
11
model/token.go
Normal file
11
model/token.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type Token struct {
|
||||
Token string `json:"token" db:"token"`
|
||||
AccountID string `json:"-" db:"account"`
|
||||
UserAgent string `json:"user_agent" db:"user_agent"`
|
||||
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||||
ExpiresAt time.Time `json:"expires_at" db:"expires_at"`
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue