2024-08-28 04:43:23 -07:00
|
|
|
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(''),
|
|
|
|
}));
|
|
|
|
|
2024-08-29 13:48:58 -07:00
|
|
|
type AdminAnnouncement = z.infer<typeof adminAnnouncementSchema>;
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
export { adminAnnouncementSchema, type AdminAnnouncement };
|