create-crm-tmp 1.1.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/.prettierignore +2 -0
- package/template/README.md +53 -67
- package/template/components.json +22 -0
- package/template/exemple-contacts.csv +54 -0
- package/template/next.config.ts +27 -1
- package/template/package.json +64 -27
- package/template/prisma/schema.prisma +821 -72
- package/template/skills-lock.json +25 -0
- package/template/src/app/(auth)/invite/[token]/page.tsx +21 -24
- package/template/src/app/(auth)/reset-password/complete/page.tsx +12 -21
- package/template/src/app/(auth)/reset-password/page.tsx +12 -8
- package/template/src/app/(auth)/reset-password/verify/page.tsx +12 -8
- package/template/src/app/(auth)/signin/page.tsx +20 -17
- package/template/src/app/(dashboard)/agenda/page.tsx +2231 -2188
- package/template/src/app/(dashboard)/automatisation/[id]/page.tsx +10 -7
- package/template/src/app/(dashboard)/automatisation/_components/workflow-editor.tsx +680 -323
- package/template/src/app/(dashboard)/automatisation/new/page.tsx +11 -8
- package/template/src/app/(dashboard)/automatisation/page.tsx +473 -180
- package/template/src/app/(dashboard)/closing/page.tsx +500 -468
- package/template/src/app/(dashboard)/contacts/[id]/page.tsx +5035 -4126
- package/template/src/app/(dashboard)/contacts/companies/[id]/page.tsx +1703 -0
- package/template/src/app/(dashboard)/contacts/loading.tsx +13 -0
- package/template/src/app/(dashboard)/contacts/page.tsx +3776 -2064
- package/template/src/app/(dashboard)/dashboard/page.tsx +37 -519
- package/template/src/app/(dashboard)/error.tsx +37 -0
- package/template/src/app/(dashboard)/layout.tsx +1 -1
- package/template/src/app/(dashboard)/loading.tsx +5 -0
- package/template/src/app/(dashboard)/settings/loading.tsx +19 -0
- package/template/src/app/(dashboard)/settings/page.tsx +2685 -2489
- package/template/src/app/(dashboard)/templates/page.tsx +500 -300
- package/template/src/app/(dashboard)/users/list/page.tsx +356 -350
- package/template/src/app/(dashboard)/users/page.tsx +279 -310
- package/template/src/app/(dashboard)/users/permissions/page.tsx +104 -99
- package/template/src/app/(dashboard)/users/roles/page.tsx +164 -137
- package/template/src/app/api/audit-logs/route.ts +1 -1
- package/template/src/app/api/auth/google/callback/route.ts +8 -5
- package/template/src/app/api/auth/google/disconnect/route.ts +2 -2
- package/template/src/app/api/companies/[id]/activities/route.ts +131 -0
- package/template/src/app/api/companies/[id]/route.ts +195 -0
- package/template/src/app/api/companies/export/route.ts +206 -0
- package/template/src/app/api/companies/route.ts +166 -0
- package/template/src/app/api/contact-views/[id]/pin/route.ts +69 -0
- package/template/src/app/api/contact-views/[id]/route.ts +197 -0
- package/template/src/app/api/contact-views/route.ts +146 -0
- package/template/src/app/api/contacts/[id]/files/[fileId]/preview/route.ts +77 -0
- package/template/src/app/api/contacts/[id]/files/[fileId]/route.ts +7 -17
- package/template/src/app/api/contacts/[id]/files/route.ts +83 -44
- package/template/src/app/api/contacts/[id]/interactions/route.ts +37 -0
- package/template/src/app/api/contacts/[id]/kyc/route.ts +71 -0
- package/template/src/app/api/contacts/[id]/meet/route.ts +38 -29
- package/template/src/app/api/contacts/[id]/route.ts +111 -20
- package/template/src/app/api/contacts/[id]/send-email/route.ts +6 -0
- package/template/src/app/api/contacts/[id]/workflows/run/route.ts +61 -0
- package/template/src/app/api/contacts/export/route.ts +12 -17
- package/template/src/app/api/contacts/import/route.ts +22 -19
- package/template/src/app/api/contacts/import-preview/route.ts +139 -0
- package/template/src/app/api/contacts/route.ts +202 -49
- package/template/src/app/api/dashboard/stats/route.ts +9 -292
- package/template/src/app/api/integrations/google-sheet/sync/route.ts +203 -185
- package/template/src/app/api/invite/complete/route.ts +20 -23
- package/template/src/app/api/reminders/route.ts +1 -0
- package/template/src/app/api/reset-password/complete/route.ts +11 -13
- package/template/src/app/api/send/route.ts +9 -85
- package/template/src/app/api/settings/closing-reasons/[id]/route.ts +10 -21
- package/template/src/app/api/settings/closing-reasons/route.ts +10 -21
- package/template/src/app/api/settings/company/route.ts +19 -26
- package/template/src/app/api/settings/google-ads/[id]/route.ts +20 -23
- package/template/src/app/api/settings/google-ads/route.ts +20 -23
- package/template/src/app/api/settings/google-sheet/[id]/route.ts +20 -23
- package/template/src/app/api/settings/google-sheet/auto-map/route.ts +23 -32
- package/template/src/app/api/settings/google-sheet/preview/route.ts +104 -0
- package/template/src/app/api/settings/google-sheet/route.ts +20 -23
- package/template/src/app/api/settings/meta-leads/[id]/route.ts +20 -23
- package/template/src/app/api/settings/meta-leads/route.ts +20 -23
- package/template/src/app/api/settings/statuses/[id]/route.ts +33 -23
- package/template/src/app/api/settings/statuses/route.ts +24 -22
- package/template/src/app/api/statuses/route.ts +2 -5
- package/template/src/app/api/tasks/[id]/attendees/route.ts +14 -7
- package/template/src/app/api/tasks/[id]/route.ts +161 -137
- package/template/src/app/api/tasks/meet/route.ts +11 -8
- package/template/src/app/api/tasks/route.ts +155 -95
- package/template/src/app/api/templates/[id]/route.ts +22 -13
- package/template/src/app/api/templates/route.ts +22 -5
- package/template/src/app/api/users/[id]/resend-invite/route.ts +95 -0
- package/template/src/app/api/users/[id]/route.ts +16 -1
- package/template/src/app/api/users/commercials/route.ts +38 -0
- package/template/src/app/api/users/for-agenda/route.ts +1 -2
- package/template/src/app/api/users/route.ts +94 -55
- package/template/src/app/api/webhooks/google-ads/route.ts +20 -1
- package/template/src/app/api/webhooks/meta-leads/route.ts +18 -1
- package/template/src/app/api/workflows/[id]/route.ts +33 -6
- package/template/src/app/api/workflows/process/route.ts +509 -146
- package/template/src/app/api/workflows/route.ts +46 -4
- package/template/src/app/globals.css +210 -101
- package/template/src/app/layout.tsx +19 -8
- package/template/src/app/page.tsx +37 -7
- package/template/src/components/address-autocomplete.tsx +232 -0
- package/template/src/components/contacts/filter-bar.tsx +181 -0
- package/template/src/components/contacts/filter-builder.tsx +589 -0
- package/template/src/components/contacts/save-view-dialog.tsx +160 -0
- package/template/src/components/contacts/views-tab-bar.tsx +440 -0
- package/template/src/components/dashboard/activity-chart.tsx +31 -39
- package/template/src/components/dashboard/dashboard-content.tsx +79 -0
- package/template/src/components/dashboard/stat-card.tsx +40 -42
- package/template/src/components/dashboard/tasks-pie-chart.tsx +34 -37
- package/template/src/components/dashboard/upcoming-tasks-list.tsx +78 -72
- package/template/src/components/date-picker.tsx +396 -0
- package/template/src/components/editor.tsx +27 -13
- package/template/src/components/email-template.tsx +4 -2
- package/template/src/components/global-search.tsx +358 -0
- package/template/src/components/header.tsx +57 -62
- package/template/src/components/invitation-email-template.tsx +4 -2
- package/template/src/components/lazy-editor.tsx +11 -0
- package/template/src/components/meet-cancellation-email-template.tsx +11 -3
- package/template/src/components/meet-confirmation-email-template.tsx +10 -3
- package/template/src/components/meet-update-email-template.tsx +10 -3
- package/template/src/components/page-header.tsx +19 -15
- package/template/src/components/protected-page.tsx +94 -0
- package/template/src/components/reset-password-email-template.tsx +4 -2
- package/template/src/components/sidebar.tsx +92 -94
- package/template/src/components/skeleton.tsx +128 -42
- package/template/src/components/ui/accordion.tsx +64 -0
- package/template/src/components/ui/alert-dialog.tsx +139 -0
- package/template/src/components/ui/button.tsx +60 -0
- package/template/src/components/view-as-banner.tsx +1 -1
- package/template/src/components/view-as-modal.tsx +21 -16
- package/template/src/config/nav-pages.ts +108 -0
- package/template/src/contexts/app-toast-context.tsx +174 -0
- package/template/src/contexts/sidebar-context.tsx +16 -47
- package/template/src/contexts/task-reminder-context.tsx +6 -6
- package/template/src/contexts/view-as-context.tsx +11 -16
- package/template/src/hooks/use-alert.tsx +65 -0
- package/template/src/hooks/use-confirm.tsx +87 -0
- package/template/src/hooks/use-contact-views.ts +140 -0
- package/template/src/hooks/use-contacts.ts +69 -0
- package/template/src/hooks/use-fetch.ts +17 -0
- package/template/src/hooks/use-focus-trap.ts +73 -0
- package/template/src/hooks/use-statuses.ts +22 -0
- package/template/src/lib/address-api.ts +155 -0
- package/template/src/lib/cache.ts +73 -0
- package/template/src/lib/check-permission.ts +12 -177
- package/template/src/lib/contact-interactions.ts +3 -1
- package/template/src/lib/contact-view-filters.ts +341 -0
- package/template/src/lib/dashboard-stats.ts +224 -0
- package/template/src/lib/date-utils.ts +49 -0
- package/template/src/lib/get-auth-user.ts +25 -0
- package/template/src/lib/google-calendar.ts +54 -12
- package/template/src/lib/google-drive.ts +796 -75
- package/template/src/lib/google-fetch.ts +63 -0
- package/template/src/lib/local-storage.ts +34 -0
- package/template/src/lib/permissions.ts +245 -47
- package/template/src/lib/prisma.ts +11 -11
- package/template/src/lib/roles.ts +14 -39
- package/template/src/lib/template-variables.ts +67 -33
- package/template/src/lib/utils.ts +26 -2
- package/template/src/lib/workflow-executor.ts +445 -229
- package/template/src/proxy.ts +34 -73
- package/template/src/types/contact-views.ts +351 -0
- package/template/src/types/yousign.ts +52 -0
- package/template/vercel.json +12 -0
- package/template/WORKFLOWS_CRON.md +0 -185
- package/template/prisma/migrations/20251126144728_init/migration.sql +0 -78
- package/template/prisma/migrations/20251126155204_add_user_roles/migration.sql +0 -5
- package/template/prisma/migrations/20251128095126_add_company_info/migration.sql +0 -19
- package/template/prisma/migrations/20251128123321_add_smtp_config/migration.sql +0 -22
- package/template/prisma/migrations/20251128132303_add_status/migration.sql +0 -23
- package/template/prisma/migrations/20251201102207_add_user_active/migration.sql +0 -75
- package/template/prisma/migrations/20251201105507_add_email_signature/migration.sql +0 -2
- package/template/prisma/migrations/20251201151122_add_tasks/migration.sql +0 -45
- package/template/prisma/migrations/20251202111854_add_task_reminder/migration.sql +0 -2
- package/template/prisma/migrations/20251202135859_add_google_meet_integration/migration.sql +0 -27
- package/template/prisma/migrations/20251203103317_add_meta_lead_integration/migration.sql +0 -20
- package/template/prisma/migrations/20251203104002_add_google_ads_integration/migration.sql +0 -18
- package/template/prisma/migrations/20251203112122_add_google_sheet_integration/migration.sql +0 -32
- package/template/prisma/migrations/20251203153853_allow_multiple_integration_configs/migration.sql +0 -20
- package/template/prisma/migrations/20251205141705_update_user_roles/migration.sql +0 -12
- package/template/prisma/migrations/20251205150000_add_commercial_and_telepro_assignment/migration.sql +0 -21
- package/template/prisma/migrations/20251205160000_add_interaction_logging/migration.sql +0 -11
- package/template/prisma/migrations/20251208090314_add_automatic_interaction_types/migration.sql +0 -12
- package/template/prisma/migrations/20251208094843_mg/migration.sql +0 -14
- package/template/prisma/migrations/20251208100000_add_company_support/migration.sql +0 -14
- package/template/prisma/migrations/20251208110000_add_templates/migration.sql +0 -26
- package/template/prisma/migrations/20251208141304_add_video_conference_task_type/migration.sql +0 -2
- package/template/prisma/migrations/20251209104759_add_internal_note_to_task/migration.sql +0 -2
- package/template/prisma/migrations/20251209134803_add_company_field/migration.sql +0 -2
- package/template/prisma/migrations/20251209150000_rename_company_to_company_name/migration.sql +0 -3
- package/template/prisma/migrations/20251209150016_add_email_tracking/migration.sql +0 -21
- package/template/prisma/migrations/20251209155908_add_notify_contact_to_task/migration.sql +0 -2
- package/template/prisma/migrations/20251210110019_add_appointment_types/migration.sql +0 -10
- package/template/prisma/migrations/20251210113928_add_contact_files/migration.sql +0 -26
- package/template/prisma/migrations/20251212132339_add_custom_roles/migration.sql +0 -24
- package/template/prisma/migrations/20251215104448_add_file_interaction_types/migration.sql +0 -11
- package/template/prisma/migrations/20251215145616_add_closing_reasons/migration.sql +0 -12
- package/template/prisma/migrations/20251216140850_add_log_users/migration.sql +0 -25
- package/template/prisma/migrations/20251216151000_rename_perdu_to_ferme/migration.sql +0 -8
- package/template/prisma/migrations/20251216162318_add_column_mappings_to_google_sheet/migration.sql +0 -2
- package/template/prisma/migrations/20251216185127_add_workflows/migration.sql +0 -80
- package/template/prisma/migrations/20251216192237_add_scheduled_workflow_actions/migration.sql +0 -32
- package/template/prisma/migrations/20251220000000_add_task_interaction_type/migration.sql +0 -4
- package/template/prisma/migrations/20251221000000_add_task_type/migration.sql +0 -3
- package/template/prisma/migrations/20251221000001_add_event_color/migration.sql +0 -23
- package/template/prisma/migrations/20260210114913_add_dashboard_widget/migration.sql +0 -20
- package/template/prisma/migrations/migration_lock.toml +0 -3
- package/template/src/app/(dashboard)/users/layout.tsx +0 -30
- package/template/src/app/api/dashboard/widgets/[id]/route.ts +0 -47
- package/template/src/app/api/dashboard/widgets/route.ts +0 -181
- package/template/src/components/dashboard/add-widget-dialog.tsx +0 -161
- package/template/src/components/dashboard/color-picker.tsx +0 -65
- package/template/src/components/dashboard/contacts-chart.tsx +0 -69
- package/template/src/components/dashboard/interactions-by-type-chart.tsx +0 -121
- package/template/src/components/dashboard/recent-activity.tsx +0 -157
- package/template/src/components/dashboard/sales-analytics-chart.tsx +0 -77
- package/template/src/components/dashboard/status-distribution-chart.tsx +0 -82
- package/template/src/components/dashboard/top-contacts-list.tsx +0 -119
- package/template/src/components/dashboard/widget-wrapper.tsx +0 -39
- package/template/src/contexts/dashboard-theme-context.tsx +0 -58
- package/template/src/lib/dashboard-themes.ts +0 -140
- package/template/src/lib/default-widgets.ts +0 -14
- package/template/src/lib/widget-registry.ts +0 -177
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
# Configuration des Workflows avec Vercel Cron
|
|
2
|
-
|
|
3
|
-
Ce document explique comment fonctionne le système de planification des actions
|
|
4
|
-
de workflow avec Vercel Cron.
|
|
5
|
-
|
|
6
|
-
## Fonctionnement
|
|
7
|
-
|
|
8
|
-
Le système utilise une table `ScheduledWorkflowAction` dans la base de données
|
|
9
|
-
pour stocker les actions à exécuter plus tard. Un cron job Vercel appelle
|
|
10
|
-
l'endpoint `/api/workflows/process` toutes les minutes pour traiter les actions
|
|
11
|
-
dont la date d'exécution est arrivée.
|
|
12
|
-
|
|
13
|
-
## Configuration
|
|
14
|
-
|
|
15
|
-
### 1. Variables d'environnement
|
|
16
|
-
|
|
17
|
-
Ajoutez cette variable dans votre fichier `.env` et dans les variables
|
|
18
|
-
d'environnement Vercel :
|
|
19
|
-
|
|
20
|
-
```env
|
|
21
|
-
CRON_SECRET=votre_secret_aleatoire_ici
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
**Important** : Utilisez un secret fort et aléatoire pour sécuriser l'endpoint
|
|
25
|
-
cron. Vous pouvez générer un secret avec :
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
openssl rand -base64 32
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### 2. Configuration du service de cron (si plan Hobby)
|
|
32
|
-
|
|
33
|
-
Si vous êtes sur le plan Hobby de Vercel, vous devez utiliser un service externe
|
|
34
|
-
comme cron-job.org.
|
|
35
|
-
|
|
36
|
-
#### Configuration cron-job.org
|
|
37
|
-
|
|
38
|
-
1. Créez un compte sur [cron-job.org](https://cron-job.org/)
|
|
39
|
-
2. Créez un nouveau cron job avec ces paramètres :
|
|
40
|
-
- **URL** :
|
|
41
|
-
`https://votre-domaine.vercel.app/api/workflows/process?secret=VOTRE_CRON_SECRET`
|
|
42
|
-
- **Méthode** : `GET`
|
|
43
|
-
- **Schedule** : `Every minute` ou `*/1 * * * *`
|
|
44
|
-
- **Title** : "Workflow Actions Processor"
|
|
45
|
-
- **Active** : ✓
|
|
46
|
-
|
|
47
|
-
**Note** : Remplacez `VOTRE_CRON_SECRET` par la valeur de votre variable
|
|
48
|
-
d'environnement `CRON_SECRET`.
|
|
49
|
-
|
|
50
|
-
#### Autres services compatibles
|
|
51
|
-
|
|
52
|
-
- **EasyCron** : Même configuration que cron-job.org
|
|
53
|
-
- **UptimeRobot** : Utilisez l'URL avec le paramètre `secret`
|
|
54
|
-
- **GitHub Actions** : Voir la section GitHub Actions ci-dessous
|
|
55
|
-
|
|
56
|
-
### 3. Migration Prisma
|
|
57
|
-
|
|
58
|
-
Après avoir ajouté le modèle `ScheduledWorkflowAction` dans `schema.prisma`,
|
|
59
|
-
créez et exécutez la migration :
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
pnpm prisma migrate dev --name add_scheduled_workflow_actions
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### 4. Configuration Vercel (optionnel - plans Pro/Enterprise uniquement)
|
|
66
|
-
|
|
67
|
-
Le fichier `vercel.json` est configuré pour exécuter le cron toutes les minutes
|
|
68
|
-
:
|
|
69
|
-
|
|
70
|
-
```json
|
|
71
|
-
{
|
|
72
|
-
"crons": [
|
|
73
|
-
{
|
|
74
|
-
"path": "/api/workflows/process",
|
|
75
|
-
"schedule": "* * * * *"
|
|
76
|
-
}
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
**Note** : Vercel Cron est disponible uniquement sur les plans Pro et
|
|
82
|
-
Enterprise. Sur le plan Hobby, utilisez un service externe comme cron-job.org
|
|
83
|
-
(voir section 2).
|
|
84
|
-
|
|
85
|
-
### 5. Déploiement
|
|
86
|
-
|
|
87
|
-
1. Poussez vos changements sur votre repository
|
|
88
|
-
2. Si vous êtes sur plan Pro/Enterprise : Vercel détectera automatiquement le
|
|
89
|
-
fichier `vercel.json` et configurera le cron
|
|
90
|
-
3. Si vous êtes sur plan Hobby : Configurez cron-job.org ou un autre service
|
|
91
|
-
externe (voir section 2)
|
|
92
|
-
4. Vérifiez que `CRON_SECRET` est bien configuré dans les variables
|
|
93
|
-
d'environnement Vercel
|
|
94
|
-
|
|
95
|
-
## Fonctionnement détaillé
|
|
96
|
-
|
|
97
|
-
### Planification d'une action
|
|
98
|
-
|
|
99
|
-
Quand un workflow est déclenché et qu'une action a un délai (jours/heures), le
|
|
100
|
-
système :
|
|
101
|
-
|
|
102
|
-
1. Calcule la date d'exécution : `Date.now() + délai`
|
|
103
|
-
2. Sauvegarde l'action dans `ScheduledWorkflowAction` avec :
|
|
104
|
-
- Le type d'action (SEND_EMAIL, SEND_SMS, CHANGE_STATUS, CREATE_TASK)
|
|
105
|
-
- Les données nécessaires pour l'exécution (template, message, statut, etc.)
|
|
106
|
-
- La date d'exécution
|
|
107
|
-
- Le contact et le workflow concernés
|
|
108
|
-
|
|
109
|
-
### Exécution des actions
|
|
110
|
-
|
|
111
|
-
Toutes les minutes, Vercel Cron appelle `/api/workflows/process` qui :
|
|
112
|
-
|
|
113
|
-
1. Récupère toutes les actions non exécutées dont `executeAt <= maintenant`
|
|
114
|
-
2. Pour chaque action :
|
|
115
|
-
- Exécute l'action selon son type
|
|
116
|
-
- Marque l'action comme exécutée (`executed: true`)
|
|
117
|
-
- Enregistre la date d'exécution réelle
|
|
118
|
-
- En cas d'erreur, enregistre le message d'erreur
|
|
119
|
-
|
|
120
|
-
### Types d'actions supportées
|
|
121
|
-
|
|
122
|
-
- **SEND_EMAIL** : Envoie un email via SMTP avec template
|
|
123
|
-
- **SEND_SMS** : Envoie un SMS (nécessite une API SMS)
|
|
124
|
-
- **CHANGE_STATUS** : Change le statut du contact
|
|
125
|
-
- **CREATE_TASK** : Crée une tâche pour le contact
|
|
126
|
-
- **WAIT** : Action d'attente (gérée par le délai)
|
|
127
|
-
|
|
128
|
-
## Monitoring
|
|
129
|
-
|
|
130
|
-
Vous pouvez surveiller les actions planifiées via la base de données :
|
|
131
|
-
|
|
132
|
-
```sql
|
|
133
|
-
-- Actions en attente
|
|
134
|
-
SELECT * FROM scheduled_workflow_action
|
|
135
|
-
WHERE executed = false
|
|
136
|
-
ORDER BY executeAt ASC;
|
|
137
|
-
|
|
138
|
-
-- Actions récemment exécutées
|
|
139
|
-
SELECT * FROM scheduled_workflow_action
|
|
140
|
-
WHERE executed = true
|
|
141
|
-
ORDER BY executedAt DESC
|
|
142
|
-
LIMIT 50;
|
|
143
|
-
|
|
144
|
-
-- Actions en erreur
|
|
145
|
-
SELECT * FROM scheduled_workflow_action
|
|
146
|
-
WHERE executed = true AND error IS NOT NULL;
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
## Limitations
|
|
150
|
-
|
|
151
|
-
- **Précision** : Les actions sont exécutées avec une précision d'environ 1
|
|
152
|
-
minute (selon la fréquence du cron)
|
|
153
|
-
- **Limite par exécution** : Maximum 50 actions traitées par exécution du cron
|
|
154
|
-
(pour éviter les timeouts)
|
|
155
|
-
- **Retry** : Les actions échouées ne sont pas automatiquement réessayées (elles
|
|
156
|
-
sont marquées comme exécutées avec une erreur)
|
|
157
|
-
|
|
158
|
-
## Dépannage
|
|
159
|
-
|
|
160
|
-
### Le cron ne s'exécute pas
|
|
161
|
-
|
|
162
|
-
1. **Si vous utilisez Vercel Cron** :
|
|
163
|
-
- Vérifiez que vous êtes sur un plan Vercel Pro ou Enterprise
|
|
164
|
-
- Vérifiez dans le dashboard Vercel que le cron est bien configuré (Settings
|
|
165
|
-
→ Cron Jobs)
|
|
166
|
-
- Vérifiez les logs Vercel pour voir les erreurs éventuelles
|
|
167
|
-
|
|
168
|
-
2. **Si vous utilisez un service externe (cron-job.org, etc.)** :
|
|
169
|
-
- Vérifiez que le job est actif dans votre service
|
|
170
|
-
- Vérifiez l'URL utilisée (doit inclure `?secret=VOTRE_CRON_SECRET`)
|
|
171
|
-
- Vérifiez les logs de votre service de cron
|
|
172
|
-
- Testez manuellement l'URL dans votre navigateur (avec le secret) pour voir
|
|
173
|
-
si elle répond
|
|
174
|
-
|
|
175
|
-
### Les actions ne s'exécutent pas
|
|
176
|
-
|
|
177
|
-
1. Vérifiez que `CRON_SECRET` est bien configuré dans Vercel
|
|
178
|
-
2. Vérifiez les logs de l'endpoint `/api/workflows/process`
|
|
179
|
-
3. Vérifiez dans la base de données que les actions sont bien créées
|
|
180
|
-
4. Vérifiez que `executeAt` est bien dans le passé
|
|
181
|
-
|
|
182
|
-
### Erreurs d'exécution
|
|
183
|
-
|
|
184
|
-
Les erreurs sont enregistrées dans le champ `error` de
|
|
185
|
-
`ScheduledWorkflowAction`. Consultez ce champ pour diagnostiquer les problèmes.
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
-- CreateTable
|
|
2
|
-
CREATE TABLE "user" (
|
|
3
|
-
"id" TEXT NOT NULL,
|
|
4
|
-
"name" TEXT NOT NULL,
|
|
5
|
-
"email" TEXT NOT NULL,
|
|
6
|
-
"emailVerified" BOOLEAN NOT NULL DEFAULT false,
|
|
7
|
-
"image" TEXT,
|
|
8
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
9
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
10
|
-
|
|
11
|
-
CONSTRAINT "user_pkey" PRIMARY KEY ("id")
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
-- CreateTable
|
|
15
|
-
CREATE TABLE "session" (
|
|
16
|
-
"id" TEXT NOT NULL,
|
|
17
|
-
"expiresAt" TIMESTAMP(3) NOT NULL,
|
|
18
|
-
"token" TEXT NOT NULL,
|
|
19
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
20
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
21
|
-
"ipAddress" TEXT,
|
|
22
|
-
"userAgent" TEXT,
|
|
23
|
-
"userId" TEXT NOT NULL,
|
|
24
|
-
|
|
25
|
-
CONSTRAINT "session_pkey" PRIMARY KEY ("id")
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
-- CreateTable
|
|
29
|
-
CREATE TABLE "account" (
|
|
30
|
-
"id" TEXT NOT NULL,
|
|
31
|
-
"accountId" TEXT NOT NULL,
|
|
32
|
-
"providerId" TEXT NOT NULL,
|
|
33
|
-
"userId" TEXT NOT NULL,
|
|
34
|
-
"accessToken" TEXT,
|
|
35
|
-
"refreshToken" TEXT,
|
|
36
|
-
"idToken" TEXT,
|
|
37
|
-
"accessTokenExpiresAt" TIMESTAMP(3),
|
|
38
|
-
"refreshTokenExpiresAt" TIMESTAMP(3),
|
|
39
|
-
"scope" TEXT,
|
|
40
|
-
"password" TEXT,
|
|
41
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
42
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
43
|
-
|
|
44
|
-
CONSTRAINT "account_pkey" PRIMARY KEY ("id")
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
-- CreateTable
|
|
48
|
-
CREATE TABLE "verification" (
|
|
49
|
-
"id" TEXT NOT NULL,
|
|
50
|
-
"identifier" TEXT NOT NULL,
|
|
51
|
-
"value" TEXT NOT NULL,
|
|
52
|
-
"expiresAt" TIMESTAMP(3) NOT NULL,
|
|
53
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
54
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
55
|
-
|
|
56
|
-
CONSTRAINT "verification_pkey" PRIMARY KEY ("id")
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
-- CreateIndex
|
|
60
|
-
CREATE UNIQUE INDEX "user_email_key" ON "user"("email");
|
|
61
|
-
|
|
62
|
-
-- CreateIndex
|
|
63
|
-
CREATE INDEX "session_userId_idx" ON "session"("userId");
|
|
64
|
-
|
|
65
|
-
-- CreateIndex
|
|
66
|
-
CREATE UNIQUE INDEX "session_token_key" ON "session"("token");
|
|
67
|
-
|
|
68
|
-
-- CreateIndex
|
|
69
|
-
CREATE INDEX "account_userId_idx" ON "account"("userId");
|
|
70
|
-
|
|
71
|
-
-- CreateIndex
|
|
72
|
-
CREATE INDEX "verification_identifier_idx" ON "verification"("identifier");
|
|
73
|
-
|
|
74
|
-
-- AddForeignKey
|
|
75
|
-
ALTER TABLE "session" ADD CONSTRAINT "session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
76
|
-
|
|
77
|
-
-- AddForeignKey
|
|
78
|
-
ALTER TABLE "account" ADD CONSTRAINT "account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
-- CreateTable
|
|
2
|
-
CREATE TABLE "company" (
|
|
3
|
-
"id" TEXT NOT NULL DEFAULT 'company',
|
|
4
|
-
"name" TEXT,
|
|
5
|
-
"address" TEXT,
|
|
6
|
-
"city" TEXT,
|
|
7
|
-
"postalCode" TEXT,
|
|
8
|
-
"country" TEXT,
|
|
9
|
-
"phone" TEXT,
|
|
10
|
-
"email" TEXT,
|
|
11
|
-
"website" TEXT,
|
|
12
|
-
"siret" TEXT,
|
|
13
|
-
"vatNumber" TEXT,
|
|
14
|
-
"logo" TEXT,
|
|
15
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
16
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
17
|
-
|
|
18
|
-
CONSTRAINT "company_pkey" PRIMARY KEY ("id")
|
|
19
|
-
);
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
-- CreateTable
|
|
2
|
-
CREATE TABLE "smtp_config" (
|
|
3
|
-
"id" TEXT NOT NULL,
|
|
4
|
-
"userId" TEXT NOT NULL,
|
|
5
|
-
"host" TEXT NOT NULL,
|
|
6
|
-
"port" INTEGER NOT NULL,
|
|
7
|
-
"secure" BOOLEAN NOT NULL DEFAULT false,
|
|
8
|
-
"username" TEXT NOT NULL,
|
|
9
|
-
"password" TEXT NOT NULL,
|
|
10
|
-
"fromEmail" TEXT NOT NULL,
|
|
11
|
-
"fromName" TEXT,
|
|
12
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
13
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
14
|
-
|
|
15
|
-
CONSTRAINT "smtp_config_pkey" PRIMARY KEY ("id")
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
-- CreateIndex
|
|
19
|
-
CREATE UNIQUE INDEX "smtp_config_userId_key" ON "smtp_config"("userId");
|
|
20
|
-
|
|
21
|
-
-- AddForeignKey
|
|
22
|
-
ALTER TABLE "smtp_config" ADD CONSTRAINT "smtp_config_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
-- CreateTable
|
|
2
|
-
CREATE TABLE "status" (
|
|
3
|
-
"id" TEXT NOT NULL,
|
|
4
|
-
"name" TEXT NOT NULL,
|
|
5
|
-
"color" TEXT NOT NULL,
|
|
6
|
-
"order" INTEGER NOT NULL DEFAULT 0,
|
|
7
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
8
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
9
|
-
|
|
10
|
-
CONSTRAINT "status_pkey" PRIMARY KEY ("id")
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
-- CreateIndex
|
|
14
|
-
CREATE UNIQUE INDEX "status_name_key" ON "status"("name");
|
|
15
|
-
|
|
16
|
-
-- Insert default statuses (ignore if already exist)
|
|
17
|
-
INSERT INTO "status" ("id", "name", "color", "order", "createdAt", "updatedAt") VALUES
|
|
18
|
-
(gen_random_uuid()::text, 'Nouveau', '#3B82F6', 1, NOW(), NOW()),
|
|
19
|
-
(gen_random_uuid()::text, 'À rappeler', '#F59E0B', 2, NOW(), NOW()),
|
|
20
|
-
(gen_random_uuid()::text, 'RDV pris', '#8B5CF6', 3, NOW(), NOW()),
|
|
21
|
-
(gen_random_uuid()::text, 'Converti (contrat signé)', '#10B981', 4, NOW(), NOW()),
|
|
22
|
-
(gen_random_uuid()::text, 'Perdu', '#EF4444', 5, NOW(), NOW())
|
|
23
|
-
ON CONFLICT ("name") DO NOTHING;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
-- CreateEnum
|
|
2
|
-
CREATE TYPE "Civility" AS ENUM ('M', 'MME', 'MLLE');
|
|
3
|
-
|
|
4
|
-
-- CreateEnum
|
|
5
|
-
CREATE TYPE "InteractionType" AS ENUM ('CALL', 'SMS', 'EMAIL', 'MEETING', 'NOTE');
|
|
6
|
-
|
|
7
|
-
-- AlterTable
|
|
8
|
-
ALTER TABLE "user" ADD COLUMN "active" BOOLEAN NOT NULL DEFAULT true;
|
|
9
|
-
|
|
10
|
-
-- CreateTable
|
|
11
|
-
CREATE TABLE "contact" (
|
|
12
|
-
"id" TEXT NOT NULL,
|
|
13
|
-
"civility" "Civility",
|
|
14
|
-
"firstName" TEXT,
|
|
15
|
-
"lastName" TEXT,
|
|
16
|
-
"phone" TEXT NOT NULL,
|
|
17
|
-
"secondaryPhone" TEXT,
|
|
18
|
-
"email" TEXT,
|
|
19
|
-
"address" TEXT,
|
|
20
|
-
"city" TEXT,
|
|
21
|
-
"postalCode" TEXT,
|
|
22
|
-
"origin" TEXT,
|
|
23
|
-
"statusId" TEXT,
|
|
24
|
-
"assignedUserId" TEXT,
|
|
25
|
-
"createdById" TEXT NOT NULL,
|
|
26
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
27
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
28
|
-
|
|
29
|
-
CONSTRAINT "contact_pkey" PRIMARY KEY ("id")
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
-- CreateTable
|
|
33
|
-
CREATE TABLE "interaction" (
|
|
34
|
-
"id" TEXT NOT NULL,
|
|
35
|
-
"contactId" TEXT NOT NULL,
|
|
36
|
-
"type" "InteractionType" NOT NULL,
|
|
37
|
-
"title" TEXT,
|
|
38
|
-
"content" TEXT NOT NULL,
|
|
39
|
-
"userId" TEXT NOT NULL,
|
|
40
|
-
"date" TIMESTAMP(3),
|
|
41
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
42
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
43
|
-
|
|
44
|
-
CONSTRAINT "interaction_pkey" PRIMARY KEY ("id")
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
-- CreateIndex
|
|
48
|
-
CREATE INDEX "contact_statusId_idx" ON "contact"("statusId");
|
|
49
|
-
|
|
50
|
-
-- CreateIndex
|
|
51
|
-
CREATE INDEX "contact_assignedUserId_idx" ON "contact"("assignedUserId");
|
|
52
|
-
|
|
53
|
-
-- CreateIndex
|
|
54
|
-
CREATE INDEX "contact_createdById_idx" ON "contact"("createdById");
|
|
55
|
-
|
|
56
|
-
-- CreateIndex
|
|
57
|
-
CREATE INDEX "interaction_contactId_idx" ON "interaction"("contactId");
|
|
58
|
-
|
|
59
|
-
-- CreateIndex
|
|
60
|
-
CREATE INDEX "interaction_userId_idx" ON "interaction"("userId");
|
|
61
|
-
|
|
62
|
-
-- AddForeignKey
|
|
63
|
-
ALTER TABLE "contact" ADD CONSTRAINT "contact_statusId_fkey" FOREIGN KEY ("statusId") REFERENCES "status"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
64
|
-
|
|
65
|
-
-- AddForeignKey
|
|
66
|
-
ALTER TABLE "contact" ADD CONSTRAINT "contact_assignedUserId_fkey" FOREIGN KEY ("assignedUserId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
67
|
-
|
|
68
|
-
-- AddForeignKey
|
|
69
|
-
ALTER TABLE "contact" ADD CONSTRAINT "contact_createdById_fkey" FOREIGN KEY ("createdById") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
70
|
-
|
|
71
|
-
-- AddForeignKey
|
|
72
|
-
ALTER TABLE "interaction" ADD CONSTRAINT "interaction_contactId_fkey" FOREIGN KEY ("contactId") REFERENCES "contact"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
73
|
-
|
|
74
|
-
-- AddForeignKey
|
|
75
|
-
ALTER TABLE "interaction" ADD CONSTRAINT "interaction_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
-- CreateEnum
|
|
2
|
-
CREATE TYPE "TaskType" AS ENUM ('CALL', 'MEETING', 'EMAIL', 'OTHER');
|
|
3
|
-
|
|
4
|
-
-- CreateEnum
|
|
5
|
-
CREATE TYPE "TaskPriority" AS ENUM ('LOW', 'MEDIUM', 'HIGH', 'URGENT');
|
|
6
|
-
|
|
7
|
-
-- CreateTable
|
|
8
|
-
CREATE TABLE "task" (
|
|
9
|
-
"id" TEXT NOT NULL,
|
|
10
|
-
"contactId" TEXT,
|
|
11
|
-
"type" "TaskType" NOT NULL,
|
|
12
|
-
"title" TEXT,
|
|
13
|
-
"description" TEXT NOT NULL,
|
|
14
|
-
"priority" "TaskPriority" NOT NULL DEFAULT 'MEDIUM',
|
|
15
|
-
"scheduledAt" TIMESTAMP(3) NOT NULL,
|
|
16
|
-
"assignedUserId" TEXT NOT NULL,
|
|
17
|
-
"createdById" TEXT NOT NULL,
|
|
18
|
-
"completed" BOOLEAN NOT NULL DEFAULT false,
|
|
19
|
-
"completedAt" TIMESTAMP(3),
|
|
20
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
21
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
22
|
-
|
|
23
|
-
CONSTRAINT "task_pkey" PRIMARY KEY ("id")
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
-- CreateIndex
|
|
27
|
-
CREATE INDEX "task_contactId_idx" ON "task"("contactId");
|
|
28
|
-
|
|
29
|
-
-- CreateIndex
|
|
30
|
-
CREATE INDEX "task_assignedUserId_idx" ON "task"("assignedUserId");
|
|
31
|
-
|
|
32
|
-
-- CreateIndex
|
|
33
|
-
CREATE INDEX "task_createdById_idx" ON "task"("createdById");
|
|
34
|
-
|
|
35
|
-
-- CreateIndex
|
|
36
|
-
CREATE INDEX "task_scheduledAt_idx" ON "task"("scheduledAt");
|
|
37
|
-
|
|
38
|
-
-- AddForeignKey
|
|
39
|
-
ALTER TABLE "task" ADD CONSTRAINT "task_contactId_fkey" FOREIGN KEY ("contactId") REFERENCES "contact"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
40
|
-
|
|
41
|
-
-- AddForeignKey
|
|
42
|
-
ALTER TABLE "task" ADD CONSTRAINT "task_assignedUserId_fkey" FOREIGN KEY ("assignedUserId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
43
|
-
|
|
44
|
-
-- AddForeignKey
|
|
45
|
-
ALTER TABLE "task" ADD CONSTRAINT "task_createdById_fkey" FOREIGN KEY ("createdById") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
-- AlterTable
|
|
2
|
-
ALTER TABLE "task" ADD COLUMN "durationMinutes" INTEGER,
|
|
3
|
-
ADD COLUMN "googleEventId" TEXT,
|
|
4
|
-
ADD COLUMN "googleMeetLink" TEXT;
|
|
5
|
-
|
|
6
|
-
-- CreateTable
|
|
7
|
-
CREATE TABLE "user_google_account" (
|
|
8
|
-
"id" TEXT NOT NULL,
|
|
9
|
-
"userId" TEXT NOT NULL,
|
|
10
|
-
"accessToken" TEXT NOT NULL,
|
|
11
|
-
"refreshToken" TEXT NOT NULL,
|
|
12
|
-
"tokenExpiresAt" TIMESTAMP(3) NOT NULL,
|
|
13
|
-
"email" TEXT,
|
|
14
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
15
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
16
|
-
|
|
17
|
-
CONSTRAINT "user_google_account_pkey" PRIMARY KEY ("id")
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
-- CreateIndex
|
|
21
|
-
CREATE UNIQUE INDEX "user_google_account_userId_key" ON "user_google_account"("userId");
|
|
22
|
-
|
|
23
|
-
-- CreateIndex
|
|
24
|
-
CREATE INDEX "task_googleEventId_idx" ON "task"("googleEventId");
|
|
25
|
-
|
|
26
|
-
-- AddForeignKey
|
|
27
|
-
ALTER TABLE "user_google_account" ADD CONSTRAINT "user_google_account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
-- CreateTable
|
|
2
|
-
CREATE TABLE "meta_lead_config" (
|
|
3
|
-
"id" TEXT NOT NULL DEFAULT 'meta_lead_config_singleton',
|
|
4
|
-
"pageId" TEXT NOT NULL,
|
|
5
|
-
"accessToken" TEXT NOT NULL,
|
|
6
|
-
"verifyToken" TEXT NOT NULL,
|
|
7
|
-
"active" BOOLEAN NOT NULL DEFAULT true,
|
|
8
|
-
"defaultStatusId" TEXT,
|
|
9
|
-
"defaultAssignedUserId" TEXT,
|
|
10
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
11
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
12
|
-
|
|
13
|
-
CONSTRAINT "meta_lead_config_pkey" PRIMARY KEY ("id")
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
-- AddForeignKey
|
|
17
|
-
ALTER TABLE "meta_lead_config" ADD CONSTRAINT "meta_lead_config_defaultStatusId_fkey" FOREIGN KEY ("defaultStatusId") REFERENCES "status"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
18
|
-
|
|
19
|
-
-- AddForeignKey
|
|
20
|
-
ALTER TABLE "meta_lead_config" ADD CONSTRAINT "meta_lead_config_defaultAssignedUserId_fkey" FOREIGN KEY ("defaultAssignedUserId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
-- CreateTable
|
|
2
|
-
CREATE TABLE "google_ads_lead_config" (
|
|
3
|
-
"id" TEXT NOT NULL DEFAULT 'google_ads_lead_config_singleton',
|
|
4
|
-
"webhookKey" TEXT NOT NULL,
|
|
5
|
-
"active" BOOLEAN NOT NULL DEFAULT true,
|
|
6
|
-
"defaultStatusId" TEXT,
|
|
7
|
-
"defaultAssignedUserId" TEXT,
|
|
8
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
9
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
10
|
-
|
|
11
|
-
CONSTRAINT "google_ads_lead_config_pkey" PRIMARY KEY ("id")
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
-- AddForeignKey
|
|
15
|
-
ALTER TABLE "google_ads_lead_config" ADD CONSTRAINT "google_ads_lead_config_defaultStatusId_fkey" FOREIGN KEY ("defaultStatusId") REFERENCES "status"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
16
|
-
|
|
17
|
-
-- AddForeignKey
|
|
18
|
-
ALTER TABLE "google_ads_lead_config" ADD CONSTRAINT "google_ads_lead_config_defaultAssignedUserId_fkey" FOREIGN KEY ("defaultAssignedUserId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
package/template/prisma/migrations/20251203112122_add_google_sheet_integration/migration.sql
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
-- CreateTable
|
|
2
|
-
CREATE TABLE "google_sheet_sync_config" (
|
|
3
|
-
"id" TEXT NOT NULL DEFAULT 'google_sheet_sync_config_singleton',
|
|
4
|
-
"ownerUserId" TEXT NOT NULL,
|
|
5
|
-
"spreadsheetId" TEXT NOT NULL,
|
|
6
|
-
"sheetName" TEXT NOT NULL,
|
|
7
|
-
"headerRow" INTEGER NOT NULL,
|
|
8
|
-
"phoneColumn" TEXT NOT NULL,
|
|
9
|
-
"firstNameColumn" TEXT,
|
|
10
|
-
"lastNameColumn" TEXT,
|
|
11
|
-
"emailColumn" TEXT,
|
|
12
|
-
"cityColumn" TEXT,
|
|
13
|
-
"postalCodeColumn" TEXT,
|
|
14
|
-
"originColumn" TEXT,
|
|
15
|
-
"active" BOOLEAN NOT NULL DEFAULT true,
|
|
16
|
-
"lastSyncedRow" INTEGER,
|
|
17
|
-
"defaultStatusId" TEXT,
|
|
18
|
-
"defaultAssignedUserId" TEXT,
|
|
19
|
-
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
20
|
-
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
21
|
-
|
|
22
|
-
CONSTRAINT "google_sheet_sync_config_pkey" PRIMARY KEY ("id")
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
-- AddForeignKey
|
|
26
|
-
ALTER TABLE "google_sheet_sync_config" ADD CONSTRAINT "google_sheet_sync_config_ownerUserId_fkey" FOREIGN KEY ("ownerUserId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
27
|
-
|
|
28
|
-
-- AddForeignKey
|
|
29
|
-
ALTER TABLE "google_sheet_sync_config" ADD CONSTRAINT "google_sheet_sync_config_defaultStatusId_fkey" FOREIGN KEY ("defaultStatusId") REFERENCES "status"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
30
|
-
|
|
31
|
-
-- AddForeignKey
|
|
32
|
-
ALTER TABLE "google_sheet_sync_config" ADD CONSTRAINT "google_sheet_sync_config_defaultAssignedUserId_fkey" FOREIGN KEY ("defaultAssignedUserId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
package/template/prisma/migrations/20251203153853_allow_multiple_integration_configs/migration.sql
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
-- Ajouter la colonne name avec une valeur par défaut temporaire
|
|
2
|
-
ALTER TABLE "google_ads_lead_config" ADD COLUMN "name" TEXT;
|
|
3
|
-
ALTER TABLE "google_sheet_sync_config" ADD COLUMN "name" TEXT;
|
|
4
|
-
ALTER TABLE "meta_lead_config" ADD COLUMN "name" TEXT;
|
|
5
|
-
|
|
6
|
-
-- Mettre à jour les valeurs existantes avec un nom par défaut
|
|
7
|
-
UPDATE "google_ads_lead_config" SET "name" = 'Configuration Google Ads' WHERE "name" IS NULL;
|
|
8
|
-
UPDATE "google_sheet_sync_config" SET "name" = 'Configuration Google Sheets' WHERE "name" IS NULL;
|
|
9
|
-
UPDATE "meta_lead_config" SET "name" = 'Configuration Meta Lead Ads' WHERE "name" IS NULL;
|
|
10
|
-
|
|
11
|
-
-- Rendre la colonne NOT NULL
|
|
12
|
-
ALTER TABLE "google_ads_lead_config" ALTER COLUMN "name" SET NOT NULL;
|
|
13
|
-
ALTER TABLE "google_sheet_sync_config" ALTER COLUMN "name" SET NOT NULL;
|
|
14
|
-
ALTER TABLE "meta_lead_config" ALTER COLUMN "name" SET NOT NULL;
|
|
15
|
-
|
|
16
|
-
-- Changer l'ID pour utiliser cuid() au lieu d'une valeur fixe
|
|
17
|
-
-- Pour les tables existantes, on garde l'ID actuel mais on supprime la contrainte DEFAULT
|
|
18
|
-
ALTER TABLE "google_ads_lead_config" ALTER COLUMN "id" DROP DEFAULT;
|
|
19
|
-
ALTER TABLE "google_sheet_sync_config" ALTER COLUMN "id" DROP DEFAULT;
|
|
20
|
-
ALTER TABLE "meta_lead_config" ALTER COLUMN "id" DROP DEFAULT;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
-- AlterEnum
|
|
2
|
-
-- This migration adds more than one value to an enum.
|
|
3
|
-
-- With PostgreSQL versions 11 and earlier, this is not possible
|
|
4
|
-
-- in a single migration. This can be worked around by creating
|
|
5
|
-
-- multiple migrations, each migration adding only one value to
|
|
6
|
-
-- the enum.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
ALTER TYPE "Role" ADD VALUE 'MANAGER';
|
|
10
|
-
ALTER TYPE "Role" ADD VALUE 'COMMERCIAL';
|
|
11
|
-
ALTER TYPE "Role" ADD VALUE 'TELEPRO';
|
|
12
|
-
ALTER TYPE "Role" ADD VALUE 'COMPTABLE';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
-- Ajouter les nouvelles colonnes
|
|
2
|
-
ALTER TABLE "contact" ADD COLUMN "assignedCommercialId" TEXT;
|
|
3
|
-
ALTER TABLE "contact" ADD COLUMN "assignedTeleproId" TEXT;
|
|
4
|
-
|
|
5
|
-
-- Migrer les données existantes : assigner les contacts existants au commercial
|
|
6
|
-
-- (on suppose que les utilisateurs assignés actuellement sont des commerciaux)
|
|
7
|
-
UPDATE "contact" SET "assignedCommercialId" = "assignedUserId" WHERE "assignedUserId" IS NOT NULL;
|
|
8
|
-
|
|
9
|
-
-- Créer les index
|
|
10
|
-
CREATE INDEX IF NOT EXISTS "contact_assignedCommercialId_idx" ON "contact"("assignedCommercialId");
|
|
11
|
-
CREATE INDEX IF NOT EXISTS "contact_assignedTeleproId_idx" ON "contact"("assignedTeleproId");
|
|
12
|
-
|
|
13
|
-
-- Ajouter les contraintes de clé étrangère
|
|
14
|
-
ALTER TABLE "contact" ADD CONSTRAINT "contact_assignedCommercialId_fkey" FOREIGN KEY ("assignedCommercialId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
15
|
-
ALTER TABLE "contact" ADD CONSTRAINT "contact_assignedTeleproId_fkey" FOREIGN KEY ("assignedTeleproId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
16
|
-
|
|
17
|
-
-- Supprimer l'ancienne colonne et son index
|
|
18
|
-
DROP INDEX IF EXISTS "contact_assignedUserId_idx";
|
|
19
|
-
ALTER TABLE "contact" DROP CONSTRAINT IF EXISTS "contact_assignedUserId_fkey";
|
|
20
|
-
ALTER TABLE "contact" DROP COLUMN "assignedUserId";
|
|
21
|
-
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
-- AlterEnum
|
|
2
|
-
-- Ajouter les nouveaux types d'interactions à l'enum existant
|
|
3
|
-
ALTER TYPE "InteractionType" ADD VALUE IF NOT EXISTS 'STATUS_CHANGE';
|
|
4
|
-
ALTER TYPE "InteractionType" ADD VALUE IF NOT EXISTS 'CONTACT_UPDATE';
|
|
5
|
-
ALTER TYPE "InteractionType" ADD VALUE IF NOT EXISTS 'APPOINTMENT_CREATED';
|
|
6
|
-
ALTER TYPE "InteractionType" ADD VALUE IF NOT EXISTS 'ASSIGNMENT_CHANGE';
|
|
7
|
-
|
|
8
|
-
-- AlterTable
|
|
9
|
-
-- Ajouter le champ metadata à la table interaction
|
|
10
|
-
ALTER TABLE "interaction" ADD COLUMN IF NOT EXISTS "metadata" JSONB;
|
|
11
|
-
|
package/template/prisma/migrations/20251208090314_add_automatic_interaction_types/migration.sql
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
-- AlterEnum
|
|
2
|
-
-- This migration adds more than one value to an enum.
|
|
3
|
-
-- With PostgreSQL versions 11 and earlier, this is not possible
|
|
4
|
-
-- in a single migration. This can be worked around by creating
|
|
5
|
-
-- multiple migrations, each migration adding only one value to
|
|
6
|
-
-- the enum.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
ALTER TYPE "InteractionType" ADD VALUE 'STATUS_CHANGED';
|
|
10
|
-
ALTER TYPE "InteractionType" ADD VALUE 'INFO_UPDATED';
|
|
11
|
-
ALTER TYPE "InteractionType" ADD VALUE 'ASSIGNMENT_CHANGED';
|
|
12
|
-
ALTER TYPE "InteractionType" ADD VALUE 'CONTACT_CREATED';
|