a tool for shared writing and social publishing

wip poll record

+49
+2
lexicons/build.ts
··· 2 2 import { BlockLexicons } from "./src/blocks"; 3 3 import { PubLeafletDocument } from "./src/document"; 4 4 import * as PublicationLexicons from "./src/publication"; 5 + import * as PollLexicons from "./src/polls"; 5 6 import { ThemeLexicons } from "./src/theme"; 6 7 7 8 import * as fs from "fs"; ··· 24 25 ...ThemeLexicons, 25 26 ...BlockLexicons, 26 27 ...Object.values(PublicationLexicons), 28 + ...Object.values(PollLexicons), 27 29 ]; 28 30 29 31 // Write each lexicon to a file
+47
lexicons/src/polls/index.ts
··· 1 + import { LexiconDoc } from "@atproto/lexicon"; 2 + 3 + export const PubLeafletPollDefinition: LexiconDoc = { 4 + lexicon: 1, 5 + id: "pub.leaflet.poll.definition", 6 + defs: { 7 + main: { 8 + type: "record", 9 + key: "tid", 10 + description: "Record declaring a poll", 11 + record: { 12 + type: "object", 13 + required: ["name", "options"], 14 + properties: { 15 + options: { type: "array", items: { type: "ref", ref: "#option" } }, 16 + endDate: { type: "string", format: "datetime" }, 17 + }, 18 + }, 19 + }, 20 + option: { 21 + type: "object", 22 + properties: { 23 + text: { type: "string", maxLength: 500, maxGraphemes: 50 }, 24 + }, 25 + }, 26 + }, 27 + }; 28 + 29 + export const PubLeafletPollVote: LexiconDoc = { 30 + lexicon: 1, 31 + id: "pub.leaflet.poll.vote", 32 + defs: { 33 + main: { 34 + type: "record", 35 + key: "tid", 36 + description: "Record declaring a vote on a poll", 37 + record: { 38 + type: "object", 39 + required: ["poll"], 40 + properties: { 41 + poll: { type: "ref", ref: "com.atproto.repo.strongRef" }, 42 + option: { type: "string" }, 43 + }, 44 + }, 45 + }, 46 + }, 47 + };