Skip to content

Commit

Permalink
feat: anonymous chatting
Browse files Browse the repository at this point in the history
  • Loading branch information
monde2738 committed Nov 11, 2024
1 parent 285e091 commit 432dafc
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/api/src/service/chat.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import type { Prisma, User } from "@prisma/client";
import type * as schema from "@biseo/interface/chat";
import type { Agenda } from "@biseo/interface/agenda";

import { prisma } from "@biseo/api/db/prisma";

export const createMessage = async (
{ message }: schema.Send,
user: User,
user: User | undefined,
): Promise<schema.Message> => {
const anonUser: User = {
id: 0,
username: "익명",
displayName: "익명",
isAdmin: false,
};
const displayAccount = user || anonUser;
const sendQuery: Prisma.ChatCreateInput = {
user: { connect: user },
user: { connect: displayAccount },
type: "message",
message,
createdAt: new Date(),
Expand Down

0 comments on commit 432dafc

Please sign in to comment.