diff --git a/packages/backend/src/server/api/endpoints/antennas/delete.ts b/packages/backend/src/server/api/endpoints/antennas/delete.ts index 5da7a2cb6..9204867dc 100644 --- a/packages/backend/src/server/api/endpoints/antennas/delete.ts +++ b/packages/backend/src/server/api/endpoints/antennas/delete.ts @@ -5,47 +5,24 @@ import { GlobalEventService } from '@/core/GlobalEventService.js'; import { DI } from '@/di-symbols.js'; import { ApiError } from '../../error.js'; -export const meta = { - tags: ['antennas'], - - requireCredential: true, - - kind: 'write:account', - - errors: { - noSuchAntenna: { - message: 'No such antenna.', - code: 'NO_SUCH_ANTENNA', - id: 'b34dcf9d-348f-44bb-99d0-6c9314cfe2df', - }, - }, -} as const; - -export const paramDef = { - type: 'object', - properties: { - antennaId: { type: 'string', format: 'misskey:id' }, - }, - required: ['antennaId'], -} as const; - // eslint-disable-next-line import/no-default-export @Injectable() -export default class extends Endpoint { +export default class extends Endpoint<'antennas/delete'> { + name = 'antennas/delete' as const; constructor( @Inject(DI.antennasRepository) private antennasRepository: AntennasRepository, private globalEventService: GlobalEventService, ) { - super(meta, paramDef, async (ps, me) => { + super(async (ps, me) => { const antenna = await this.antennasRepository.findOneBy({ id: ps.antennaId, userId: me.id, }); if (antenna == null) { - throw new ApiError(meta.errors.noSuchAntenna); + throw new ApiError(this.meta.errors.noSuchAntenna); } await this.antennasRepository.delete(antenna.id); diff --git a/packages/misskey-js/src/endpoints.ts b/packages/misskey-js/src/endpoints.ts index eb43830bf..48b557605 100644 --- a/packages/misskey-js/src/endpoints.ts +++ b/packages/misskey-js/src/endpoints.ts @@ -2035,6 +2035,32 @@ export const endpoints = { } }], }, + 'antennas/delete': { + tags: ['antennas'], + + requireCredential: true, + + kind: 'write:account', + + errors: { + noSuchAntenna: { + message: 'No such antenna.', + code: 'NO_SUCH_ANTENNA', + id: 'b34dcf9d-348f-44bb-99d0-6c9314cfe2df', + }, + }, + + defines: [{ + req: { + type: 'object', + properties: { + antennaId: { type: 'string', format: 'misskey:id' }, + }, + required: ['antennaId'], + }, + res: undefined, + }], + } //#endregion } as const satisfies { [x: string]: IEndpointMeta; };