drop hashtag chart
This commit is contained in:
parent
88c3957085
commit
c559a9843f
@ -62,7 +62,6 @@ import PerUserNotesChart from './chart/charts/per-user-notes.js';
|
||||
import PerUserPvChart from './chart/charts/per-user-pv.js';
|
||||
import DriveChart from './chart/charts/drive.js';
|
||||
import PerUserReactionsChart from './chart/charts/per-user-reactions.js';
|
||||
import HashtagChart from './chart/charts/hashtag.js';
|
||||
import PerUserFollowingChart from './chart/charts/per-user-following.js';
|
||||
import PerUserDriveChart from './chart/charts/per-user-drive.js';
|
||||
import ApRequestChart from './chart/charts/ap-request.js';
|
||||
@ -187,7 +186,6 @@ const $PerUserNotesChart: Provider = { provide: 'PerUserNotesChart', useExisting
|
||||
const $PerUserPvChart: Provider = { provide: 'PerUserPvChart', useExisting: PerUserPvChart };
|
||||
const $DriveChart: Provider = { provide: 'DriveChart', useExisting: DriveChart };
|
||||
const $PerUserReactionsChart: Provider = { provide: 'PerUserReactionsChart', useExisting: PerUserReactionsChart };
|
||||
const $HashtagChart: Provider = { provide: 'HashtagChart', useExisting: HashtagChart };
|
||||
const $PerUserFollowingChart: Provider = { provide: 'PerUserFollowingChart', useExisting: PerUserFollowingChart };
|
||||
const $PerUserDriveChart: Provider = { provide: 'PerUserDriveChart', useExisting: PerUserDriveChart };
|
||||
const $ApRequestChart: Provider = { provide: 'ApRequestChart', useExisting: ApRequestChart };
|
||||
@ -315,7 +313,6 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
|
||||
PerUserPvChart,
|
||||
DriveChart,
|
||||
PerUserReactionsChart,
|
||||
HashtagChart,
|
||||
PerUserFollowingChart,
|
||||
PerUserDriveChart,
|
||||
ApRequestChart,
|
||||
@ -437,7 +434,6 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
|
||||
$PerUserPvChart,
|
||||
$DriveChart,
|
||||
$PerUserReactionsChart,
|
||||
$HashtagChart,
|
||||
$PerUserFollowingChart,
|
||||
$PerUserDriveChart,
|
||||
$ApRequestChart,
|
||||
@ -559,7 +555,6 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
|
||||
PerUserPvChart,
|
||||
DriveChart,
|
||||
PerUserReactionsChart,
|
||||
HashtagChart,
|
||||
PerUserFollowingChart,
|
||||
PerUserDriveChart,
|
||||
ApRequestChart,
|
||||
@ -680,7 +675,6 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
|
||||
$PerUserPvChart,
|
||||
$DriveChart,
|
||||
$PerUserReactionsChart,
|
||||
$HashtagChart,
|
||||
$PerUserFollowingChart,
|
||||
$PerUserDriveChart,
|
||||
$ApRequestChart,
|
||||
|
@ -4,7 +4,6 @@ import type { User } from '@/models/entities/User.js';
|
||||
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
|
||||
import { IdService } from '@/core/IdService.js';
|
||||
import type { Hashtag } from '@/models/entities/Hashtag.js';
|
||||
import HashtagChart from '@/core/chart/charts/hashtag.js';
|
||||
import type { HashtagsRepository, UsersRepository } from '@/models/index.js';
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
@ -20,7 +19,6 @@ export class HashtagService {
|
||||
|
||||
private userEntityService: UserEntityService,
|
||||
private idService: IdService,
|
||||
private hashtagChart: HashtagChart,
|
||||
) {
|
||||
}
|
||||
|
||||
@ -143,9 +141,5 @@ export class HashtagService {
|
||||
} as Hashtag);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isUserAttached) {
|
||||
this.hashtagChart.update(tag, user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import PerUserNotesChart from './charts/per-user-notes.js';
|
||||
import PerUserPvChart from './charts/per-user-pv.js';
|
||||
import DriveChart from './charts/drive.js';
|
||||
import PerUserReactionsChart from './charts/per-user-reactions.js';
|
||||
import HashtagChart from './charts/hashtag.js';
|
||||
import PerUserFollowingChart from './charts/per-user-following.js';
|
||||
import PerUserDriveChart from './charts/per-user-drive.js';
|
||||
import ApRequestChart from './charts/ap-request.js';
|
||||
@ -31,7 +30,6 @@ export class ChartManagementService implements OnApplicationShutdown {
|
||||
private perUserPvChart: PerUserPvChart,
|
||||
private driveChart: DriveChart,
|
||||
private perUserReactionsChart: PerUserReactionsChart,
|
||||
private hashtagChart: HashtagChart,
|
||||
private perUserFollowingChart: PerUserFollowingChart,
|
||||
private perUserDriveChart: PerUserDriveChart,
|
||||
private apRequestChart: ApRequestChart,
|
||||
@ -46,7 +44,6 @@ export class ChartManagementService implements OnApplicationShutdown {
|
||||
this.perUserPvChart,
|
||||
this.driveChart,
|
||||
this.perUserReactionsChart,
|
||||
this.hashtagChart,
|
||||
this.perUserFollowingChart,
|
||||
this.perUserDriveChart,
|
||||
this.apRequestChart,
|
||||
|
@ -1,10 +0,0 @@
|
||||
import Chart from '../../core.js';
|
||||
|
||||
export const name = 'hashtag';
|
||||
|
||||
export const schema = {
|
||||
'local.users': { uniqueIncrement: true },
|
||||
'remote.users': { uniqueIncrement: true },
|
||||
} as const;
|
||||
|
||||
export const entity = Chart.schemaToEntity(name, schema, true);
|
@ -1,45 +0,0 @@
|
||||
import { Injectable, Inject } from '@nestjs/common';
|
||||
import { DataSource } from 'typeorm';
|
||||
import type { User } from '@/models/entities/User.js';
|
||||
import { AppLockService } from '@/core/AppLockService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import Chart from '../core.js';
|
||||
import { ChartLoggerService } from '../ChartLoggerService.js';
|
||||
import { name, schema } from './entities/hashtag.js';
|
||||
import type { KVs } from '../core.js';
|
||||
|
||||
/**
|
||||
* ハッシュタグに関するチャート
|
||||
*/
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
@Injectable()
|
||||
export default class HashtagChart extends Chart<typeof schema> {
|
||||
constructor(
|
||||
@Inject(DI.db)
|
||||
private db: DataSource,
|
||||
|
||||
private appLockService: AppLockService,
|
||||
private userEntityService: UserEntityService,
|
||||
private chartLoggerService: ChartLoggerService,
|
||||
) {
|
||||
super(db, (k) => appLockService.getChartInsertLock(k), chartLoggerService.logger, name, schema, true);
|
||||
}
|
||||
|
||||
protected async tickMajor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async update(hashtag: string, user: { id: User['id'], host: User['host'] }): Promise<void> {
|
||||
await this.commit({
|
||||
'local.users': this.userEntityService.isLocalUser(user) ? [user.id] : [],
|
||||
'remote.users': this.userEntityService.isLocalUser(user) ? [] : [user.id],
|
||||
}, hashtag);
|
||||
}
|
||||
}
|
@ -7,7 +7,6 @@ import { entity as PerUserNotesChart } from './charts/entities/per-user-notes.js
|
||||
import { entity as PerUserPvChart } from './charts/entities/per-user-pv.js';
|
||||
import { entity as DriveChart } from './charts/entities/drive.js';
|
||||
import { entity as PerUserReactionsChart } from './charts/entities/per-user-reactions.js';
|
||||
import { entity as HashtagChart } from './charts/entities/hashtag.js';
|
||||
import { entity as PerUserFollowingChart } from './charts/entities/per-user-following.js';
|
||||
import { entity as PerUserDriveChart } from './charts/entities/per-user-drive.js';
|
||||
import { entity as ApRequestChart } from './charts/entities/ap-request.js';
|
||||
@ -27,7 +26,6 @@ export const entities = [
|
||||
PerUserPvChart.hour, PerUserPvChart.day,
|
||||
DriveChart.hour, DriveChart.day,
|
||||
PerUserReactionsChart.hour, PerUserReactionsChart.day,
|
||||
HashtagChart.hour, HashtagChart.day,
|
||||
PerUserFollowingChart.hour, PerUserFollowingChart.day,
|
||||
PerUserDriveChart.hour, PerUserDriveChart.day,
|
||||
ApRequestChart.hour, ApRequestChart.day,
|
||||
|
@ -12,7 +12,6 @@ import PerUserNotesChart from '@/core/chart/charts/per-user-notes.js';
|
||||
import PerUserPvChart from '@/core/chart/charts/per-user-pv.js';
|
||||
import DriveChart from '@/core/chart/charts/drive.js';
|
||||
import PerUserReactionsChart from '@/core/chart/charts/per-user-reactions.js';
|
||||
import HashtagChart from '@/core/chart/charts/hashtag.js';
|
||||
import PerUserFollowingChart from '@/core/chart/charts/per-user-following.js';
|
||||
import PerUserDriveChart from '@/core/chart/charts/per-user-drive.js';
|
||||
import ApRequestChart from '@/core/chart/charts/ap-request.js';
|
||||
@ -37,7 +36,6 @@ export class CleanChartsProcessorService {
|
||||
private perUserPvChart: PerUserPvChart,
|
||||
private driveChart: DriveChart,
|
||||
private perUserReactionsChart: PerUserReactionsChart,
|
||||
private hashtagChart: HashtagChart,
|
||||
private perUserFollowingChart: PerUserFollowingChart,
|
||||
private perUserDriveChart: PerUserDriveChart,
|
||||
private apRequestChart: ApRequestChart,
|
||||
@ -61,7 +59,6 @@ export class CleanChartsProcessorService {
|
||||
this.perUserPvChart.clean(),
|
||||
this.driveChart.clean(),
|
||||
this.perUserReactionsChart.clean(),
|
||||
this.hashtagChart.clean(),
|
||||
this.perUserFollowingChart.clean(),
|
||||
this.perUserDriveChart.clean(),
|
||||
this.apRequestChart.clean(),
|
||||
|
@ -11,13 +11,12 @@ import InstanceChart from '@/core/chart/charts/instance.js';
|
||||
import PerUserNotesChart from '@/core/chart/charts/per-user-notes.js';
|
||||
import DriveChart from '@/core/chart/charts/drive.js';
|
||||
import PerUserReactionsChart from '@/core/chart/charts/per-user-reactions.js';
|
||||
import HashtagChart from '@/core/chart/charts/hashtag.js';
|
||||
import PerUserFollowingChart from '@/core/chart/charts/per-user-following.js';
|
||||
import PerUserDriveChart from '@/core/chart/charts/per-user-drive.js';
|
||||
import ApRequestChart from '@/core/chart/charts/ap-request.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||
import type Bull from 'bull';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
|
||||
@Injectable()
|
||||
export class ResyncChartsProcessorService {
|
||||
@ -35,7 +34,6 @@ export class ResyncChartsProcessorService {
|
||||
private perUserNotesChart: PerUserNotesChart,
|
||||
private driveChart: DriveChart,
|
||||
private perUserReactionsChart: PerUserReactionsChart,
|
||||
private hashtagChart: HashtagChart,
|
||||
private perUserFollowingChart: PerUserFollowingChart,
|
||||
private perUserDriveChart: PerUserDriveChart,
|
||||
private apRequestChart: ApRequestChart,
|
||||
|
@ -12,7 +12,6 @@ import PerUserNotesChart from '@/core/chart/charts/per-user-notes.js';
|
||||
import PerUserPvChart from '@/core/chart/charts/per-user-pv.js';
|
||||
import DriveChart from '@/core/chart/charts/drive.js';
|
||||
import PerUserReactionsChart from '@/core/chart/charts/per-user-reactions.js';
|
||||
import HashtagChart from '@/core/chart/charts/hashtag.js';
|
||||
import PerUserFollowingChart from '@/core/chart/charts/per-user-following.js';
|
||||
import PerUserDriveChart from '@/core/chart/charts/per-user-drive.js';
|
||||
import ApRequestChart from '@/core/chart/charts/ap-request.js';
|
||||
@ -37,7 +36,6 @@ export class TickChartsProcessorService {
|
||||
private perUserPvChart: PerUserPvChart,
|
||||
private driveChart: DriveChart,
|
||||
private perUserReactionsChart: PerUserReactionsChart,
|
||||
private hashtagChart: HashtagChart,
|
||||
private perUserFollowingChart: PerUserFollowingChart,
|
||||
private perUserDriveChart: PerUserDriveChart,
|
||||
private apRequestChart: ApRequestChart,
|
||||
@ -61,7 +59,6 @@ export class TickChartsProcessorService {
|
||||
this.perUserPvChart.tick(false),
|
||||
this.driveChart.tick(false),
|
||||
this.perUserReactionsChart.tick(false),
|
||||
this.hashtagChart.tick(false),
|
||||
this.perUserFollowingChart.tick(false),
|
||||
this.perUserDriveChart.tick(false),
|
||||
this.apRequestChart.tick(false),
|
||||
|
@ -97,7 +97,6 @@ import * as ep___charts_activeUsers from './endpoints/charts/active-users.js';
|
||||
import * as ep___charts_apRequest from './endpoints/charts/ap-request.js';
|
||||
import * as ep___charts_drive from './endpoints/charts/drive.js';
|
||||
import * as ep___charts_federation from './endpoints/charts/federation.js';
|
||||
import * as ep___charts_hashtag from './endpoints/charts/hashtag.js';
|
||||
import * as ep___charts_instance from './endpoints/charts/instance.js';
|
||||
import * as ep___charts_notes from './endpoints/charts/notes.js';
|
||||
import * as ep___charts_user_drive from './endpoints/charts/user/drive.js';
|
||||
@ -433,7 +432,6 @@ const $charts_activeUsers: Provider = { provide: 'ep:charts/active-users', useCl
|
||||
const $charts_apRequest: Provider = { provide: 'ep:charts/ap-request', useClass: ep___charts_apRequest.default };
|
||||
const $charts_drive: Provider = { provide: 'ep:charts/drive', useClass: ep___charts_drive.default };
|
||||
const $charts_federation: Provider = { provide: 'ep:charts/federation', useClass: ep___charts_federation.default };
|
||||
const $charts_hashtag: Provider = { provide: 'ep:charts/hashtag', useClass: ep___charts_hashtag.default };
|
||||
const $charts_instance: Provider = { provide: 'ep:charts/instance', useClass: ep___charts_instance.default };
|
||||
const $charts_notes: Provider = { provide: 'ep:charts/notes', useClass: ep___charts_notes.default };
|
||||
const $charts_user_drive: Provider = { provide: 'ep:charts/user/drive', useClass: ep___charts_user_drive.default };
|
||||
@ -773,7 +771,6 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
||||
$charts_apRequest,
|
||||
$charts_drive,
|
||||
$charts_federation,
|
||||
$charts_hashtag,
|
||||
$charts_instance,
|
||||
$charts_notes,
|
||||
$charts_user_drive,
|
||||
@ -1107,7 +1104,6 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
||||
$charts_apRequest,
|
||||
$charts_drive,
|
||||
$charts_federation,
|
||||
$charts_hashtag,
|
||||
$charts_instance,
|
||||
$charts_notes,
|
||||
$charts_user_drive,
|
||||
|
@ -96,7 +96,6 @@ import * as ep___charts_activeUsers from './endpoints/charts/active-users.js';
|
||||
import * as ep___charts_apRequest from './endpoints/charts/ap-request.js';
|
||||
import * as ep___charts_drive from './endpoints/charts/drive.js';
|
||||
import * as ep___charts_federation from './endpoints/charts/federation.js';
|
||||
import * as ep___charts_hashtag from './endpoints/charts/hashtag.js';
|
||||
import * as ep___charts_instance from './endpoints/charts/instance.js';
|
||||
import * as ep___charts_notes from './endpoints/charts/notes.js';
|
||||
import * as ep___charts_user_drive from './endpoints/charts/user/drive.js';
|
||||
@ -430,7 +429,6 @@ const eps = [
|
||||
['charts/ap-request', ep___charts_apRequest],
|
||||
['charts/drive', ep___charts_drive],
|
||||
['charts/federation', ep___charts_federation],
|
||||
['charts/hashtag', ep___charts_hashtag],
|
||||
['charts/instance', ep___charts_instance],
|
||||
['charts/notes', ep___charts_notes],
|
||||
['charts/user/drive', ep___charts_user_drive],
|
||||
|
@ -1,37 +0,0 @@
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { getJsonSchema } from '@/core/chart/core.js';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import HashtagChart from '@/core/chart/charts/hashtag.js';
|
||||
import { schema } from '@/core/chart/charts/entities/hashtag.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['charts', 'hashtags'],
|
||||
|
||||
res: getJsonSchema(schema),
|
||||
|
||||
allowGet: true,
|
||||
cacheSec: 60 * 60,
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
span: { type: 'string', enum: ['day', 'hour'] },
|
||||
limit: { type: 'integer', minimum: 1, maximum: 500, default: 30 },
|
||||
offset: { type: 'integer', nullable: true, default: null },
|
||||
tag: { type: 'string' },
|
||||
},
|
||||
required: ['span', 'tag'],
|
||||
} as const;
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
@Injectable()
|
||||
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
constructor(
|
||||
private hashtagChart: HashtagChart,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
return await this.hashtagChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.tag);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user