2024-05-14 09:00:05 +02:00
|
|
|
/**
|
|
|
|
|
* Reactions extension
|
|
|
|
|
* @module federation/schemas/extensions/reactions
|
|
|
|
|
* @see module:federation/schemas/base
|
2024-08-24 14:58:50 +02:00
|
|
|
* @see https://versia.pub/extensions/reactions
|
2024-05-14 09:00:05 +02:00
|
|
|
*/
|
|
|
|
|
import { z } from "zod";
|
2024-08-25 15:47:03 +02:00
|
|
|
import { EntitySchema } from "../base";
|
2024-05-14 09:00:05 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @description Reaction extension entity
|
2024-08-24 14:58:50 +02:00
|
|
|
* @see https://versia.pub/extensions/reactions
|
2024-05-14 09:00:05 +02:00
|
|
|
* @example
|
|
|
|
|
* {
|
2024-08-25 15:47:03 +02:00
|
|
|
* "id": "6f27bc77-58ee-4c9b-b804-8cc1c1182fa9",
|
|
|
|
|
* "type": "pub.versia:reactions/Reaction",
|
|
|
|
|
* "uri": "https://example.com/actions/6f27bc77-58ee-4c9b-b804-8cc1c1182fa9",
|
2024-05-14 09:00:05 +02:00
|
|
|
* "created_at": "2021-01-01T00:00:00.000Z",
|
2024-08-25 15:47:03 +02:00
|
|
|
* "author": "https://example.com/users/6e0204a2-746c-4972-8602-c4f37fc63bbe",
|
|
|
|
|
* "object": "https://example.com/publications/f08a124e-fe90-439e-8be4-15a428a72a19",
|
|
|
|
|
* "content": "😀",
|
2024-05-14 09:00:05 +02:00
|
|
|
* }
|
|
|
|
|
*/
|
2024-08-25 15:47:03 +02:00
|
|
|
export const ReactionSchema = EntitySchema.extend({
|
|
|
|
|
type: z.literal("pub.versia:reactions/Reaction"),
|
|
|
|
|
author: z.string().url(),
|
2024-05-14 09:00:05 +02:00
|
|
|
object: z.string().url(),
|
2024-08-25 15:47:03 +02:00
|
|
|
content: z.string().min(1).max(256),
|
2024-05-14 09:00:05 +02:00
|
|
|
});
|