2024-08-28 04:43:23 -07:00
|
|
|
import pick from 'lodash.pick';
|
2024-10-13 15:25:30 -07:00
|
|
|
import * as v from 'valibot';
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
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'),
|
2024-10-14 15:07:22 -07:00
|
|
|
}), v.object({
|
|
|
|
...announcementSchema.entries,
|
2024-10-13 15:25:30 -07:00
|
|
|
raw_content: v.fallback(v.string(), ''),
|
2024-08-28 04:43:23 -07:00
|
|
|
}));
|
|
|
|
|
2024-10-13 15:25:30 -07:00
|
|
|
type AdminAnnouncement = v.InferOutput<typeof adminAnnouncementSchema>;
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
export { adminAnnouncementSchema, type AdminAnnouncement };
|