Removed comment
This commit is contained in:
parent
3d59e86559
commit
158dbbf166
@ -8,21 +8,21 @@ if (usingPrisma) prisma = new PrismaClient();
|
||||
|
||||
export async function POST(req: Request) {
|
||||
try {
|
||||
const json = await req.json(); // Parse incoming JSON data
|
||||
const {rangeDaysPrev} = json.body
|
||||
const json = await req.json();
|
||||
const { rangeDaysPrev } = json.body;
|
||||
|
||||
const now = new Date()
|
||||
const now = new Date();
|
||||
const rangeBeginning = new Date();
|
||||
rangeBeginning.setDate(rangeBeginning.getDate() - rangeDaysPrev)
|
||||
rangeBeginning.setDate(rangeBeginning.getDate() - rangeDaysPrev);
|
||||
|
||||
const earthquakes = await prisma.earthquake.findMany(
|
||||
{where: {
|
||||
const earthquakes = await prisma.earthquake.findMany({
|
||||
where: {
|
||||
date: {
|
||||
gte: rangeBeginning,
|
||||
lte: now
|
||||
}
|
||||
}}
|
||||
);
|
||||
lte: now,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (earthquakes) {
|
||||
return NextResponse.json({ message: "Got earthquakes successfully", earthquakes }, { status: 200 });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user