mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-11 03:43:08 +02:00
2470afaa2e
* wip * Update CHANGELOG.md * wip * wip * wip * Update create.ts * wip * wip * Update CHANGELOG.md * wip * wip * wip * wip * wip * wip * wip * Update CHANGELOG.md * wip * wip * Update delete.ts * Update delete.ts * wip * wip * wip * Update account-info.vue * wip * wip * Update settings.vue * Update user-info.vue * wip * Update show-file.ts * Update show-user.ts * wip * wip * Update delete.ts * wip * wip * Update overview.moderators.vue * Create 1673500412259-Role.js * wip * wip * Update roles.vue * 色 * Update roles.vue * integrate silence * wip * wip
38 lines
870 B
TypeScript
38 lines
870 B
TypeScript
import { Inject, Injectable } from '@nestjs/common';
|
|
import { DataSource } from 'typeorm';
|
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
|
import { DI } from '@/di-symbols.js';
|
|
|
|
export const meta = {
|
|
requireCredential: true,
|
|
requireAdmin: true,
|
|
|
|
tags: ['admin'],
|
|
} as const;
|
|
|
|
export const paramDef = {
|
|
type: 'object',
|
|
properties: {},
|
|
required: [],
|
|
} as const;
|
|
|
|
// eslint-disable-next-line import/no-default-export
|
|
@Injectable()
|
|
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|
constructor(
|
|
@Inject(DI.db)
|
|
private db: DataSource,
|
|
) {
|
|
super(meta, paramDef, async () => {
|
|
const stats = await this.db.query('SELECT * FROM pg_indexes;').then(recs => {
|
|
const res = [] as { tablename: string; indexname: string; }[];
|
|
for (const rec of recs) {
|
|
res.push(rec);
|
|
}
|
|
return res;
|
|
});
|
|
|
|
return stats;
|
|
});
|
|
}
|
|
}
|