mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 04:55:42 +09:00
fix(api): resolve missing user rows for webhooks and sessions (#2487)
This commit is contained in:
1 parent
d5bfa5a73d
commit
a036d9a2e1
10 files changed
+258
-25
No files matched your search
@@ -1,7 +1,9 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {DELETED_USER_ID} from '@fluxer/constants/src/UserConstants';
|
||||
import type {WebhookResponse, WebhookTokenResponse} from '@fluxer/schema/src/domains/webhook/WebhookSchemas';
|
||||
import type {z} from 'zod';
|
||||
import {createUserID} from '../BrandedTypes';
|
||||
import type {UserCacheService} from '../infrastructure/UserCacheService';
|
||||
import type {RequestCache} from '../middleware/RequestCacheMiddleware';
|
||||
import type {Webhook} from '../models/Webhook';
|
||||
@@ -28,13 +30,10 @@ export async function mapWebhookToResponseWithCache({
|
||||
requestCache: RequestCache;
|
||||
}): Promise<z.infer<typeof WebhookResponse>> {
|
||||
const creatorPartial = await getCachedUserPartialResponse({
|
||||
userId: webhook.creatorId!,
|
||||
userId: webhook.creatorId ?? createUserID(DELETED_USER_ID),
|
||||
userCacheService,
|
||||
requestCache,
|
||||
});
|
||||
if (!creatorPartial) {
|
||||
throw new Error(`Creator user ${webhook.creatorId} not found for webhook`);
|
||||
}
|
||||
return {
|
||||
...mapWebhookToTokenResponse(webhook),
|
||||
user: creatorPartial,
|
||||
|
||||
Reference in new issue
Block a user