remove unused hashtag chart
ci/woodpecker/push/lint-backend Pipeline failed Details
ci/woodpecker/push/lint-client Pipeline failed Details
ci/woodpecker/push/build Pipeline failed Details
ci/woodpecker/push/test unknown status Details
ci/woodpecker/push/lint-sw Pipeline failed Details
ci/woodpecker/push/lint-foundkey-js Pipeline failed Details

Changelog: Removed
This commit is contained in:
Johann150 2024-03-17 16:48:36 +01:00
parent f751941a30
commit d82c72a111
Signed by: Johann150
GPG Key ID: 9EE6577A2A06F8F1
10 changed files with 16 additions and 74 deletions

View File

@ -0,0 +1,14 @@
export class removeHashtagChart1710687673333 {
async up(queryRunner) {
await queryRunner.query(`DROP TABLE "__chart__hashtag"`);
await queryRunner.query(`DROP TABLE "__chart_day__hashtag"`);
await queryRunner.query(`DROP SEQUENCE "__chart__hashtag_id_seq"`);
await queryRunner.query(`DROP SEQUENCE "__chart_day__hashtag_id_seq"`);
}
async down(queryRunner) {
await queryRunner.query(`CREATE TABLE public.__chart__hashtag ("id" SERIAL NOT NULL CONSTRAINT "PK_c32f1ea2b44a5d2f7881e37f8f9" PRIMARY KEY,"date" integer NOT NULL,"group" character varying(128) NOT NULL,"___local_users" integer DEFAULT 0 NOT NULL,"___remote_users" integer DEFAULT 0 NOT NULL,"unique_temp___local_users" character varying[] DEFAULT '{}'::character varying[] NOT NULL,"unique_temp___remote_users" character varying[] DEFAULT '{}'::character varying[] NOT NULL,CONSTRAINT "UQ_25a97c02003338124b2b75fdbc8" UNIQUE ("date", "group"))`);
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_25a97c02003338124b2b75fdbc" ON public.__chart__hashtag USING btree (date, "group")`);
await queryRunner.query(`CREATE TABLE public.__chart_day__hashtag ("id" SERIAL NOT NULL CONSTRAINT CONSTRAINT "PK_13d5a3b089344e5557f8e0980b4" PRIMARY KEY,"date" integer NOT NULL,"group" character varying(128) NOT NULL,"___local_users" integer DEFAULT 0 NOT NULL,"___remote_users" integer DEFAULT 0 NOT NULL,"unique_temp___local_users" character varying[] DEFAULT '{}'::character varying[] NOT NULL,"unique_temp___remote_users" character varying[] DEFAULT '{}'::character varying[] NOT NULL,CONSTRAINT "UQ_8f589cf056ff51f09d6096f6450" UNIQUE ("date", "group"))`);
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_8f589cf056ff51f09d6096f645" ON public.__chart_day__hashtag USING btree (date, "group")`);
}
}

View File

