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

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 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'; import { queueLogger } from '@/queue/logger.js';
const logger = queueLogger.createSubLogger('clean-charts'); const logger = queueLogger.createSubLogger('clean-charts');
@ -17,7 +17,6 @@ export async function cleanCharts(job: Bull.Job<Record<string, unknown>>, done:
perUserNotesChart.clean(), perUserNotesChart.clean(),
driveChart.clean(), driveChart.clean(),
perUserReactionsChart.clean(), perUserReactionsChart.clean(),
hashtagChart.clean(),
perUserFollowingChart.clean(), perUserFollowingChart.clean(),
perUserDriveChart.clean(), perUserDriveChart.clean(),
apRequestChart.clean(), apRequestChart.clean(),

View file

@ -1,6 +1,6 @@
import Bull from 'bull'; 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'; import { queueLogger } from '@/queue/logger.js';
const logger = queueLogger.createSubLogger('tick-charts'); 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), perUserNotesChart.tick(false),
driveChart.tick(false), driveChart.tick(false),
perUserReactionsChart.tick(false), perUserReactionsChart.tick(false),
hashtagChart.tick(false),
perUserFollowingChart.tick(false), perUserFollowingChart.tick(false),
perUserDriveChart.tick(false), perUserDriveChart.tick(false),
apRequestChart.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_apRequest from './endpoints/charts/ap-request.js';
import * as ep___charts_drive from './endpoints/charts/drive.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_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_instance from './endpoints/charts/instance.js';
import * as ep___charts_notes from './endpoints/charts/notes.js'; import * as ep___charts_notes from './endpoints/charts/notes.js';
import * as ep___charts_user_drive from './endpoints/charts/user/drive.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/ap-request', ep___charts_apRequest],
['charts/drive', ep___charts_drive], ['charts/drive', ep___charts_drive],
['charts/federation', ep___charts_federation], ['charts/federation', ep___charts_federation],
['charts/hashtag', ep___charts_hashtag],
['charts/instance', ep___charts_instance], ['charts/instance', ep___charts_instance],
['charts/notes', ep___charts_notes], ['charts/notes', ep___charts_notes],
['charts/user/drive', ep___charts_user_drive], ['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 PerUserNotesChart } from './charts/entities/per-user-notes.js';
import { entity as DriveChart } from './charts/entities/drive.js'; import { entity as DriveChart } from './charts/entities/drive.js';
import { entity as PerUserReactionsChart } from './charts/entities/per-user-reactions.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 PerUserFollowingChart } from './charts/entities/per-user-following.js';
import { entity as PerUserDriveChart } from './charts/entities/per-user-drive.js'; import { entity as PerUserDriveChart } from './charts/entities/per-user-drive.js';
import { entity as ApRequestChart } from './charts/entities/ap-request.js'; import { entity as ApRequestChart } from './charts/entities/ap-request.js';
@ -25,7 +24,6 @@ export const entities = [
PerUserNotesChart.hour, PerUserNotesChart.day, PerUserNotesChart.hour, PerUserNotesChart.day,
DriveChart.hour, DriveChart.day, DriveChart.hour, DriveChart.day,
PerUserReactionsChart.hour, PerUserReactionsChart.day, PerUserReactionsChart.hour, PerUserReactionsChart.day,
HashtagChart.hour, HashtagChart.day,
PerUserFollowingChart.hour, PerUserFollowingChart.day, PerUserFollowingChart.hour, PerUserFollowingChart.day,
PerUserDriveChart.hour, PerUserDriveChart.day, PerUserDriveChart.hour, PerUserDriveChart.day,
ApRequestChart.hour, ApRequestChart.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 PerUserNotesChart from './charts/per-user-notes.js';
import DriveChart from './charts/drive.js'; import DriveChart from './charts/drive.js';
import PerUserReactionsChart from './charts/per-user-reactions.js'; import PerUserReactionsChart from './charts/per-user-reactions.js';
import HashtagChart from './charts/hashtag.js';
import PerUserFollowingChart from './charts/per-user-following.js'; import PerUserFollowingChart from './charts/per-user-following.js';
import PerUserDriveChart from './charts/per-user-drive.js'; import PerUserDriveChart from './charts/per-user-drive.js';
import ApRequestChart from './charts/ap-request.js'; import ApRequestChart from './charts/ap-request.js';
@ -22,7 +21,6 @@ export const instanceChart = new InstanceChart();
export const perUserNotesChart = new PerUserNotesChart(); export const perUserNotesChart = new PerUserNotesChart();
export const driveChart = new DriveChart(); export const driveChart = new DriveChart();
export const perUserReactionsChart = new PerUserReactionsChart(); export const perUserReactionsChart = new PerUserReactionsChart();
export const hashtagChart = new HashtagChart();
export const perUserFollowingChart = new PerUserFollowingChart(); export const perUserFollowingChart = new PerUserFollowingChart();
export const perUserDriveChart = new PerUserDriveChart(); export const perUserDriveChart = new PerUserDriveChart();
export const apRequestChart = new ApRequestChart(); export const apRequestChart = new ApRequestChart();
@ -36,7 +34,6 @@ const charts = [
perUserNotesChart, perUserNotesChart,
driveChart, driveChart,
perUserReactionsChart, perUserReactionsChart,
hashtagChart,
perUserFollowingChart, perUserFollowingChart,
perUserDriveChart, perUserDriveChart,
apRequestChart, apRequestChart,

View file

@ -1,6 +1,5 @@
import { User } from '@/models/entities/user.js'; import { User } from '@/models/entities/user.js';
import { Hashtags, Users } from '@/models/index.js'; import { Hashtags, Users } from '@/models/index.js';
import { hashtagChart } from '@/services/chart/index.js';
import { genId } from '@/misc/gen-id.js'; import { genId } from '@/misc/gen-id.js';
import { Hashtag } from '@/models/entities/hashtag.js'; import { Hashtag } from '@/models/entities/hashtag.js';
import { normalizeForSearch } from '@/misc/normalize-for-search.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); } as Hashtag);
} }
} }
if (!isUserAttached) {
hashtagChart.update(tag, user);
}
} }

View file

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