なんかもうめっちゃ変えた

This commit is contained in:
syuilo
2022-09-18 03:27:08 +09:00
committed by GitHub
parent d9ab03f086
commit b75184ec8e
946 changed files with 41219 additions and 28839 deletions

View File

@@ -1,11 +1,13 @@
import { getJsonSchema } from '@/services/chart/core.js';
import { activeUsersChart } from '@/services/chart/index.js';
import define from '../../define.js';
import { Inject, Injectable } from '@nestjs/common';
import { getJsonSchema } from '@/core/chart/core.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
import ActiveUsersChart from '@/core/chart/charts/active-users.js';
import { schema } from '@/core/chart/charts/entities/active-users.js';
export const meta = {
tags: ['charts', 'users'],
res: getJsonSchema(activeUsersChart.schema),
res: getJsonSchema(schema),
allowGet: true,
cacheSec: 60 * 60,
@@ -22,6 +24,13 @@ export const paramDef = {
} as const;
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps) => {
return await activeUsersChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null);
});
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> {
constructor(
private activeUsersChart: ActiveUsersChart,
) {
super(meta, paramDef, async (ps, me) => {
return await this.activeUsersChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null);
});
}
}

View File

@@ -1,11 +1,13 @@
import { getJsonSchema } from '@/services/chart/core.js';
import { apRequestChart } from '@/services/chart/index.js';
import define from '../../define.js';
import { Inject, Injectable } from '@nestjs/common';
import { getJsonSchema } from '@/core/chart/core.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
import ApRequestChart from '@/core/chart/charts/ap-request.js';
import { schema } from '@/core/chart/charts/entities/ap-request.js';
export const meta = {
tags: ['charts'],
res: getJsonSchema(apRequestChart.schema),
res: getJsonSchema(schema),
allowGet: true,
cacheSec: 60 * 60,
@@ -22,6 +24,13 @@ export const paramDef = {
} as const;
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps) => {
return await apRequestChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null);
});
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> {
constructor(
private apRequestChart: ApRequestChart,
) {
super(meta, paramDef, async (ps, me) => {
return await this.apRequestChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null);
});
}
}

View File

@@ -1,11 +1,13 @@
import { getJsonSchema } from '@/services/chart/core.js';
import { driveChart } from '@/services/chart/index.js';
import define from '../../define.js';
import { Inject, Injectable } from '@nestjs/common';
import { getJsonSchema } from '@/core/chart/core.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
import DriveChart from '@/core/chart/charts/drive.js';
import { schema } from '@/core/chart/charts/entities/drive.js';
export const meta = {
tags: ['charts', 'drive'],
res: getJsonSchema(driveChart.schema),
res: getJsonSchema(schema),
allowGet: true,
cacheSec: 60 * 60,
@@ -22,6 +24,13 @@ export const paramDef = {
} as const;
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps) => {
return await driveChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null);
});
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> {
constructor(
private driveChart: DriveChart,
) {
super(meta, paramDef, async (ps, me) => {
return await this.driveChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null);
});
}
}

View File

@@ -1,11 +1,13 @@
import { getJsonSchema } from '@/services/chart/core.js';
import { federationChart } from '@/services/chart/index.js';
import define from '../../define.js';
import { Inject, Injectable } from '@nestjs/common';
import { getJsonSchema } from '@/core/chart/core.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
import FederationChart from '@/core/chart/charts/federation.js';
import { schema } from '@/core/chart/charts/entities/federation.js';
export const meta = {
tags: ['charts'],
res: getJsonSchema(federationChart.schema),
res: getJsonSchema(schema),
allowGet: true,
cacheSec: 60 * 60,
@@ -22,6 +24,13 @@ export const paramDef = {
} as const;
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps) => {
return await federationChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null);
});
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> {
constructor(
private federationChart: FederationChart,
) {
super(meta, paramDef, async (ps, me) => {
return await this.federationChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null);
});
}
}

View File

@@ -1,11 +1,13 @@
import { getJsonSchema } from '@/services/chart/core.js';
import { hashtagChart } from '@/services/chart/index.js';
import define from '../../define.js';
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(hashtagChart.schema),
res: getJsonSchema(schema),
allowGet: true,
cacheSec: 60 * 60,
@@ -23,6 +25,13 @@ export const paramDef = {
} 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);
});
@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);
});
}
}

View File

@@ -1,11 +1,13 @@
import { getJsonSchema } from '@/services/chart/core.js';
import { instanceChart } from '@/services/chart/index.js';
import define from '../../define.js';
import { Inject, Injectable } from '@nestjs/common';
import { getJsonSchema } from '@/core/chart/core.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
import InstanceChart from '@/core/chart/charts/instance.js';
import { schema } from '@/core/chart/charts/entities/instance.js';
export const meta = {
tags: ['charts'],
res: getJsonSchema(instanceChart.schema),
res: getJsonSchema(schema),
allowGet: true,
cacheSec: 60 * 60,
@@ -23,6 +25,13 @@ export const paramDef = {
} as const;
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps) => {
return await instanceChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.host);
});
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> {
constructor(
private instanceChart: InstanceChart,
) {
super(meta, paramDef, async (ps, me) => {
return await this.instanceChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.host);
});
}
}

View File

