Audit chat message mutations

This commit is contained in:
ZacharyZhang-NY committed 2026-05-23 21:59:16 -04:00
1 parent c59be97b79
commit e78e9a8aa0
8 files changed
+232 -1

No files matched your search

@@ -1,5 +1,5 @@
import type { DatabaseSync } from "node:sqlite";
import type { CreateChatSpaceInput, MarkChatSpaceReadInput, SendMessageInput } from "../../shared/commands";
import type { CreateChatSpaceInput, DeleteMessageInput, EditMessageInput, MarkChatSpaceReadInput, SendMessageInput } from "../../shared/commands";
import {
CHAT_THREAD_BOARD_STATE,
FILE_SCAN_STATE,
@@ -11,6 +11,7 @@ import { ApprovalService } from "./approval-service";
import { AuditService } from "./audit-service";
import { BoardInterventionService, parseBoardCommand } from "./board-intervention-service";
import { buildChatMessageStructure } from "./chat-message-structure";
import { ChatMessageMutationService } from "./chat-message-mutation-service";
import { recordChatMentions, resolveChatMentions, type ResolvedMention } from "./chat-mentions";
import { FileHandoffService, type FileHandoffAttachment } from "./file-handoff-service";
@@ -52,12 +53,14 @@ export class ChatService {
private readonly approvals: ApprovalService;
private readonly boardInterventions: BoardInterventionService;
private readonly handoffs: FileHandoffService;
private readonly messageMutations: ChatMessageMutationService;
constructor(private readonly db: DatabaseSync) {
this.audit = new AuditService(db);
this.approvals = new ApprovalService(db);
this.boardInterventions = new BoardInterventionService(db);
this.handoffs = new FileHandoffService(db);
this.messageMutations = new ChatMessageMutationService(db);
}
createSpace(input: CreateChatSpaceInput): string {
@@ -197,6 +200,14 @@ export class ChatService {
`).run(input.orgId, input.employeeId, input.spaceId, latest?.id ?? null, now);
}
editMessage(input: EditMessageInput): void {
this.messageMutations.editMessage(input);
}
deleteMessage(input: DeleteMessageInput): void {
this.messageMutations.deleteMessage(input);
}
private executeSlashCommand(
input: SendMessageInput,
space: SpaceRow,