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

200
Views
Typescript + Prisma get object fields from express request

I want to get User's fields from a request body. Below is my current solution, the reason I use : User is it mandates required fields to be destructed also it gives autocompletion.

  const { username, password, email, birthday, country_code, preferences }: User = req.body;

I want to automatically get all fields from req.body. Maybe something like below.

const namedObject = ({} : User = req.body);

User Model

model User {
  id           Int       @id @default(autoincrement())
  username     String    @unique
  email        String    @unique
  password     String
  created_at   DateTime  @default(now())
  birthday     DateTime?
  country_code String?
  preferences  Json?
  Message      Message[]
}

Question

What is the proper solution for this?

about 4 years ago · Juan Pablo Isaza
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!