roles
This commit is contained in:
parent
8c8cbfd7dd
commit
41d48bf60a
28 changed files with 434 additions and 7 deletions
15
types/category.go
Normal file
15
types/category.go
Normal file
|
@ -0,0 +1,15 @@
|
|||
package types
|
||||
|
||||
type CategoryType string
|
||||
|
||||
const (
|
||||
CategoryMultiple CategoryType = "multiple"
|
||||
CategorySingle CategoryType = "single"
|
||||
)
|
||||
|
||||
type Category struct {
|
||||
ID string
|
||||
Name string
|
||||
Type CategoryType
|
||||
Roles []string // of role IDs
|
||||
}
|
29
types/fixtures/category.go
Normal file
29
types/fixtures/category.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
package fixtures
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
|
||||
"git.sapphic.engineer/roleypoly/v4/types"
|
||||
)
|
||||
|
||||
var (
|
||||
CategoryMulti = types.Category{
|
||||
ID: "multi",
|
||||
Name: "Roles",
|
||||
Type: types.CategoryMultiple,
|
||||
Roles: []string{RoleWithDarkColor.ID, RoleWithLightColor.ID, RoleWithoutColor.ID},
|
||||
}
|
||||
|
||||
CategorySingle = types.Category{
|
||||
ID: "single",
|
||||
Name: "Roles",
|
||||
Type: types.CategorySingle,
|
||||
Roles: []string{RoleWithDarkColor.ID, RoleWithLightColor.ID, RoleWithoutColor.ID},
|
||||
}
|
||||
)
|
||||
|
||||
func Category(base types.Category) *types.Category {
|
||||
base.ID = fmt.Sprintf("%s-%d", base.ID, rand.Uint32())
|
||||
return &base
|
||||
}
|
32
types/fixtures/role.go
Normal file
32
types/fixtures/role.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package fixtures
|
||||
|
||||
import "git.sapphic.engineer/roleypoly/v4/types"
|
||||
|
||||
var (
|
||||
RoleWithDarkColor = types.Role{
|
||||
ID: "dark-color",
|
||||
Name: "role with dark color",
|
||||
Color: 0xa20000,
|
||||
Permissions: 0,
|
||||
Position: 10,
|
||||
}
|
||||
RoleWithLightColor = types.Role{
|
||||
ID: "light-color",
|
||||
Name: "role with light color",
|
||||
Color: 0xffaa88,
|
||||
Permissions: 0,
|
||||
Position: 10,
|
||||
}
|
||||
RoleWithoutColor = types.Role{
|
||||
ID: "without-color",
|
||||
Name: "role",
|
||||
Color: 0x000000,
|
||||
Permissions: 0,
|
||||
Position: 11,
|
||||
}
|
||||
//TODO: role with admin (bad)
|
||||
//TODO: role with manage roles (bad)
|
||||
//TODO: role above roleypoly (bad)
|
||||
//TODO: role with managed (bad)
|
||||
//TODO: role that is roleypoly (hi)
|
||||
)
|
11
types/role.go
Normal file
11
types/role.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
package types
|
||||
|
||||
type Role struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Color uint32 `json:"color"`
|
||||
Icon string `json:"icon"` // unused, future?
|
||||
UnicodeEmoji string `json:"unicode_emoji"` // unused, future?
|
||||
Permissions uint64 `json:"permissions,string"`
|
||||
Position uint8 `json:"position"`
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue