🐜 fix: Add asynchronous bus for Steam account

This commit is contained in:
Wanjohi
2025-06-10 16:01:59 +03:00
parent 661d9d2e56
commit 8b07adb0fc
3 changed files with 99 additions and 91 deletions

View File

@@ -1,12 +1,14 @@
import { z } from "zod";
import { fn } from "../utils";
import { Resource } from "sst";
import { Actor } from "../actor";
import { bus } from "sst/aws/bus";
import { Common } from "../common";
import { Examples } from "../examples";
import { createEvent } from "../event";
import { eq, and, isNull, desc } from "drizzle-orm";
import { steamTable, StatusEnum, Limitations } from "./steam.sql";
import { createTransaction, useTransaction } from "../drizzle/transaction";
import { afterTx, createTransaction, useTransaction } from "../drizzle/transaction";
export namespace Steam {
export const Info = z
@@ -122,9 +124,9 @@ export namespace Steam {
lastSyncedAt: input.lastSyncedAt ?? Common.utc(),
})
// await afterTx(async () =>
// bus.publish(Resource.Bus, Events.Created, { userID, steamID: input.id })
// );
await afterTx(async () =>
bus.publish(Resource.Bus, Events.Created, { userID, steamID: input.id })
);
return input.id
}),
@@ -149,9 +151,9 @@ export namespace Steam {
})
.where(eq(steamTable.id, input.steamID));
// await afterTx(async () =>
// bus.publish(Resource.Bus, Events.Updated, { userID, steamID: input.steamID })
// );
await afterTx(async () =>
bus.publish(Resource.Bus, Events.Updated, { userID, steamID: input.steamID })
);
return input.steamID
})