This commit is contained in:
Owen
2025-10-04 18:36:44 -07:00
parent 3123f858bb
commit c2c907852d
320 changed files with 35785 additions and 2984 deletions

View File

@@ -3,13 +3,15 @@ import createHttpError from "http-errors";
import { z } from "zod";
import { fromError } from "zod-validation-error";
import HttpCode from "@server/types/HttpCode";
import { response } from "@server/lib";
import { response } from "@server/lib/response";
import { db, userOrgs } from "@server/db";
import { User, emailVerificationCodes, users } from "@server/db";
import { eq } from "drizzle-orm";
import { isWithinExpirationDate } from "oslo";
import config from "@server/lib/config";
import logger from "@server/logger";
import { freeLimitSet, limitsService } from "@server/lib/private/billing";
import { build } from "@server/build";
export const verifyEmailBody = z
.object({
@@ -88,6 +90,19 @@ export async function verifyEmail(
);
}
if (build == "saas") {
const orgs = await db
.select()
.from(userOrgs)
.where(eq(userOrgs.userId, user.userId));
const orgIds = orgs.map((org) => org.orgId);
await Promise.all(
orgIds.map(async (orgId) => {
await limitsService.applyLimitSetToOrg(orgId, freeLimitSet);
})
);
}
return response<VerifyEmailResponse>(res, {
success: true,
error: false,