- Add TenantOptionalAuth middleware to allow access to public content without requiring authentication. - Introduce ListPublicPublished and PublicDetail methods in the content service to retrieve publicly accessible content. - Create tenant_public HTTP routes for listing and showing public content, including preview and main asset retrieval. - Enhance content tests to cover scenarios for public content access and permissions. - Update specifications to reflect the new public content access features and rules.
64 lines
2.0 KiB
Go
64 lines
2.0 KiB
Go
// Code generated by atomctl. DO NOT EDIT.
|
|
|
|
// Package tenant_join provides HTTP route definitions and registration
|
|
// for the quyun/v2 application.
|
|
package tenant_join
|
|
|
|
import (
|
|
"quyun/v2/app/http/tenant_join/dto"
|
|
"quyun/v2/app/middlewares"
|
|
"quyun/v2/database/models"
|
|
"quyun/v2/providers/jwt"
|
|
|
|
"github.com/gofiber/fiber/v3"
|
|
log "github.com/sirupsen/logrus"
|
|
_ "go.ipao.vip/atom"
|
|
_ "go.ipao.vip/atom/contracts"
|
|
. "go.ipao.vip/atom/fen"
|
|
)
|
|
|
|
// Routes implements the HttpRoute contract and provides route registration
|
|
// for all controllers in the tenant_join module.
|
|
//
|
|
// @provider contracts.HttpRoute atom.GroupRoutes
|
|
type Routes struct {
|
|
log *log.Entry `inject:"false"`
|
|
middlewares *middlewares.Middlewares
|
|
// Controller instances
|
|
join *join
|
|
}
|
|
|
|
// Prepare initializes the routes provider with logging configuration.
|
|
func (r *Routes) Prepare() error {
|
|
r.log = log.WithField("module", "routes.tenant_join")
|
|
r.log.Info("Initializing routes module")
|
|
return nil
|
|
}
|
|
|
|
// Name returns the unique identifier for this routes provider.
|
|
func (r *Routes) Name() string {
|
|
return "tenant_join"
|
|
}
|
|
|
|
// Register registers all HTTP routes with the provided fiber router.
|
|
// Each route is registered with its corresponding controller action and parameter bindings.
|
|
func (r *Routes) Register(router fiber.Router) {
|
|
// Register routes for controller: join
|
|
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/join/invite -> join.joinByInvite")
|
|
router.Post("/t/:tenantCode/v1/join/invite"[len(r.Path()):], DataFunc3(
|
|
r.join.joinByInvite,
|
|
Local[*models.Tenant]("tenant"),
|
|
Local[*jwt.Claims]("claims"),
|
|
Body[dto.JoinByInviteForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/join/request -> join.createJoinRequest")
|
|
router.Post("/t/:tenantCode/v1/join/request"[len(r.Path()):], DataFunc3(
|
|
r.join.createJoinRequest,
|
|
Local[*models.Tenant]("tenant"),
|
|
Local[*jwt.Claims]("claims"),
|
|
Body[dto.JoinRequestCreateForm]("form"),
|
|
))
|
|
|
|
r.log.Info("Successfully registered all routes")
|
|
}
|