Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!