Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+11
-1
@@ -83,7 +83,17 @@ describe("onboarding pagination queries", () => {
|
||||
skip: 10,
|
||||
include: {
|
||||
onboarding: true,
|
||||
user: true,
|
||||
user: {
|
||||
select: {
|
||||
id: true,
|
||||
email: true,
|
||||
firstName: true,
|
||||
lastName: true,
|
||||
phone: true,
|
||||
locale: true,
|
||||
createdAt: true,
|
||||
},
|
||||
},
|
||||
tenant: true,
|
||||
sessionSteps: { include: { step: true }, orderBy: { step: { order: "asc" } } },
|
||||
actions: true,
|
||||
|
||||
+9
@@ -13,4 +13,13 @@ describe("onboarding session DB scope", () => {
|
||||
expect(stepsSource).toContain("export async function deleteOnboardingSessionStepsInOnboardingSession");
|
||||
expect(stepsSource).toContain("onboardingSession: {\n onboardingId,");
|
||||
});
|
||||
|
||||
test("selects only the public user projection for hydrated onboarding sessions", () => {
|
||||
const sessionsSource = readRepoFile("apps/web/app/modules/onboarding/db/onboardingSessions.db.server.ts");
|
||||
|
||||
expect(sessionsSource).toContain("const safeOnboardingUserSelect");
|
||||
expect(sessionsSource).not.toContain("user: true");
|
||||
expect(sessionsSource).not.toMatch(/safeOnboardingUserSelect[\s\S]*passwordHash:\s*true/u);
|
||||
expect(sessionsSource).not.toMatch(/safeOnboardingUserSelect[\s\S]*totpSecretEncrypted:\s*true/u);
|
||||
});
|
||||
});
|
||||
+22
-6
@@ -15,6 +15,16 @@ import { UserSimple } from "~/utils/db/users.db.server";
|
||||
import { OnboardingSessionActionDto } from "../dtos/OnboardingSessionActionDto";
|
||||
import { OnboardingSessionStatus } from "../dtos/OnboardingSessionStatus";
|
||||
|
||||
const safeOnboardingUserSelect = {
|
||||
id: true,
|
||||
email: true,
|
||||
firstName: true,
|
||||
lastName: true,
|
||||
phone: true,
|
||||
locale: true,
|
||||
createdAt: true,
|
||||
} satisfies Prisma.UserSelect;
|
||||
|
||||
export type OnboardingSessionWithDetails = OnboardingSession & {
|
||||
onboarding: Onboarding;
|
||||
user: UserSimple;
|
||||
@@ -62,7 +72,7 @@ export async function getOnboardingSessions({
|
||||
where,
|
||||
include: {
|
||||
onboarding: true,
|
||||
user: true,
|
||||
user: { select: safeOnboardingUserSelect },
|
||||
tenant: true,
|
||||
sessionSteps: { include: { step: true }, orderBy: { step: { order: "asc" } } },
|
||||
actions: true,
|
||||
@@ -86,7 +96,7 @@ export async function getOnboardingSessionsWithPagination({
|
||||
skip: (pagination.page - 1) * pagination.pageSize,
|
||||
include: {
|
||||
onboarding: true,
|
||||
user: true,
|
||||
user: { select: safeOnboardingUserSelect },
|
||||
tenant: true,
|
||||
sessionSteps: { include: { step: true }, orderBy: { step: { order: "asc" } } },
|
||||
actions: true,
|
||||
@@ -114,7 +124,7 @@ export async function getOnboardingSession(id: string): Promise<OnboardingSessio
|
||||
where: { id },
|
||||
include: {
|
||||
onboarding: true,
|
||||
user: true,
|
||||
user: { select: safeOnboardingUserSelect },
|
||||
tenant: true,
|
||||
sessionSteps: { include: { step: true }, orderBy: { step: { order: "asc" } } },
|
||||
actions: true,
|
||||
@@ -123,12 +133,18 @@ export async function getOnboardingSession(id: string): Promise<OnboardingSessio
|
||||
});
|
||||
}
|
||||
|
||||
export async function getOnboardingSessionInOnboarding({ id, onboardingId }: { id: string; onboardingId: string }): Promise<OnboardingSessionWithDetails | null> {
|
||||
export async function getOnboardingSessionInOnboarding({
|
||||
id,
|
||||
onboardingId,
|
||||
}: {
|
||||
id: string;
|
||||
onboardingId: string;
|
||||
}): Promise<OnboardingSessionWithDetails | null> {
|
||||
return await db.onboardingSession.findFirst({
|
||||
where: { id, onboardingId },
|
||||
include: {
|
||||
onboarding: true,
|
||||
user: true,
|
||||
user: { select: safeOnboardingUserSelect },
|
||||
tenant: true,
|
||||
sessionSteps: { include: { step: true }, orderBy: { step: { order: "asc" } } },
|
||||
actions: true,
|
||||
@@ -150,7 +166,7 @@ export async function getOnboardingSessionsByUser({
|
||||
where: { userId, tenantId, status },
|
||||
include: {
|
||||
onboarding: true,
|
||||
user: true,
|
||||
user: { select: safeOnboardingUserSelect },
|
||||
tenant: true,
|
||||
sessionSteps: { include: { step: true }, orderBy: { step: { order: "asc" } } },
|
||||
actions: true,
|
||||
|
||||
Reference in new issue
Block a user