chore: More flakey test improvements (#5801)

This commit is contained in:
Tom Moor
2023-09-09 18:30:19 -04:00
committed by GitHub
parent 7270e65f0c
commit 80ef0a38d6
37 changed files with 245 additions and 210 deletions

View File

@@ -1,4 +1,4 @@
import type { SaveOptions } from "sequelize";
import type { SaveOptions, WhereOptions } from "sequelize";
import {
ForeignKey,
AfterSave,
@@ -111,6 +111,19 @@ class Event extends IdModel {
);
}
/**
* Find the latest event matching the where clause
*
* @param where The options to match against
* @returns A promise resolving to the latest event or null
*/
static findLatest(where: WhereOptions) {
return this.findOne({
where,
order: [["createdAt", "DESC"]],
});
}
static ACTIVITY_EVENTS: TEvent["name"][] = [
"collections.create",
"collections.delete",