@@ -1,11 +1,13 @@
import { getJsonSchema } from '@/services/chart/core.js';
import { notesChart } from '@/services/chart/index.js';
import define from '../../define.js';
import { Inject, Injectable } from '@nestjs/common';
import { getJsonSchema } from '@/core/chart/core.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
import NotesChart from '@/core/chart/charts/notes.js';
import { schema } from '@/core/chart/charts/entities/notes.js';
export const meta = {
tags: ['charts', 'notes'],
res: getJsonSchema(notesChart.schema),
res: getJsonSchema(schema),
allowGet: true,
cacheSec: 60 * 60,
@@ -22,6 +24,13 @@ export const paramDef = {
} as const;
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps) => {
return await notesChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null);
});
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> {
constructor(
private notesChart: NotesChart,
) {
super(meta, paramDef, async (ps, me) => {
return await this.notesChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null);
});
}
}

View File

@@ -1,11 +1,13 @@
import { getJsonSchema } from '@/services/chart/core.js';
import { perUserDriveChart } from '@/services/chart/index.js';
import define from '../../../define.js';
import { Inject, Injectable } from '@nestjs/common';
import { getJsonSchema } from '@/core/chart/core.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
import PerUserDriveChart from '@/core/chart/charts/per-user-drive.js';
import { schema } from '@/core/chart/charts/entities/per-user-drive.js';
export const meta = {
tags: ['charts', 'drive', 'users'],
res: getJsonSchema(perUserDriveChart.schema),
res: getJsonSchema(schema),
allowGet: true,
cacheSec: 60 * 60,
@@ -23,6 +25,13 @@ export const paramDef = {
} as const;
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps) => {
return await perUserDriveChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.userId);
});
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> {
constructor(
private perUserDriveChart: PerUserDriveChart,
) {
super(meta, paramDef, async (ps, me) => {
return await this.perUserDriveChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.userId);
});
}
}

View File

@@ -1,11 +1,13 @@
import define from '../../../define.js';
import { getJsonSchema } from '@/services/chart/core.js';
import { perUserFollowingChart } from '@/services/chart/index.js';
import { Inject, Injectable } from '@nestjs/common';
import { Endpoint } from '@/server/api/endpoint-base.js';
import { getJsonSchema } from '@/core/chart/core.js';
import PerUserFollowingChart from '@/core/chart/charts/per-user-following.js';
import { schema } from '@/core/chart/charts/entities/per-user-following.js';
export const meta = {
tags: ['charts', 'users', 'following'],
res: getJsonSchema(perUserFollowingChart.schema),
res: getJsonSchema(schema),
allowGet: true,
cacheSec: 60 * 60,
@@ -23,6 +25,13 @@ export const paramDef = {
} as const;
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps) => {
return await perUserFollowingChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.userId);
});
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> {
constructor(
private perUserFollowingChart: PerUserFollowingChart,
) {
super(meta, paramDef, async (ps, me) => {
return await this.perUserFollowingChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.userId);
});
}
}

View File

@@ -1,11 +1,13 @@
import { getJsonSchema } from '@/services/chart/core.js';
import { perUserNotesChart } from '@/services/chart/index.js';
import define from '../../../define.js';
import { Inject, Injectable } from '@nestjs/common';
import { getJsonSchema } from '@/core/chart/core.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
import PerUserNotesChart from '@/core/chart/charts/per-user-notes.js';
import { schema } from '@/core/chart/charts/entities/per-user-notes.js';
export const meta = {
tags: ['charts', 'users', 'notes'],
res: getJsonSchema(perUserNotesChart.schema),
res: getJsonSchema(schema),
allowGet: true,
cacheSec: 60 * 60,
@@ -23,6 +25,13 @@ export const paramDef = {
} as const;
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps) => {
return await perUserNotesChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.userId);
});
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> {
constructor(
private perUserNotesChart: PerUserNotesChart,
) {
super(meta, paramDef, async (ps, me) => {
return await this.perUserNotesChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.userId);
});
}
}

View File

@@ -1,11 +1,13 @@
import { getJsonSchema } from '@/services/chart/core.js';
import { perUserReactionsChart } from '@/services/chart/index.js';
import define from '../../../define.js';
import { Inject, Injectable } from '@nestjs/common';
import { getJsonSchema } from '@/core/chart/core.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
import PerUserReactionsChart from '@/core/chart/charts/per-user-reactions.js';
import { schema } from '@/core/chart/charts/entities/per-user-reactions.js';
export const meta = {
tags: ['charts', 'users', 'reactions'],
res: getJsonSchema(perUserReactionsChart.schema),
res: getJsonSchema(schema),
allowGet: true,
cacheSec: 60 * 60,
@@ -23,6 +25,13 @@ export const paramDef = {
} as const;
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps) => {
return await perUserReactionsChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.userId);
});
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> {
constructor(
private perUserReactionsChart: PerUserReactionsChart,
) {
super(meta, paramDef, async (ps, me) => {
return await this.perUserReactionsChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null, ps.userId);
});
}
}

View File

@@ -1,11 +1,13 @@
import { getJsonSchema } from '@/services/chart/core.js';
import { usersChart } from '@/services/chart/index.js';
import define from '../../define.js';
import { Inject, Injectable } from '@nestjs/common';
import { getJsonSchema } from '@/core/chart/core.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
import UsersChart from '@/core/chart/charts/users.js';
import { schema } from '@/core/chart/charts/entities/users.js';
export const meta = {
tags: ['charts', 'users'],
res: getJsonSchema(usersChart.schema),
res: getJsonSchema(schema),
allowGet: true,
cacheSec: 60 * 60,
@@ -22,6 +24,13 @@ export const paramDef = {
} as const;
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps) => {
return await usersChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null);
});
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> {
constructor(
private usersChart: UsersChart,
) {
super(meta, paramDef, async (ps, me) => {
return await this.usersChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null);
});
}
}