sdy

update createRoom resolver and typedef

type Mutation {
createRoom(participantsId: [Int], categories: [Int], name: String!): Room!
createRoom(name: String!): Room!
}
......
import { prisma } from "../../../utils";
import { prisma, isAuthenticated } from "../../../utils";
export default {
Mutation: {
createRoom: async (_, args) => {
const { participantsId, categories, name } = args;
let newRoom, participantId;
if (participantsId !== undefined) {
createRoom: async (_, args, { request }) => {
isAuthenticated(request);
const { name } = args;
const { user } = request;
let newRoom;
if (name !== undefined) {
newRoom = await prisma.room.create({
data: {
participants: {
connect: {
id: (participantId = participantsId.forEach(
(cur, _, __) => cur
)),
},
},
name,
},
});
}
if (categories !== undefined) {
newRoom = await prisma.room.create({
data: {
categories: {
participants: {
connect: {
id: (category = categories.forEach((cur, _, __) => cur)),
id: user.id,
},
},
name,
},
});
}
......