fixed chat zustand bug
This commit is contained in:
@@ -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 },
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { prisma } from "@repo/db";
|
||||
const fetchMainMessage = async () => {
|
||||
return await prisma.message.findFirst({
|
||||
return await prisma.notam.findFirst({
|
||||
where: {
|
||||
active: true,
|
||||
isMainMsg: true,
|
||||
|
||||
Reference in New Issue
Block a user