bigbuffet-rw/packages/pl-api/lib/entities/admin/announcement.ts
marcin mikołajczak d91b55d9b1 cleanup
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-08-29 22:48:58 +02:00

16 lines
571 B
TypeScript

import pick from 'lodash.pick';
import { z } from 'zod';
import { announcementSchema } from '../announcement';
/** @see {@link https://docs.pleroma.social/backend/development/API/admin_api/#get-apiv1pleromaadminannouncements} */
const adminAnnouncementSchema = z.preprocess((announcement: any) => ({
...announcement,
...pick(announcement.pleroma, 'raw_content'),
}), announcementSchema.extend({
raw_content: z.string().catch(''),
}));
type AdminAnnouncement = z.infer<typeof adminAnnouncementSchema>;
export { adminAnnouncementSchema, type AdminAnnouncement };