feat: Implement public access for tenant content
- 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.
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
"quyun/v2/app/commands/testx"
|
||||
"quyun/v2/app/errorx"
|
||||
tenantdto "quyun/v2/app/http/tenant/dto"
|
||||
tenantjoindto "quyun/v2/app/http/tenantjoin/dto"
|
||||
tenant_join_dto "quyun/v2/app/http/tenant_join/dto"
|
||||
"quyun/v2/database"
|
||||
"quyun/v2/database/models"
|
||||
"quyun/v2/pkg/consts"
|
||||
@@ -262,7 +262,7 @@ func (s *TenantJoinTestSuite) Test_CreateJoinRequest() {
|
||||
Status: consts.UserStatusVerified,
|
||||
}).Error, ShouldBeNil)
|
||||
|
||||
_, err := Tenant.CreateJoinRequest(ctx, tenantID, userID, &tenantjoindto.JoinRequestCreateForm{Reason: "x"})
|
||||
_, err := Tenant.CreateJoinRequest(ctx, tenantID, userID, &tenant_join_dto.JoinRequestCreateForm{Reason: "x"})
|
||||
So(err, ShouldNotBeNil)
|
||||
|
||||
var appErr *errorx.AppError
|
||||
@@ -273,11 +273,11 @@ func (s *TenantJoinTestSuite) Test_CreateJoinRequest() {
|
||||
Convey("重复提交应返回同一个 pending 申请(幂等)", func() {
|
||||
s.truncateAll(ctx)
|
||||
|
||||
out1, err := Tenant.CreateJoinRequest(ctx, tenantID, userID, &tenantjoindto.JoinRequestCreateForm{Reason: "a"})
|
||||
out1, err := Tenant.CreateJoinRequest(ctx, tenantID, userID, &tenant_join_dto.JoinRequestCreateForm{Reason: "a"})
|
||||
So(err, ShouldBeNil)
|
||||
So(out1, ShouldNotBeNil)
|
||||
|
||||
out2, err := Tenant.CreateJoinRequest(ctx, tenantID, userID, &tenantjoindto.JoinRequestCreateForm{Reason: "b"})
|
||||
out2, err := Tenant.CreateJoinRequest(ctx, tenantID, userID, &tenant_join_dto.JoinRequestCreateForm{Reason: "b"})
|
||||
So(err, ShouldBeNil)
|
||||
So(out2, ShouldNotBeNil)
|
||||
So(out2.ID, ShouldEqual, out1.ID)
|
||||
|
||||
Reference in New Issue
Block a user