Skip to content

Commit 0968b1f

Browse files
authored
Added more fields to Account Entity (#1499)
ref https://linear.app/ghost/issue/BER-3012 - we want to remove the multiple calls to `siteService.getSiteByHost` and `accountService.getDefaultAccountForSite` in dispatchers.js, as they create 3 database queries for each dispatcher call - instead, we want to load the account data in the Fedify context directly, so that we make a single database query to retrieve host account data per request - dispatchers however currently use the Account type, not the Account entity. This change adds the missing fields to Account entity so it can be used by dispatchers code
1 parent 0fa04bd commit 0968b1f

11 files changed

+231
-402
lines changed

src/account/account.entity.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ export interface Account {
2525
readonly apId: URL;
2626
readonly apFollowers: URL | null;
2727
readonly apInbox: URL | null;
28+
readonly apOutbox: URL | null;
29+
readonly apFollowing: URL | null;
30+
readonly apLiked: URL | null;
2831
readonly isInternal: boolean;
2932
readonly customFields: Record<string, string> | null;
3033
unblock(account: Account): Account;
@@ -82,6 +85,9 @@ export class AccountEntity implements Account {
8285
public readonly apId: URL,
8386
public readonly apFollowers: URL | null,
8487
public readonly apInbox: URL | null,
88+
public readonly apOutbox: URL | null,
89+
public readonly apFollowing: URL | null,
90+
public readonly apLiked: URL | null,
8591
public readonly isInternal: boolean,
8692
public readonly customFields: Record<string, string> | null,
8793
private events: AccountEvent[],
@@ -109,6 +115,9 @@ export class AccountEntity implements Account {
109115
data.apId,
110116
data.apFollowers,
111117
data.apInbox,
118+
data.apOutbox,
119+
data.apFollowing,
120+
data.apLiked,
112121
data.isInternal,
113122
data.customFields,
114123
events,
@@ -129,6 +138,9 @@ export class AccountEntity implements Account {
129138
draft.apId,
130139
draft.apFollowers,
131140
draft.apInbox,
141+
draft.apOutbox,
142+
draft.apFollowing,
143+
draft.apLiked,
132144
draft.isInternal,
133145
draft.customFields,
134146
events,

0 commit comments

Comments
 (0)