FoundKey/packages/backend/src/server/api/endpoints/admin/relays/list.ts
2023-02-19 23:36:15 +01:00

52 lines
967 B
TypeScript

import { listRelay } from '@/services/relay.js';
import define from '@/server/api/define.js';
export const meta = {
tags: ['admin'],
requireCredential: true,
requireModerator: true,
res: {
type: 'array',
optional: false, nullable: false,
items: {
type: 'object',
optional: false, nullable: false,
properties: {
id: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
inbox: {
type: 'string',
optional: false, nullable: false,
format: 'url',
},
status: {
type: 'string',
optional: false, nullable: false,
default: 'requesting',
enum: [
'requesting',
'accepted',
'rejected',
],
},
},
},
},
} 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 () => {
return await listRelay();
});