mirror of
https://github.com/formbricks/formbricks.git
synced 2026-02-14 02:31:34 -06:00
fix: removed userId from contact endpoint response (#6175)
Co-authored-by: Piyush Gupta <piyushguptaa2z123@gmail.com>
This commit is contained in:
committed by
GitHub
parent
75d170bce5
commit
a941f994ea
@@ -143,7 +143,6 @@ export const mockPrismaPerson: Prisma.ContactGetPayload<{
|
||||
include: typeof selectContact;
|
||||
}> = {
|
||||
id: mockId,
|
||||
userId: mockId,
|
||||
attributes: [
|
||||
{
|
||||
value: "de",
|
||||
|
||||
@@ -1303,7 +1303,6 @@
|
||||
"casual": "Lässig",
|
||||
"caution_edit_duplicate": "Duplizieren & bearbeiten",
|
||||
"caution_edit_published_survey": "Eine veröffentlichte Umfrage bearbeiten?",
|
||||
"caution_explanation_all_data_as_download": "Alle Daten, einschließlich früherer Antworten, stehen als Download zur Verfügung.",
|
||||
"caution_explanation_intro": "Wir verstehen, dass du vielleicht noch Änderungen vornehmen möchtest. Hier erfährst du, was passiert, wenn du das tust:",
|
||||
"caution_explanation_new_responses_separated": "Antworten vor der Änderung werden möglicherweise nicht oder nur teilweise in der Umfragezusammenfassung berücksichtigt.",
|
||||
"caution_explanation_only_new_responses_in_summary": "Alle Daten, einschließlich früherer Antworten, bleiben auf der Umfrageübersichtsseite als Download verfügbar.",
|
||||
|
||||
@@ -1303,7 +1303,6 @@
|
||||
"casual": "Casual",
|
||||
"caution_edit_duplicate": "Duplicate & edit",
|
||||
"caution_edit_published_survey": "Edit a published survey?",
|
||||
"caution_explanation_all_data_as_download": "All data, including past responses are available as download.",
|
||||
"caution_explanation_intro": "We understand you might still want to make changes. Here’s what happens if you do: ",
|
||||
"caution_explanation_new_responses_separated": "Responses before the change may not or only partially be included in the survey summary.",
|
||||
"caution_explanation_only_new_responses_in_summary": "All data, including past responses, remain available as download on the survey summary page.",
|
||||
|
||||
@@ -1303,7 +1303,6 @@
|
||||
"casual": "Décontracté",
|
||||
"caution_edit_duplicate": "Dupliquer et modifier",
|
||||
"caution_edit_published_survey": "Modifier un sondage publié ?",
|
||||
"caution_explanation_all_data_as_download": "Toutes les données, y compris les réponses passées, sont disponibles en téléchargement.",
|
||||
"caution_explanation_intro": "Nous comprenons que vous souhaitiez encore apporter des modifications. Voici ce qui se passe si vous le faites : ",
|
||||
"caution_explanation_new_responses_separated": "Les réponses avant le changement peuvent ne pas être ou ne faire partie que partiellement du résumé de l'enquête.",
|
||||
"caution_explanation_only_new_responses_in_summary": "Toutes les données, y compris les réponses passées, restent disponibles en téléchargement sur la page de résumé de l'enquête.",
|
||||
|
||||
@@ -1303,7 +1303,6 @@
|
||||
"casual": "Casual",
|
||||
"caution_edit_duplicate": "Duplicar e editar",
|
||||
"caution_edit_published_survey": "Editar uma pesquisa publicada?",
|
||||
"caution_explanation_all_data_as_download": "Todos os dados, incluindo respostas anteriores, estão disponíveis para download.",
|
||||
"caution_explanation_intro": "Entendemos que você ainda pode querer fazer alterações. Aqui está o que acontece se você fizer:",
|
||||
"caution_explanation_new_responses_separated": "Respostas antes da mudança podem não ser ou apenas parcialmente incluídas no resumo da pesquisa.",
|
||||
"caution_explanation_only_new_responses_in_summary": "Todos os dados, incluindo respostas anteriores, permanecem disponíveis para download na página de resumo da pesquisa.",
|
||||
|
||||
@@ -1303,7 +1303,6 @@
|
||||
"casual": "Casual",
|
||||
"caution_edit_duplicate": "Duplicar e editar",
|
||||
"caution_edit_published_survey": "Editar um inquérito publicado?",
|
||||
"caution_explanation_all_data_as_download": "Todos os dados, incluindo respostas anteriores, estão disponíveis para download.",
|
||||
"caution_explanation_intro": "Entendemos que ainda pode querer fazer alterações. Eis o que acontece se o fizer:",
|
||||
"caution_explanation_new_responses_separated": "Respostas antes da alteração podem não estar incluídas ou estar apenas parcialmente incluídas no resumo do inquérito.",
|
||||
"caution_explanation_only_new_responses_in_summary": "Todos os dados, incluindo respostas anteriores, permanecem disponíveis para download na página de resumo do inquérito.",
|
||||
|
||||
@@ -1303,7 +1303,6 @@
|
||||
"casual": "隨意",
|
||||
"caution_edit_duplicate": "複製 & 編輯",
|
||||
"caution_edit_published_survey": "編輯已發佈的調查?",
|
||||
"caution_explanation_all_data_as_download": "所有數據,包括過去的回應,都可以下載。",
|
||||
"caution_explanation_intro": "我們了解您可能仍然想要進行更改。如果您這樣做,將會發生以下情況:",
|
||||
"caution_explanation_new_responses_separated": "更改前的回應可能未被納入或只有部分包含在調查摘要中。",
|
||||
"caution_explanation_only_new_responses_in_summary": "所有數據,包括過去的回應,仍可在調查摘要頁面下載。",
|
||||
|
||||
@@ -20,7 +20,6 @@ const mockContact = {
|
||||
environmentId: mockEnvironmentId,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
attributes: [],
|
||||
};
|
||||
|
||||
describe("contact lib", () => {
|
||||
@@ -38,7 +37,9 @@ describe("contact lib", () => {
|
||||
const result = await getContact(mockContactId);
|
||||
|
||||
expect(result).toEqual(mockContact);
|
||||
expect(prisma.contact.findUnique).toHaveBeenCalledWith({ where: { id: mockContactId } });
|
||||
expect(prisma.contact.findUnique).toHaveBeenCalledWith({
|
||||
where: { id: mockContactId },
|
||||
});
|
||||
});
|
||||
|
||||
test("should return null if contact not found", async () => {
|
||||
@@ -46,7 +47,9 @@ describe("contact lib", () => {
|
||||
const result = await getContact(mockContactId);
|
||||
|
||||
expect(result).toBeNull();
|
||||
expect(prisma.contact.findUnique).toHaveBeenCalledWith({ where: { id: mockContactId } });
|
||||
expect(prisma.contact.findUnique).toHaveBeenCalledWith({
|
||||
where: { id: mockContactId },
|
||||
});
|
||||
});
|
||||
|
||||
test("should throw DatabaseError if prisma throws PrismaClientKnownRequestError", async () => {
|
||||
|
||||
@@ -20,18 +20,12 @@ const mockContacts = [
|
||||
{
|
||||
id: "contactId1",
|
||||
environmentId: mockEnvironmentId1,
|
||||
name: "Contact 1",
|
||||
email: "contact1@example.com",
|
||||
attributes: {},
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
id: "contactId2",
|
||||
environmentId: mockEnvironmentId2,
|
||||
name: "Contact 2",
|
||||
email: "contact2@example.com",
|
||||
attributes: {},
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `userId` on the `Contact` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "Contact" DROP COLUMN "userId";
|
||||
@@ -112,14 +112,12 @@ model ContactAttributeKey {
|
||||
/// Contacts are environment-specific and can have multiple attributes and responses.
|
||||
///
|
||||
/// @property id - Unique identifier for the contact
|
||||
/// @property userId - Optional external user identifier
|
||||
/// @property environment - The environment this contact belongs to
|
||||
/// @property responses - Survey responses from this contact
|
||||
/// @property attributes - Custom attributes associated with this contact
|
||||
/// @property displays - Record of surveys shown to this contact
|
||||
model Contact {
|
||||
id String @id @default(cuid())
|
||||
userId String?
|
||||
createdAt DateTime @default(now()) @map(name: "created_at")
|
||||
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
||||
environment Environment @relation(fields: [environmentId], references: [id], onDelete: Cascade)
|
||||
|
||||
Reference in New Issue
Block a user