iceshrimp-legacy/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts
syuilo 1c67c26bd8
refactor: migrate to typeorm 3.0 (#8443)
* wip

* wip

* wip

* Update following.ts

* wip

* wip

* wip

* Update resolve-user.ts

* maxQueryExecutionTime

* wip

* wip
2022-03-26 15:34:00 +09:00

29 lines
603 B
TypeScript

import define from '../../define.js';
import { db } from '@/db/postgre.js';
export const meta = {
requireCredential: true,
requireModerator: true,
tags: ['admin'],
} as const;
export const paramDef = {
type: 'object',
properties: {},
required: [],
} as const;
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async () => {
const stats = await 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;
});