mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Fix errors when modifying announcements in production
Correct PostgreSQL join condition in announcement update logic to use username instead of ID. Replit-Commit-Author: Agent Replit-Commit-Session-Id: cc2d271b-82f0-4d6a-9302-a0b067ffb429 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/cc2d271b-82f0-4d6a-9302-a0b067ffb429/JTP6mhE
This commit is contained in:
1 parent
8bbbd2476c
commit
3f6ad3bb23
2 files changed
+56
No files matched your search
@@ -0,0 +1,56 @@
|
||||
# CORRECTION URGENTE - Erreurs 500 Modification Annonces Production
|
||||
|
||||
## Problème
|
||||
Erreurs 500 lors de la modification des annonces en production dues à une jointure PostgreSQL incorrecte.
|
||||
|
||||
## Solution - Modifications à appliquer sur votre serveur
|
||||
|
||||
### 1. Fichier `server/routes.ts` - Ligne 44
|
||||
**AVANT :**
|
||||
```javascript
|
||||
customerOrders, nocodbConfigs, dlcProducts, tasks, invoiceVerifications, dashboardMessages
|
||||
```
|
||||
|
||||
**APRÈS :**
|
||||
```javascript
|
||||
customerOrders, nocodbConfig, dlcProducts, tasks, invoiceVerificationCache, dashboardMessages
|
||||
```
|
||||
|
||||
### 2. Fichier `server/announcementStorage.ts` - Ligne 46
|
||||
**AVANT :**
|
||||
```javascript
|
||||
.leftJoin(users, eq(dashboardMessages.createdBy, users.id))
|
||||
```
|
||||
|
||||
**APRÈS :**
|
||||
```javascript
|
||||
.leftJoin(users, eq(dashboardMessages.createdBy, users.username))
|
||||
```
|
||||
|
||||
### 3. Fichier `server/announcementStorage.ts` - Lignes 70-76
|
||||
**REMPLACER la méthode updateAnnouncement par :**
|
||||
```javascript
|
||||
async updateAnnouncement(id: number, announcement: Partial<InsertAnnouncement>): Promise<DashboardMessage> {
|
||||
console.log('📝 [DB] Updating announcement with data:', announcement);
|
||||
|
||||
const [updated] = await db
|
||||
.update(dashboardMessages)
|
||||
.set(announcement)
|
||||
.where(eq(dashboardMessages.id, id))
|
||||
.returning();
|
||||
|
||||
console.log('📝 [DB] Updated announcement:', updated);
|
||||
|
||||
if (!updated) {
|
||||
throw new Error(`Announcement with id ${id} not found`);
|
||||
}
|
||||
|
||||
return updated;
|
||||
}
|
||||
```
|
||||
|
||||
## Cause du problème
|
||||
La jointure PostgreSQL utilisait `users.id` au lieu de `users.username` pour la relation avec le champ `createdBy`, qui contient des usernames en production.
|
||||
|
||||
## Test après correction
|
||||
Après application des modifications, redémarrez votre serveur et testez la modification d'une annonce.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 263 KiB |
Reference in new issue
Block a user