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:
@@ -173,7 +173,10 @@ export class MessageSchema extends PothosSchema {
|
|||||||
const message = await this.prisma.$transaction(async (tx) => {
|
const message = await this.prisma.$transaction(async (tx) => {
|
||||||
const message = await tx.message.create({
|
const message = await tx.message.create({
|
||||||
...query,
|
...query,
|
||||||
data: args.input,
|
data: {
|
||||||
|
...args.input,
|
||||||
|
context: MessageContextType.CHAT,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
await tx.chatRoom.update({
|
await tx.chatRoom.update({
|
||||||
where: {
|
where: {
|
||||||
|
|||||||
Reference in New Issue
Block a user