chore: More flakey test improvements (#5801)
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user