summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/admin/get-index-stats.ts
blob: f2b06d0ef2fa2808ac2f05875a2596ee6a3eed56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import define from '../../define';
import { getConnection } from 'typeorm';

export const meta = {
	requireCredential: true as const,
	requireModerator: true,

	tags: ['admin'],

	params: {
	},
};

export default define(meta, 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;
});