bigbuffet-rw/packages/pl-api/lib/entities/chat.ts
marcin mikołajczak a521c9044d make pl-api compile
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-10-16 17:03:27 +02:00

18 lines
570 B
TypeScript

import * as v from 'valibot';
import { accountSchema } from './account';
import { chatMessageSchema } from './chat-message';
import { datetimeSchema } from './utils';
/** @see {@link https://docs.pleroma.social/backend/development/API/chats/#getting-a-list-of-chats} */
const chatSchema = v.object({
id: v.string(),
account: accountSchema,
unread: v.pipe(v.number(), v.integer()),
last_message: v.fallback(v.nullable(chatMessageSchema), null),
updated_at: datetimeSchema,
});
type Chat = v.InferOutput<typeof chatSchema>;
export { chatSchema, type Chat };