43 lines
1.3 KiB
Go
43 lines
1.3 KiB
Go
package v1
|
|
|
|
import (
|
|
"quyun/v2/app/errorx"
|
|
"quyun/v2/app/http/v1/dto"
|
|
"quyun/v2/app/services"
|
|
|
|
"github.com/gofiber/fiber/v3"
|
|
)
|
|
|
|
// @provider
|
|
type Tenant struct{}
|
|
|
|
// List creator contents
|
|
//
|
|
// @Router /v1/t/:tenantCode/creators/:id<int>/contents [get]
|
|
// @Router /v1/t/:tenantCode/tenants [get]
|
|
// @Router /v1/t/:tenantCode/tenants/:id<int> [get]
|
|
// @Router /v1/t/:tenantCode/tenants/:id<int>/follow [post]
|
|
// @Router /v1/t/:tenantCode/tenants/:id<int>/follow [delete]
|
|
// @Router /v1/t/:tenantCode/tenants/:id<int>/join [post]
|
|
// @Router /v1/t/:tenantCode/tenants/:id<int>/join [delete]
|
|
// @Router /v1/t/:tenantCode/tenants/:id<int>/invites/accept [post]
|
|
|
|
// @Summary Accept tenant invite
|
|
// @Description Accept a tenant invite by code
|
|
// @Tags TenantPublic
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param id path int64 true "Tenant ID"
|
|
// @Param form body dto.TenantInviteAcceptForm true "Invite form"
|
|
// @Success 200 {string} string "Accepted"
|
|
// @Bind id path
|
|
// @Bind form body
|
|
func (t *Tenant) AcceptInvite(ctx fiber.Ctx, id int64, form *dto.TenantInviteAcceptForm) error {
|
|
tenantID := getTenantID(ctx)
|
|
if tenantID > 0 && id != tenantID {
|
|
return errorx.ErrForbidden.WithMsg("租户不匹配")
|
|
}
|
|
userID := getUserID(ctx)
|
|
return services.Tenant.AcceptInvite(ctx, id, userID, form)
|
|
}
|