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/contents [get] // @Router /v1/t/:tenantCode/tenants [get] // @Router /v1/t/:tenantCode/tenants/:id [get] // @Router /v1/t/:tenantCode/tenants/:id/follow [post] // @Router /v1/t/:tenantCode/tenants/:id/follow [delete] // @Router /v1/t/:tenantCode/tenants/:id/join [post] // @Router /v1/t/:tenantCode/tenants/:id/join [delete] // @Router /v1/t/:tenantCode/tenants/:id/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) }