Change time
This commit is contained in:
@ -23,12 +23,12 @@ export const countExportsWithinMinute = async (
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const countExportsWithin24Hours = async (
|
export const countExportsWithin6Hours = async (
|
||||||
userId: string
|
userId: string
|
||||||
): Promise<number> => {
|
): Promise<number> => {
|
||||||
return getRepository(Export).countBy({
|
return getRepository(Export).countBy({
|
||||||
userId,
|
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]),
|
state: In([TaskState.Pending, TaskState.Running, TaskState.Succeeded]),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -42,3 +42,14 @@ export const findExportById = async (
|
|||||||
userId,
|
userId,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const findExports = async (userId: string): Promise<Export[] | null> => {
|
||||||
|
return getRepository(Export).find({
|
||||||
|
where: {
|
||||||
|
userId,
|
||||||
|
},
|
||||||
|
order: {
|
||||||
|
createdAt: 'DESC',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user