mirror of
https://github.com/paricafe/misskey.git
synced 2025-01-11 03:10:50 -06:00
1c67c26bd8
* wip * wip * wip * Update following.ts * wip * wip * wip * Update resolve-user.ts * maxQueryExecutionTime * wip * wip
35 lines
858 B
TypeScript
35 lines
858 B
TypeScript
import define from '../../../define.js';
|
|
import { Announcements } from '@/models/index.js';
|
|
import { ApiError } from '../../../error.js';
|
|
|
|
export const meta = {
|
|
tags: ['admin'],
|
|
|
|
requireCredential: true,
|
|
requireModerator: true,
|
|
|
|
errors: {
|
|
noSuchAnnouncement: {
|
|
message: 'No such announcement.',
|
|
code: 'NO_SUCH_ANNOUNCEMENT',
|
|
id: 'ecad8040-a276-4e85-bda9-015a708d291e',
|
|
},
|
|
},
|
|
} as const;
|
|
|
|
export const paramDef = {
|
|
type: 'object',
|
|
properties: {
|
|
id: { type: 'string', format: 'misskey:id' },
|
|
},
|
|
required: ['id'],
|
|
} as const;
|
|
|
|
// eslint-disable-next-line import/no-default-export
|
|
export default define(meta, paramDef, async (ps, me) => {
|
|
const announcement = await Announcements.findOneBy({ id: ps.id });
|
|
|
|
if (announcement == null) throw new ApiError(meta.errors.noSuchAnnouncement);
|
|
|
|
await Announcements.delete(announcement.id);
|
|
});
|