refactor: enhance message creation logic by adding context

- Updated the message creation logic to include a default context of 'CHAT' in the data being saved, ensuring that all messages have a defined context.
- This change improves the consistency of message data and enhances the overall functionality of the messaging system.
This commit is contained in:
2024-12-10 17:17:35 +07:00
parent 45c7b6d5b9
commit c8f4abd670

View File

@@ -173,7 +173,10 @@ export class MessageSchema extends PothosSchema {
const message = await this.prisma.$transaction(async (tx) => {
const message = await tx.message.create({
...query,
data: args.input,
data: {
...args.input,
context: MessageContextType.CHAT,
}
})
await tx.chatRoom.update({
where: {