Skip to content

Commit

Permalink
Limit mission history to 12 hours
Browse files Browse the repository at this point in the history
  • Loading branch information
danreeves committed Nov 13, 2023
1 parent 25c6af4 commit 14f916c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/services/db/missionInstances.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import type { MissionInstance } from "@prisma/client"
import { prisma } from "~/services/prisma.server"

export async function getMissionHistory() {
let dayAgo = Date.now() - 24 * 60 * 60 * 1000
let dayAgoString = new Date(dayAgo).toISOString()
let twelveHoursAgo = Date.now() - 12 * 60 * 60 * 1000
let twelveHoursAgoString = new Date(twelveHoursAgo).toISOString()

return await prisma.missionInstance.findMany({
where: { start: { gte: dayAgoString } },
where: { start: { gte: twelveHoursAgoString } },
orderBy: {
start: "desc",
},
Expand Down

0 comments on commit 14f916c

Please sign in to comment.