site HelloWorld
origin: model.dbquity.com/examples
version: 1.0.0
description:
"Hello World", says Dbquity.
Illustrating site, class, invariant, area, and multiline.
class Period
description:
This Period class comprises the Start, Days and End fields to
capture an interval of a certain number of days starting and ending
at certain dates.
It uses the invariant property to declare the formula that ties
together these three fields.
date Start # initializes to today() by default
integer Days
date End
# when a user changes one value, Dbquity seeks to update another as
# needed to satisfy the invariant
invariant:
Start + Days = End and Start <= End
area Welcome
Period Meeting
text Greeting
multiline
placeholder:
"type a few kind words here, please
(you may use emojiis 👌)"
site ShoppingList
origin: model.dbquity.com/examples
version: 1.0.0
area Setup
importance: additional
entity Unit
collection: Units
text Name
importance: promoted
identity: Name
text Description
multiline
decimal DefaultAmount
entity Item
collection: Items
text Name
importance: promoted
identity: Name
text Description
multiline
decimal DefaultAmount
default: DefaultUnit.DefaultAmount
link DefaultUnit
entity: Unit
area Shopping
entity List
importance: promoted
collection: Lists
decimal Progress
percent
expression:
if (n: (tobuy: List@ToBuy).count()) then
(100 * tobuy.count(Fulfillment >= Amount) / n)
association ToBuy
end List
end Item
multiplicity: 1..*
decimal Amount
default: Item.DefaultAmount
link Unit
default: Item.DefaultUnit
decimal Fulfillment
These notes explain the idea of behavior and steps using the RollDice example.
Moderated Chat
site ModeratedChat
origin: model.dbquity.com/examples
version: 1.0.0
profiles: Moderator
area Chat
permissions:
view|create by *
update|delete by self.createdby as *
delete by Moderator
entity Message
collection: Messages
text Text
text By
expression: createdby
text Saved
expression: lastsaved
ModeratedChat illustrates the use of a Moderator profile and the permissions property to allow
any user, *, to view and create text messages
as well as update and delete messages created by themselves, and
users with the Moderator profile to further delete any message regardless of who created them