fixed chat zustand bug

This commit is contained in:
PxlLoewe
2025-03-21 10:27:32 -07:00
parent 71aff2d66a
commit b7eb148ca6
17 changed files with 399 additions and 91 deletions

View File

@@ -1,15 +1,15 @@
"use server";
import { prisma, Prisma } from "@repo/db";
export const addMessage = async (message: Prisma.MessageCreateInput) => {
export const addMessage = async (message: Prisma.NotamCreateInput) => {
try {
// Set all current messages with isMainMsg=true to active=false
await prisma.message.updateMany({
await prisma.notam.updateMany({
where: { isMainMsg: true },
data: { active: false },
});
await prisma.message.create({
await prisma.notam.create({
data: {
message: message.message,
color: message.color,
@@ -26,7 +26,7 @@ export const addMessage = async (message: Prisma.MessageCreateInput) => {
export const disableMessage = async () => {
try {
// Set all current messages with isMainMsg=true to active=false
await prisma.message.updateMany({
await prisma.notam.updateMany({
where: { isMainMsg: true },
data: { active: false },
});