chore: rename return types to Data, import prisma from @calcom/prisma
This commit is contained in:
1 parent
b753466bda
commit
c5b12d46af
4 files changed
+15
-13
No files matched your search
+2
-1
@@ -28,6 +28,7 @@
|
||||
"zod": "^3.14.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "^12.1.0"
|
||||
"next": "^12.1.0",
|
||||
"zod": "^3.14.2"
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
import { EventType } from "@prisma/client";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
import prisma from "@calcom/prisma";
|
||||
import { EventType } from "@calcom/prisma/client";
|
||||
|
||||
type EventIdData = {
|
||||
type Data = {
|
||||
event?: EventType;
|
||||
error?: any;
|
||||
};
|
||||
|
||||
export default async function eventType(req: NextApiRequest, res: NextApiResponse<EventIdData>) {
|
||||
export default async function eventType(req: NextApiRequest, res: NextApiResponse<Data>) {
|
||||
try {
|
||||
const event = await prisma.eventType.findUnique({ where: { id: Number(req.query.id) } });
|
||||
res.status(200).json({ event });
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { PrismaClient, EventType } from "@prisma/client";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
type EventTypeIdData = {
|
||||
import prisma from "@calcom/prisma";
|
||||
import { EventType } from "@calcom/prisma/client";
|
||||
|
||||
type Data = {
|
||||
events?: EventType[];
|
||||
error?: any;
|
||||
};
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
export default async function eventType(req: NextApiRequest, res: NextApiResponse<EventTypeIdData>) {
|
||||
export default async function eventType(req: NextApiRequest, res: NextApiResponse<Data>) {
|
||||
try {
|
||||
const eventTypes = await prisma.eventType.findMany({ where: { id: Number(req.query.eventTypeId) } });
|
||||
res.status(200).json({ events: { ...eventTypes } });
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { PrismaClient, EventType } from "@prisma/client";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
import prisma from "@calcom/prisma";
|
||||
import { EventType } from "@calcom/prisma/client";
|
||||
|
||||
interface Body {
|
||||
userId: string;
|
||||
|
||||
@@ -10,12 +11,12 @@ interface Body {
|
||||
users: string[];
|
||||
};
|
||||
}
|
||||
type EventsData = {
|
||||
type Data = {
|
||||
event?: EventType;
|
||||
error?: string;
|
||||
};
|
||||
|
||||
export default async function createEventLink(req: NextApiRequest, res: NextApiResponse<EventsData>) {
|
||||
export default async function createEventLink(req: NextApiRequest, res: NextApiResponse<Data>) {
|
||||
const {
|
||||
body: {
|
||||
title,
|
||||
|
||||
Reference in new issue
Block a user