FoundKey/packages/backend/src/services/chart/charts/hashtag.ts
syuilo c1b264e4e9
Improve chart engine (#8253)
* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Update core.ts

* wip

* wip

* #7361

* delete network chart

* federationChart強化 apRequestChart追加

* tweak
2022-02-06 00:13:52 +09:00

28 lines
822 B
TypeScript

import autobind from 'autobind-decorator';
import Chart, { KVs } from '../core';
import { User } from '@/models/entities/user';
import { Users } from '@/models/index';
import { name, schema } from './entities/hashtag';
/**
* ハッシュタグに関するチャート
*/
// eslint-disable-next-line import/no-default-export
export default class HashtagChart extends Chart<typeof schema> {
constructor() {
super(name, schema, true);
}
@autobind
protected async queryCurrentState(): Promise<Partial<KVs<typeof schema>>> {
return {};
}
@autobind
public async update(hashtag: string, user: { id: User['id'], host: User['host'] }): Promise<void> {
await this.commit({
'local.users': Users.isLocalUser(user) ? [user.id] : [],
'remote.users': Users.isLocalUser(user) ? [] : [user.id],
}, hashtag);
}
}