mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-06 05:40:02 -06:00
chore: moved insights model to database package (#4575)
This commit is contained in:
@@ -4,9 +4,7 @@
|
||||
"version": "0.1.0",
|
||||
"main": "./src/index.ts",
|
||||
"files": [
|
||||
"src",
|
||||
"zod",
|
||||
"zod-utils.ts"
|
||||
"src"
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "rimraf .turbo node_modules",
|
||||
@@ -37,7 +35,6 @@
|
||||
"prisma-dbml-generator": "0.12.0",
|
||||
"prisma-json-types-generator": "3.1.1",
|
||||
"ts-node": "10.9.2",
|
||||
"zod": "3.24.1",
|
||||
"zod-prisma": "0.5.4"
|
||||
"zod": "3.24.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,6 @@ generator client {
|
||||
// provider = "prisma-dbml-generator"
|
||||
// }
|
||||
|
||||
generator zod {
|
||||
provider = "zod-prisma"
|
||||
output = "./zod"
|
||||
imports = "./zod-utils"
|
||||
relationModel = "default"
|
||||
}
|
||||
|
||||
generator json {
|
||||
provider = "prisma-json-types-generator"
|
||||
}
|
||||
@@ -117,20 +110,15 @@ model Response {
|
||||
contactId String?
|
||||
endingId String?
|
||||
notes ResponseNote[]
|
||||
/// @zod.custom(imports.ZResponseData)
|
||||
/// [ResponseData]
|
||||
data Json @default("{}")
|
||||
/// @zod.custom(imports.ZResponseVariables)
|
||||
/// [ResponseVariables]
|
||||
variables Json @default("{}")
|
||||
/// @zod.custom(imports.ZResponseTtc)
|
||||
/// [ResponseTtc]
|
||||
ttc Json @default("{}")
|
||||
/// @zod.custom(imports.ZResponseMeta)
|
||||
/// [ResponseMeta]
|
||||
meta Json @default("{}")
|
||||
tags TagsOnResponses[]
|
||||
/// @zod.custom(imports.ZResponseContactAttributes)
|
||||
/// [ResponseContactAttributes]
|
||||
contactAttributes Json?
|
||||
// singleUseId, used to prevent multiple responses
|
||||
@@ -273,20 +261,15 @@ model Survey {
|
||||
creator User? @relation(fields: [createdBy], references: [id])
|
||||
createdBy String?
|
||||
status SurveyStatus @default(draft)
|
||||
/// @zod.custom(imports.ZSurveyWelcomeCard)
|
||||
/// [SurveyWelcomeCard]
|
||||
welcomeCard Json @default("{\"enabled\": false}")
|
||||
/// @zod.custom(imports.ZSurveyQuestions)
|
||||
/// [SurveyQuestions]
|
||||
questions Json @default("[]")
|
||||
/// @zod.custom(imports.ZSurveyEnding)
|
||||
/// [SurveyEnding]
|
||||
endings Json[] @default([])
|
||||
thankYouCard Json? //deprecated
|
||||
/// @zod.custom(imports.ZSurveyHiddenFields)
|
||||
/// [SurveyHiddenFields]
|
||||
hiddenFields Json @default("{\"enabled\": false}")
|
||||
/// @zod.custom(imports.ZSurveyVariables)
|
||||
/// [SurveyVariables]
|
||||
variables Json @default("[]")
|
||||
responses Response[]
|
||||
@@ -294,7 +277,6 @@ model Survey {
|
||||
recontactDays Int?
|
||||
displayLimit Int?
|
||||
triggers SurveyTrigger[]
|
||||
/// @zod.custom(imports.ZSurveyInlineTriggers)
|
||||
/// [SurveyInlineTriggers]
|
||||
inlineTriggers Json?
|
||||
attributeFilters SurveyAttributeFilter[]
|
||||
@@ -304,25 +286,20 @@ model Survey {
|
||||
delay Int @default(0)
|
||||
runOnDate DateTime?
|
||||
closeOnDate DateTime?
|
||||
/// @zod.custom(imports.ZSurveyClosedMessage)
|
||||
/// [SurveyClosedMessage]
|
||||
surveyClosedMessage Json?
|
||||
segmentId String?
|
||||
segment Segment? @relation(fields: [segmentId], references: [id])
|
||||
|
||||
/// @zod.custom(imports.ZSurveyProjectOverwrites)
|
||||
/// [SurveyProjectOverwrites]
|
||||
projectOverwrites Json?
|
||||
|
||||
/// @zod.custom(imports.ZSurveyStyling)
|
||||
/// [SurveyStyling]
|
||||
styling Json?
|
||||
|
||||
/// @zod.custom(imports.ZSurveySingleUse)
|
||||
/// [SurveySingleUse]
|
||||
singleUse Json? @default("{\"enabled\": false, \"isEncrypted\": true}")
|
||||
|
||||
/// @zod.custom(imports.ZSurveyVerifyEmail)
|
||||
/// [SurveyVerifyEmail]
|
||||
verifyEmail Json? // deprecated
|
||||
isVerifyEmailEnabled Boolean @default(false)
|
||||
@@ -347,10 +324,8 @@ model SurveyFollowUp {
|
||||
surveyId String
|
||||
name String
|
||||
/// [SurveyFollowUpTrigger]
|
||||
/// @zod.custom(imports.ZSurveyFollowUpTrigger)
|
||||
trigger Json
|
||||
/// [SurveyFollowUpAction]
|
||||
/// @zod.custom(imports.ZSurveyFollowUpAction)
|
||||
action Json
|
||||
}
|
||||
|
||||
@@ -368,7 +343,6 @@ model ActionClass {
|
||||
description String?
|
||||
type ActionType
|
||||
key String?
|
||||
/// @zod.custom(imports.ZActionClassNoCodeConfig)
|
||||
/// [ActionClassNoCodeConfig]
|
||||
noCodeConfig Json?
|
||||
environment Environment @relation(fields: [environmentId], references: [id], onDelete: Cascade)
|
||||
@@ -396,7 +370,6 @@ model Integration {
|
||||
id String @id @default(cuid())
|
||||
type IntegrationType
|
||||
environmentId String
|
||||
/// @zod.custom(imports.ZIntegrationConfig)
|
||||
/// [IntegrationConfig]
|
||||
config Json
|
||||
environment Environment @relation(fields: [environmentId], references: [id], onDelete: Cascade)
|
||||
@@ -461,10 +434,8 @@ model Project {
|
||||
environments Environment[]
|
||||
brandColor String? // deprecated; use styling.brandColor instead
|
||||
highlightBorderColor String? // deprecated
|
||||
/// @zod.custom(imports.ZProjectStyling)
|
||||
/// [Styling]
|
||||
styling Json @default("{\"allowStyleOverwrite\":true}")
|
||||
/// @zod.custom(imports.ZProjectConfig)
|
||||
/// [ProjectConfig]
|
||||
config Json @default("{}")
|
||||
recontactDays Int @default(7)
|
||||
@@ -474,7 +445,6 @@ model Project {
|
||||
clickOutsideClose Boolean @default(true)
|
||||
darkOverlay Boolean @default(false)
|
||||
languages Language[]
|
||||
/// @zod.custom(imports.ZLogo)
|
||||
/// [Logo]
|
||||
logo Json?
|
||||
projectTeams ProjectTeam[]
|
||||
@@ -490,10 +460,8 @@ model Organization {
|
||||
name String
|
||||
memberships Membership[]
|
||||
projects Project[]
|
||||
/// @zod.custom(imports.ZOrganizationBilling)
|
||||
/// [OrganizationBilling]
|
||||
billing Json
|
||||
/// @zod.custom(imports.ZOrganizationWhitelabel)
|
||||
/// [OrganizationWhitelabel]
|
||||
whitelabel Json @default("{}")
|
||||
invites Invite[]
|
||||
@@ -640,11 +608,8 @@ model User {
|
||||
invitesAccepted Invite[] @relation("inviteAcceptedBy")
|
||||
role Role?
|
||||
objective Objective?
|
||||
/// @zod.custom(imports.ZUserNotificationSettings)
|
||||
/// @zod.custom(imports.ZUserNotificationSettings)
|
||||
/// [UserNotificationSettings]
|
||||
notificationSettings Json @default("{}")
|
||||
/// @zod.custom(imports.ZUserLocale)
|
||||
/// [Locale]
|
||||
locale String @default("en-US")
|
||||
surveys Survey[]
|
||||
@@ -667,7 +632,6 @@ model Segment {
|
||||
title String
|
||||
description String?
|
||||
isPrivate Boolean @default(true)
|
||||
/// @zod.custom(imports.ZSegmentFilters)
|
||||
/// [SegmentFilter]
|
||||
filters Json @default("[]")
|
||||
environmentId String
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"exclude": ["node_modules", "dist", "zod"],
|
||||
"exclude": ["node_modules", "dist"],
|
||||
"extends": "@formbricks/config-typescript/node16.json",
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "tsup.config.ts"]
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
/* eslint-disable import/no-relative-packages -- required for importing types */
|
||||
import { z } from "zod";
|
||||
|
||||
export const ZActionProperties = z.record(z.string());
|
||||
export { ZActionClassNoCodeConfig } from "../types/action-classes";
|
||||
export { ZIntegrationConfig } from "../types/integration";
|
||||
|
||||
export { ZResponseData, ZResponseMeta, ZResponseTtc } from "../types/responses";
|
||||
|
||||
export {
|
||||
ZSurveyWelcomeCard,
|
||||
ZSurveyQuestions,
|
||||
ZSurveyHiddenFields,
|
||||
ZSurveyVariables,
|
||||
ZSurveyClosedMessage,
|
||||
ZSurveyProjectOverwrites,
|
||||
ZSurveyStyling,
|
||||
ZSurveySingleUse,
|
||||
ZSurveyInlineTriggers,
|
||||
ZSurveyEnding,
|
||||
} from "../types/surveys/types";
|
||||
|
||||
export { ZSurveyFollowUpAction, ZSurveyFollowUpTrigger } from "./types/survey-follow-up";
|
||||
|
||||
export { ZSegmentFilters } from "../types/segment";
|
||||
export { ZOrganizationBilling, ZOrganizationWhitelabel } from "../types/organizations";
|
||||
export { ZUserNotificationSettings } from "../types/user";
|
||||
12
packages/database/zod/insights.ts
Normal file
12
packages/database/zod/insights.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { type Insight } from "@prisma/client";
|
||||
import { z } from "zod";
|
||||
|
||||
export const ZInsight = z.object({
|
||||
id: z.string().cuid2(),
|
||||
createdAt: z.date(),
|
||||
updatedAt: z.date(),
|
||||
environmentId: z.string().cuid2(),
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
category: z.enum(["featureRequest", "complaint", "praise", "other"]),
|
||||
}) satisfies z.ZodType<Insight>;
|
||||
Reference in New Issue
Block a user