Skip to content

Commit

Permalink
database rules for saving history
Browse files Browse the repository at this point in the history
  • Loading branch information
chetbox committed Dec 27, 2023
1 parent 0bdf834 commit 899473d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion database/rules.bolt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ path /canvas/the-one-and-only/canvas {

type Canvas {
depth: Integer;
canvas: Square<Square<Square<Square<Square<Square<Square<Color>>>>>>>
canvas: Square<Square<Square<Square<Square<Square<Square<Color>>>>>>>;
history: ColorHistoryItem[];

validate() { this.depth == 7 }
}
Expand All @@ -28,3 +29,16 @@ type Color extends Integer {
type Integer extends Number {
validate() { (this + '').test(/^-?\d+$/) }
}

type HistoryItem<T> {
value: T;
x: Integer;
y: Integer;
timestamp: CurrentTimestamp;
}

type ColorHistoryItem extends HistoryItem<Color> {}

type CurrentTimestamp extends Number {
validate() { this == now }
}

0 comments on commit 899473d

Please sign in to comment.