@ -1,6 +1,6 @@
import Bull from 'bull';
import { activeUsersChart, driveChart, federationChart, hashtagChart, instanceChart, notesChart, perUserDriveChart, perUserFollowingChart, perUserNotesChart, perUserReactionsChart, usersChart, apRequestChart } from '@/services/chart/index.js';
import { activeUsersChart, driveChart, federationChart, instanceChart, notesChart, perUserDriveChart, perUserFollowingChart, perUserNotesChart, perUserReactionsChart, usersChart, apRequestChart } from '@/services/chart/index.js';
import { queueLogger } from '@/queue/logger.js';
const logger = queueLogger.createSubLogger('clean-charts');
@ -17,7 +17,6 @@ export async function cleanCharts(job: Bull.Job<Record<string, unknown>>, done:
perUserNotesChart.clean(),
driveChart.clean(),
perUserReactionsChart.clean(),
hashtagChart.clean(),
perUserFollowingChart.clean(),
perUserDriveChart.clean(),
apRequestChart.clean(),

View File

@ -1,6 +1,6 @@
import Bull from 'bull';
import { activeUsersChart, driveChart, federationChart, hashtagChart, instanceChart, notesChart, perUserDriveChart, perUserFollowingChart, perUserNotesChart, perUserReactionsChart, usersChart, apRequestChart } from '@/services/chart/index.js';
import { activeUsersChart, driveChart, federationChart, instanceChart, notesChart, perUserDriveChart, perUserFollowingChart, perUserNotesChart, perUserReactionsChart, usersChart, apRequestChart } from '@/services/chart/index.js';
import { queueLogger } from '@/queue/logger.js';
const logger = queueLogger.createSubLogger('tick-charts');
@ -17,7 +17,6 @@ export async function tickCharts(job: Bull.Job<Record<string, unknown>>, done: a
perUserNotesChart.tick(false),
driveChart.tick(false),
perUserReactionsChart.tick(false),
hashtagChart.tick(false),
perUserFollowingChart.tick(false),
perUserDriveChart.tick(false),
apRequestChart.tick(false),

View File

@ -86,7 +86,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';
@ -381,7 +380,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],

View File

@ -1,28 +0,0 @@
import { getJsonSchema } from '@/services/chart/core.js';
import { hashtagChart } from '@/services/chart/index.js';
import define from '@/server/api/define.js';
export const meta = {
tags: ['charts', 'hashtags'],
res: getJsonSchema(hashtagChart.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
export default define(meta, paramDef, async (ps) => {
return await hashtagChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.tag);
});

View File

@ -1,29 +0,0 @@
import { User } from '@/models/entities/user.js';
import { Users } from '@/models/index.js';
import Chart, { KVs } from '../core.js';
import { name, schema } from './entities/hashtag.js';
/**
*
*/
// eslint-disable-next-line import/no-default-export
export default class HashtagChart extends Chart<typeof schema> {
constructor() {
super(name, schema, true);
}
protected async tickMajor(): Promise<Partial<KVs<typeof schema>>> {
return {};
}
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
return {};
}
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);
}
}

View File

@ -6,7 +6,6 @@ import { entity as InstanceChart } from './charts/entities/instance.js';
import { entity as PerUserNotesChart } from './charts/entities/per-user-notes.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';
@ -25,7 +24,6 @@ export const entities = [
PerUserNotesChart.hour, PerUserNotesChart.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,

View File

@ -9,7 +9,6 @@ import InstanceChart from './charts/instance.js';
import PerUserNotesChart from './charts/per-user-notes.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';
@ -22,7 +21,6 @@ export const instanceChart = new InstanceChart();
export const perUserNotesChart = new PerUserNotesChart();
export const driveChart = new DriveChart();
export const perUserReactionsChart = new PerUserReactionsChart();
export const hashtagChart = new HashtagChart();
export const perUserFollowingChart = new PerUserFollowingChart();
export const perUserDriveChart = new PerUserDriveChart();
export const apRequestChart = new ApRequestChart();
@ -36,7 +34,6 @@ const charts = [
perUserNotesChart,
driveChart,
perUserReactionsChart,
hashtagChart,
perUserFollowingChart,
perUserDriveChart,
apRequestChart,

View File

@ -1,6 +1,5 @@
import { User } from '@/models/entities/user.js';
import { Hashtags, Users } from '@/models/index.js';
import { hashtagChart } from '@/services/chart/index.js';
import { genId } from '@/misc/gen-id.js';
import { Hashtag } from '@/models/entities/hashtag.js';
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
@ -121,8 +120,4 @@ export async function updateHashtag(user: { id: User['id']; host: User['host'];
} as Hashtag);
}
}
if (!isUserAttached) {
hashtagChart.update(tag, user);
}
}

View File

@ -131,7 +131,6 @@ export type Endpoints = {
total: number[];
};
}; };
'charts/hashtag': { req: { span: 'day' | 'hour'; limit?: number; offset?: number | null; }; res: TODO; };
'charts/instance': { req: { span: 'day' | 'hour'; limit?: number; offset?: number | null; host: string; }; res: {
drive: {
decFiles: number[];