Show messages, which are already there

This commit is contained in:
Alex Erdei 2025-05-06 18:51:51 +01:00
parent 7f3c4f39ab
commit c30d85c610
2 changed files with 449 additions and 368 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
/* --------------------------------------------------------------
mapRestMessage Magic legacy Firebase shape
-------------------------------------------------------------- */
export function mapRestMessage(row) {
/* Convert "2025-04-05 09:34:52" JS ISO string the UI already
parses with new Date() (or keep as Date object if you prefer) */
const iso = row.timestamp
? row.timestamp.replace(" ", "T") + "Z"
: new Date().toISOString();
return {
/* Firebase used the doc id as id; well expose the PK */
id: row.message_id,
sender: row.sender,
recipient: row.recipient,
text: row.text,
photoURL: row.photoURL,
isPhoto: !!row.isPhoto,
isRead: !!row.isRead,
timestamp: iso,
};
}