Fix product service throwing validation error (#658)

This commit is contained in:
Matti Nannt
2023-08-07 17:02:20 +02:00
committed by GitHub
parent 89dae8f1d8
commit e5ef71ae87
2 changed files with 17 additions and 1 deletions

View File

@@ -8,6 +8,21 @@ import { ZProduct } from "@formbricks/types/v1/product";
import type { TProduct } from "@formbricks/types/v1/product";
import { cache } from "react";
const selectProduct = {
id: true,
createdAt: true,
updatedAt: true,
name: true,
teamId: true,
brandColor: true,
highlightBorderColor: true,
recontactDays: true,
formbricksSignature: true,
placement: true,
clickOutsideClose: true,
darkOverlay: true,
};
export const getProductByEnvironmentId = cache(async (environmentId: string): Promise<TProduct> => {
let productPrisma;
try {
@@ -19,6 +34,7 @@ export const getProductByEnvironmentId = cache(async (environmentId: string): Pr
},
},
},
select: selectProduct,
});
if (!productPrisma) {

View File

@@ -10,7 +10,7 @@ export const ZProduct = z.object({
highlightBorderColor: z
.string()
.regex(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
.nullable(),
.nullish(),
recontactDays: z.number().int(),
formbricksSignature: z.boolean(),
placement: z.enum(["bottomLeft", "bottomRight", "topLeft", "topRight", "center"]),