hunk.code_window:  *        description: Authorization information is missing or invalid.
    */
   async function postHandler(req: NextApiRequest) {
     const { prisma, body, userId } = req;
     const data = schemaTeamBodyParams.parse(body);
     const team = await prisma.team.create({
       data: {
  
hunk.labels: keep keep keep keep add keep keep
hunk.after_edit:   // TODO: Perhaps there is a better fix for this?
     const cloneData: typeof data & {
       metadata: NonNullable<typeof data.metadata> | undefined;
     } = {
       ...data,
       metadata: data.metadata === null ? {} : data.metadata || undefined,
     };
  
hunk.file_path: pages/api/teams/_post.ts
hunk.type: add
file: import { Prisma } from "@prisma/client";
  import type { NextApiRequest } from "next";
  
  import { defaultResponder } from "@calcom/lib/server";
  
  import { schemaTeamsReadPublic } from "@lib/validations/team";
  
  /**
   * @swagger
   * /teams:
   *   get:
   *     operationId: listTeams
   *     summary: Find all teams
   *     tags:
   *     - teams
   *     responses:
   *       200:
   *         description: OK
   *       401:
   *        description: Authorization information is missing or invalid.
   *       404:
   *         description: No teams were found
   */
  async function getHandler(req: NextApiRequest) {
    const { userId, prisma, isAdmin } = req;
    const where: Prisma.TeamWhereInput = {};
    // If user is not ADMIN, return only his data.
    if (!isAdmin) where.members = { some: { userId } };
    const data = await prisma.team.findMany({ where });
    return { teams: schemaTeamsReadPublic.parse(data) };
  }
  
  export default defaultResponder(getHandler);
  