mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Improve announcement card display and fix creation bug
Update the announcement card component to match the dashboard's visual style and resolve an issue where new announcements were not displaying correctly due to incorrect data handling and display logic. Replit-Commit-Author: Agent Replit-Commit-Session-Id: e437ffed-c31b-44eb-9fd5-b6f9faa8e7ce Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/e437ffed-c31b-44eb-9fd5-b6f9faa8e7ce/dnQ3tT8
This commit is contained in:
1 parent
9f694d0251
commit
243240701c
6 files changed
+358
-367
No files matched your search
@@ -46,7 +46,7 @@ class AnnouncementDatabaseStorage implements IAnnouncementStorage {
|
||||
|
||||
const results = await query;
|
||||
|
||||
return results.map(result => ({
|
||||
return results.map((result: any) => ({
|
||||
id: result.id,
|
||||
title: result.title,
|
||||
content: result.content,
|
||||
@@ -249,15 +249,12 @@ class AnnouncementMemoryStorage implements IAnnouncementStorage {
|
||||
return announcementWithRelations;
|
||||
}
|
||||
|
||||
async deleteAnnouncement(id: number): Promise<boolean> {
|
||||
const existed = this.announcements.has(id);
|
||||
async deleteAnnouncement(id: number): Promise<void> {
|
||||
const deleted = this.announcements.delete(id);
|
||||
|
||||
if (deleted) {
|
||||
console.log(`🗑️ Annonce supprimée: ID ${id} (${this.announcements.size}/${this.MAX_ANNOUNCEMENTS} restantes)`);
|
||||
}
|
||||
|
||||
return deleted;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-5
@@ -3043,18 +3043,19 @@ RÉSUMÉ DU SCAN
|
||||
const announcements = await Promise.all(
|
||||
messages.map(async (message) => {
|
||||
// Récupérer l'auteur
|
||||
let author = { id: parseInt(message.createdBy) || 0, firstName: 'Utilisateur', lastName: 'Inconnu' };
|
||||
let author = { id: message.createdBy, firstName: 'Utilisateur', lastName: 'Inconnu' };
|
||||
try {
|
||||
const [userResult] = await db.select().from(users).where(eq(users.id, message.createdBy));
|
||||
// En production, createdBy est varchar, donc chercher par username
|
||||
const [userResult] = await db.select().from(users).where(eq(users.username, message.createdBy));
|
||||
if (userResult) {
|
||||
author = {
|
||||
id: parseInt(message.createdBy),
|
||||
id: userResult.id,
|
||||
firstName: userResult.firstName || 'Utilisateur',
|
||||
lastName: userResult.lastName || 'Inconnu'
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('Could not fetch author for message:', message.id);
|
||||
console.warn('❌ [PRODUCTION] Could not fetch author for message:', message.id, e);
|
||||
}
|
||||
|
||||
// Récupérer le groupe si storeId est défini
|
||||
@@ -3152,7 +3153,7 @@ RÉSUMÉ DU SCAN
|
||||
content: announcementData.content,
|
||||
type: announcementData.type,
|
||||
storeId: announcementData.storeId,
|
||||
createdBy: user.id.toString(),
|
||||
createdBy: user.username, // Utiliser username plutôt que ID pour PostgreSQL
|
||||
}).returning();
|
||||
|
||||
const announcement = {
|
||||
|
||||
Reference in new issue
Block a user