Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
Query in prisma

I need to do a prism query, where my id is the same as the login id, but idk how do I do it, I'm doing it like this, but it filters all titles, and I just need the title of the login that was done now

import React from 'react';
import Link from 'next/link';
import { PrismaClient } from '@prisma/client';
import { signIn, signOut, useSession } from 'next-auth/client';

export async function getStaticProps() {
  const prisma = new PrismaClient();
  const services = await prisma.service.findUnique({
    where: {
      id: 
    },
  })
  return {
    props: {
      services,
    },
  };
}

export default function Home({ services }) {
  const [session] = useSession();

  return (
    <>
      {!session && (
        <>
          Not signed in
          {' '}
          <br />
          <button type="button" onClick={signIn}>Sign In</button>
        </>
      )}
      {session && (
        <>
          Signed in as {session.user.email} <br />
          <ul>
            {services.map((service) => (
              <li key={service.id}>{service.title}</li>
            ))}
          </ul>

The "service" is my table, and it is linked to the "session" table, both have the id column, and I only need to show the titles of the "service" that are in the id registered in the "session".

does it make sense what I'm saying? Thank you in advance!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Have a look at this page. You can use getSession from next-auth to get the required user session details.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda