Skip to content

Commit

Permalink
update: parse int limit & page on flight
Browse files Browse the repository at this point in the history
  • Loading branch information
vierynugroho committed Jul 4, 2024
1 parent 8c7671c commit ac1e5c2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions controllers/flight.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ const prisma = new PrismaClient();
const getAllFlight = async (req, res, next) => {
try {
const {
page = 1,
limit = 10,
departureAirport,
arrivalAirport,
departureDate,
Expand All @@ -31,6 +29,8 @@ const getAllFlight = async (req, res, next) => {
sort,
} = req.query;

const page = parseInt(req.query.page) || 1;
const limit = parseInt(req.query.limit) || 10;
const skip = (page - 1) * limit;
const take = parseInt(limit);

Expand Down

0 comments on commit ac1e5c2

Please sign in to comment.