From 5c66a7b5f89084bd2bf334a259d77e9b055adbf8 Mon Sep 17 00:00:00 2001 From: Chetan Padia Date: Wed, 27 Dec 2023 20:02:36 +0000 Subject: [PATCH] allow history to be written to DB --- database/rules.bolt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/database/rules.bolt b/database/rules.bolt index 8dfe254..3b514f5 100644 --- a/database/rules.bolt +++ b/database/rules.bolt @@ -6,6 +6,10 @@ path /canvas/the-one-and-only/canvas { write() { true } } +path /canvas/the-one-and-only/history/{id} { + write() { createOnly(this) } +} + type Canvas { depth: Integer; canvas: Square>>>>>>; @@ -42,3 +46,9 @@ type ColorHistoryItem extends HistoryItem {} type CurrentTimestamp extends Number { validate() { this == now } } + +// Helper functions + +createOnly(value) { + prior(value) == null && value != null +} \ No newline at end of file