feat(leads): keep gender on leads and form submissions
A lead can carry the same honorific as a person, and a form that asks gender writes it onto the lead. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
ALTER TABLE "Lead" ADD COLUMN "gender" TEXT NOT NULL DEFAULT 'none';
|
||||
ALTER TABLE "Lead" ADD COLUMN "showGenderInName" BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
-- عنوان داخل نام مخاطب، و اگر مخاطب خالی است داخل عنوان لید
|
||||
UPDATE "Lead"
|
||||
SET "gender" = 'male', "showGenderInName" = true
|
||||
WHERE regexp_replace(
|
||||
regexp_replace(
|
||||
btrim(CASE WHEN btrim(coalesce("contactName", '')) <> '' THEN "contactName" ELSE "title" END),
|
||||
'ي',
|
||||
'ی',
|
||||
'g'
|
||||
),
|
||||
'ك',
|
||||
'ک',
|
||||
'g'
|
||||
) ~ '^جناب[[:space:]]*آقای([[:space:]]|$)';
|
||||
|
||||
UPDATE "Lead"
|
||||
SET "gender" = 'female', "showGenderInName" = true
|
||||
WHERE "gender" = 'none'
|
||||
AND regexp_replace(
|
||||
regexp_replace(
|
||||
btrim(CASE WHEN btrim(coalesce("contactName", '')) <> '' THEN "contactName" ELSE "title" END),
|
||||
'ي',
|
||||
'ی',
|
||||
'g'
|
||||
),
|
||||
'ك',
|
||||
'ک',
|
||||
'g'
|
||||
) ~ '^سرکار[[:space:]]*خانم([[:space:]]|$)';
|
||||
@@ -3023,6 +3023,10 @@ model Lead {
|
||||
title String
|
||||
/// نام مالک یا مسئول
|
||||
contactName String?
|
||||
/// male | female | none
|
||||
gender String @default("none")
|
||||
/// عنوان «جناب آقای» / «سرکار خانم» داخل نام مخاطب
|
||||
showGenderInName Boolean @default(false)
|
||||
mobile String
|
||||
phone String?
|
||||
city String?
|
||||
|
||||
Reference in New Issue
Block a user