diff --git a/packages/api/src/services/export.ts b/packages/api/src/services/export.ts index 70e88f55d..b3bf4a420 100644 --- a/packages/api/src/services/export.ts +++ b/packages/api/src/services/export.ts @@ -23,12 +23,12 @@ export const countExportsWithinMinute = async ( }) } -export const countExportsWithin24Hours = async ( +export const countExportsWithin6Hours = async ( userId: string ): Promise => { 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 => { + return getRepository(Export).find({ + where: { + userId, + }, + order: { + createdAt: 'DESC', + }, + }) +}