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

299
Views
how to create a DTO of this object in nestJs?

I'm trying to learn NestJs and I'm want to practice it.

I want to learn more about the DTO so I create this sample db.ts and I want to return it using DTO but I don't know how. can someone help me.

to help you understand what I'm trying to do: I want to create a home route (localhost:8080) this route have a controller will return using a service provider the following object but using a dto.

The service Provider function will be like that.

@Injectable()
export class AppService {
    private week = Week;
    getWeek() : WeekResponseDto[] {
        return (this.week);
    }
}

The DataBase:

export let Week = [
    {
        DayName : "TuesDay",
        TimeZone: [
            {
                First: {
                        Start: 18,
                        end: 19,
                        isReserved: false,
                        reserver: "someone"
                },
                Second: {
                        Start: 19,
                        end: 20,
                        isReserved: false,
                        reserver: "someone"
                },
                Third: {
                        Start: 20,
                        end: 21,
                        isReserved: false,
                        reserver: "someone"
                }
            }
        ]
    },
    {
        DayName : "Wednesday",
        TimeZone: [
            {
                First: {
                        Start: 18,
                        end: 19,
                        isReserved: false,
                        reserver: "someone"
                },
                Second: {
                        Start: 19,
                        end: 20,
                        isReserved: false,
                        reserver: "someone"
                },
                Third: {
                        Start: 20,
                        end: 21,
                        isReserved: false,
                        reserver: "someone"
                }
            }
        ]
    },
    {
        DayName : "Friday",
        TimeZone: [
            {
                First: {
                        Start: 18,
                        end: 19,
                        isReserved: false,
                        reserver: "someone"
                },
                Second: {
                        Start: 19,
                        end: 20,
                        isReserved: false,
                        reserver: "someone"
                },
                Third: {
                        Start: 20,
                        end: 21,
                        isReserved: false,
                        reserver: "someone"
                }
            }
        ]
    }
]

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!