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) {
|
export async function POST(req: Request) {
|
||||||
try {
|
try {
|
||||||
const json = await req.json(); // Parse incoming JSON data
|
const json = await req.json();
|
||||||
const {rangeDaysPrev} = json.body
|
const { rangeDaysPrev } = json.body;
|
||||||
|
|
||||||
const now = new Date()
|
const now = new Date();
|
||||||
const rangeBeginning = new Date();
|
const rangeBeginning = new Date();
|
||||||
rangeBeginning.setDate(rangeBeginning.getDate() - rangeDaysPrev)
|
rangeBeginning.setDate(rangeBeginning.getDate() - rangeDaysPrev);
|
||||||
|
|
||||||
const earthquakes = await prisma.earthquake.findMany(
|
const earthquakes = await prisma.earthquake.findMany({
|
||||||
{where: {
|
where: {
|
||||||
date: {
|
date: {
|
||||||
gte: rangeBeginning,
|
gte: rangeBeginning,
|
||||||
lte: now
|
lte: now,
|
||||||
}
|
},
|
||||||
}}
|
},
|
||||||
);
|
});
|
||||||
|
|
||||||
if (earthquakes) {
|
if (earthquakes) {
|
||||||
return NextResponse.json({ message: "Got earthquakes successfully", earthquakes }, { status: 200 });
|
return NextResponse.json({ message: "Got earthquakes successfully", earthquakes }, { status: 200 });
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user