[api] wip reputation

This commit is contained in:
Devin Zuczek
2026-08-25 21:37:07 -04:00
parent 4bacdb0312
commit 4ff9609a8f
8 changed files with 1041 additions and 35 deletions
+9
View File
@@ -25,6 +25,11 @@ export default defineConfig({
// worker pushed (type + payload). GET the DO for the most recent one,
// GET /all for the whole list (friend-graph changes notify both players),
// DELETE to reset it between assertions.
//
// notifyPlayersEphemeral lands in the same list, tagged `ephemeral` and
// carrying `playerIds` rather than `playerId` — the two sends differ in
// whether an offline recipient gets the frame later, which is a thing worth
// asserting (a cheer's effect is broadcast to a room this way).
script: `
import { DurableObject } from 'cloudflare:workers'
export class NotificationsHub extends DurableObject {
@@ -33,6 +38,10 @@ export default defineConfig({
this.sent.push({ playerId, notificationType, data })
return { delivered: 0, queued: true }
}
async notifyPlayersEphemeral(playerIds, notificationType, data) {
this.sent.push({ playerIds, ephemeral: true, notificationType, data })
return { delivered: 0 }
}
async broadcast() { return { delivered: 0 } }
async fetch(request) {
if (request.method === 'DELETE') {