fix(server): allow to checkout selfhost team in canary (#10130)

This commit is contained in:
forehalo
2025-02-12 12:19:28 +00:00
parent e4e06f35bb
commit 8129434a2e
3 changed files with 10 additions and 1 deletions

View File

@@ -29,6 +29,13 @@ import {
export const SelfhostTeamCheckoutArgs = z.object({ export const SelfhostTeamCheckoutArgs = z.object({
quantity: z.number(), quantity: z.number(),
user: z
.object({
id: z.string(),
email: z.string(),
})
.optional()
.nullable(),
}); });
export const SelfhostTeamSubscriptionIdentity = z.object({ export const SelfhostTeamSubscriptionIdentity = z.object({

View File

@@ -279,6 +279,7 @@ export class SubscriptionResolver {
session = await this.service.checkout(input, { session = await this.service.checkout(input, {
plan: input.plan as any, plan: input.plan as any,
quantity: input.args?.quantity ?? 10, quantity: input.args?.quantity ?? 10,
user,
}); });
} else { } else {
if (!user) { if (!user) {

View File

@@ -134,7 +134,8 @@ export class SubscriptionService implements OnApplicationBootstrap {
if ( if (
this.config.deploy && this.config.deploy &&
this.config.affine.canary && this.config.affine.canary &&
(!('user' in args) || !this.feature.isStaff(args.user.email)) args.user &&
!this.feature.isStaff(args.user.email)
) { ) {
throw new ActionForbidden(); throw new ActionForbidden();
} }