mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
refactor: countAuthorStats() function does not return search
This commit is contained in:
parent
ebeb150463
commit
578f269a65
1 changed files with 1 additions and 8 deletions
|
|
@ -270,25 +270,18 @@ export async function updateEventStats(
|
||||||
/** Calculate author stats from the database. */
|
/** Calculate author stats from the database. */
|
||||||
export async function countAuthorStats(
|
export async function countAuthorStats(
|
||||||
{ pubkey, kysely, store }: RefreshAuthorStatsOpts,
|
{ pubkey, kysely, store }: RefreshAuthorStatsOpts,
|
||||||
): Promise<DittoTables['author_stats']> {
|
): Promise<Omit<DittoTables['author_stats'], 'search'>> {
|
||||||
const [{ count: followers_count }, { count: notes_count }, [followList]] = await Promise.all([
|
const [{ count: followers_count }, { count: notes_count }, [followList]] = await Promise.all([
|
||||||
store.count([{ kinds: [3], '#p': [pubkey] }]),
|
store.count([{ kinds: [3], '#p': [pubkey] }]),
|
||||||
store.count([{ kinds: [1], authors: [pubkey] }]),
|
store.count([{ kinds: [1], authors: [pubkey] }]),
|
||||||
store.query([{ kinds: [3], authors: [pubkey], limit: 1 }]),
|
store.query([{ kinds: [3], authors: [pubkey], limit: 1 }]),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const [{ search }] = await kysely
|
|
||||||
.selectFrom('author_stats')
|
|
||||||
.select('search')
|
|
||||||
.where('pubkey', '=', [pubkey])
|
|
||||||
.execute();
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
pubkey,
|
pubkey,
|
||||||
followers_count,
|
followers_count,
|
||||||
following_count: getTagSet(followList?.tags ?? [], 'p').size,
|
following_count: getTagSet(followList?.tags ?? [], 'p').size,
|
||||||
notes_count,
|
notes_count,
|
||||||
search,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue