mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix(server): allow to checkout selfhost team in canary (#10130)
This commit is contained in:
@@ -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({
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user