feat: Security
This commit is contained in:
@@ -20,6 +20,8 @@ export async function handleSaveMessage(command: SaveMessageCommand, dataSource:
|
||||
content: message.content,
|
||||
timestamp: message.timestamp,
|
||||
editedAt: message.editedAt ?? null,
|
||||
revision: message.revision ?? 0,
|
||||
headHash: message.headHash ?? null,
|
||||
isDeleted: message.isDeleted ? 1 : 0,
|
||||
replyToId: message.replyToId ?? null,
|
||||
linkMetadata: message.linkMetadata ? JSON.stringify(message.linkMetadata) : null
|
||||
|
||||
@@ -36,7 +36,8 @@ export async function handleUpdateMessage(command: UpdateMessageCommand, dataSou
|
||||
const nullableFields = [
|
||||
'channelId',
|
||||
'editedAt',
|
||||
'replyToId'
|
||||
'replyToId',
|
||||
'headHash'
|
||||
] as const;
|
||||
|
||||
for (const field of nullableFields) {
|
||||
@@ -44,8 +45,13 @@ export async function handleUpdateMessage(command: UpdateMessageCommand, dataSou
|
||||
entity[field] = updates[field] ?? null;
|
||||
}
|
||||
|
||||
if (updates.isDeleted !== undefined)
|
||||
if (updates.revision !== undefined) {
|
||||
existing.revision = updates.revision;
|
||||
}
|
||||
|
||||
if (updates.isDeleted !== undefined) {
|
||||
existing.isDeleted = updates.isDeleted ? 1 : 0;
|
||||
}
|
||||
|
||||
if (updates.linkMetadata !== undefined)
|
||||
existing.linkMetadata = updates.linkMetadata ? JSON.stringify(updates.linkMetadata) : null;
|
||||
|
||||
Reference in New Issue
Block a user