feat(backend): return list of orgs in login resp

This commit is contained in:
2026-01-02 15:57:35 +00:00
parent 4688ba49c1
commit b40a80e4b6
8 changed files with 98 additions and 25 deletions

View File

@@ -11,9 +11,12 @@ const (
slugMaxLength = 63
)
// ReservedSlug is the special organization slug used to address the authenticated
// user's personal organization in API routes (e.g. /api/my/...).
const ReservedSlug = "my"
var (
slugPattern = regexp.MustCompile(`^[a-z0-9]+(?:-[a-z0-9]+)*$`)
reservedSlug = "my"
slugPattern = regexp.MustCompile(`^[a-z0-9]+(?:-[a-z0-9]+)*$`)
)
var ErrInvalidSlug = errors.New("invalid organization slug")
@@ -24,7 +27,7 @@ func NormalizeSlug(input string) (string, error) {
if len(slug) < slugMinLength || len(slug) > slugMaxLength {
return "", ErrInvalidSlug
}
if slug == reservedSlug {
if slug == ReservedSlug {
return "", ErrInvalidSlug
}
if !slugPattern.MatchString(slug) {