feat: tenant-scoped routing and portal navigation

This commit is contained in:
2026-01-08 21:30:46 +08:00
parent f3aa92078a
commit 3e095c57f3
52 changed files with 1111 additions and 670 deletions

View File

@@ -0,0 +1,26 @@
package v1
import (
"quyun/v2/database/models"
"quyun/v2/pkg/consts"
"github.com/gofiber/fiber/v3"
)
func getUserID(ctx fiber.Ctx) int64 {
if u := ctx.Locals(consts.CtxKeyUser); u != nil {
if user, ok := u.(*models.User); ok {
return user.ID
}
}
return 0
}
func getTenantID(ctx fiber.Ctx) int64 {
if t := ctx.Locals(consts.CtxKeyTenant); t != nil {
if tenant, ok := t.(*models.Tenant); ok {
return tenant.ID
}
}
return 0
}