Change time

This commit is contained in:
Jackson Harper
2024-11-02 14:50:52 +08:00
parent 75365f4811
commit c4b5739f3e

View File

@ -23,12 +23,12 @@ export const countExportsWithinMinute = async (
})
}
export const countExportsWithin24Hours = async (
export const countExportsWithin6Hours = async (
userId: string
): Promise<number> => {
return getRepository(Export).countBy({
userId,
createdAt: MoreThan(new Date(Date.now() - 24 * 60 * 60 * 1000)),
createdAt: MoreThan(new Date(Date.now() - 6 * 60 * 60 * 1000)),
state: In([TaskState.Pending, TaskState.Running, TaskState.Succeeded]),
})
}
@ -42,3 +42,14 @@ export const findExportById = async (
userId,
})
}
export const findExports = async (userId: string): Promise<Export[] | null> => {
return getRepository(Export).find({
where: {
userId,
},
order: {
createdAt: 'DESC',
},
})
}