This commit is contained in:
Tom Moor
2024-07-18 20:18:55 -04:00
parent 51c5512902
commit 011ffc450c
4 changed files with 9 additions and 5 deletions
+1
View File
@@ -245,6 +245,7 @@ async function provisionFirstCollection(team: Team, user: User) {
document.content = await DocumentHelper.toJSON(document);
await document.publish(user, collection.id, {
silent: true,
transaction,
});
}
+3 -3
View File
@@ -361,7 +361,7 @@ class Document extends ParanoidModel<
@BeforeSave
static async updateCollectionStructure(
model: Document,
{ transaction }: SaveOptions<Document>
{ transaction }: SaveOptions<InferAttributes<Document>>
) {
// templates, drafts, and archived documents don't appear in the structure
// and so never need to be updated when the title changes
@@ -811,8 +811,8 @@ class Document extends ParanoidModel<
publish = async (
user: User,
collectionId: string,
options: SaveOptions<Document>
) => {
options: SaveOptions
): Promise<this> => {
const { transaction } = options;
// If the document is already published then calling publish should act like
+4 -1
View File
@@ -77,7 +77,10 @@ class Event extends IdModel<
}
@AfterSave
static async enqueue(model: Event, options: SaveOptions<Event>) {
static async enqueue(
model: Event,
options: SaveOptions<InferAttributes<Event>>
) {
if (options.transaction) {
options.transaction.afterCommit(() => void globalEventQueue.add(model));
return;
+1 -1
View File
@@ -177,7 +177,7 @@ class Notification extends Model<
@AfterCreate
static async createEvent(
model: Notification,
options: SaveOptions<Notification>
options: SaveOptions<InferAttributes<Notification>>
) {
const params = {
name: "notifications.create",