iceshrimp-legacy/packages/backend/src/server/api/endpoints/admin/get-index-stats.ts
tamaina fcfb5ef0a3
Fix ajv (#8333)
* wip

* ✌️

* use ajv/dist/core

* revert try

* clean up
2022-02-20 13:15:40 +09:00

31 lines
627 B
TypeScript

import define from '../../define';
import { getConnection } from 'typeorm';
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
getConnection().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;
});