Skip to content

Commit 1cf99a8

Browse files
committed
feat: add security_groups and any_match for triggers
1 parent 6da9181 commit 1cf99a8

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-- +micrate Up
2+
-- SQL in section 'Up' is executed when this migration is applied
3+
4+
ALTER TABLE "trigger" ADD COLUMN IF NOT EXISTS "any_match" boolean NOT NULL DEFAULT false;
5+
ALTER TABLE "alert" ADD COLUMN IF NOT EXISTS "any_match" boolean NOT NULL DEFAULT false;
6+
ALTER TABLE "sys" ADD COLUMN IF NOT EXISTS "security_groups" TEXT[] NOT NULL DEFAULT '{}';
7+
8+
-- +micrate Down
9+
-- SQL section 'Down' is executed when this migration is rolled back
10+
11+
ALTER TABLE "sys" DROP COLUMN IF EXISTS "security_groups";
12+
ALTER TABLE "alert" DROP COLUMN IF EXISTS "any_match";
13+
ALTER TABLE "trigger" DROP COLUMN IF EXISTS "any_match";

src/placeos-models/alert.cr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module PlaceOS::Model
2424
attribute name : String, es_subfield: "keyword"
2525
attribute description : String = ""
2626
attribute enabled : Bool = true, es_subfield: "keyword"
27+
attribute any_match : Bool = false, es_subfield: "keyword"
2728

2829
# Reuse the same conditions structure as Trigger
2930
attribute conditions : PlaceOS::Model::Trigger::Conditions = -> { PlaceOS::Model::Trigger::Conditions.new }, es_ignore: true

src/placeos-models/control_system.cr

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,16 @@ module PlaceOS::Model
3939
# Array of URLs to images for a system
4040
attribute images : Array(String) = -> { [] of String }
4141

42+
# Array of security group ids for room access
43+
attribute security_groups : Array(String) = -> { [] of String }
44+
4245
attribute timezone : Time::Location?, converter: Time::Location::Converter, es_type: "text"
4346

4447
# Provide fields for simplifying support
4548
attribute support_url : String = ""
46-
attribute timetable_url : String?
47-
attribute camera_snapshot_url : String?
48-
attribute camera_url : String?
49+
attribute timetable_url : String? # The timetable visualisation
50+
attribute camera_snapshot_url : String? # snapshot images of the room
51+
attribute camera_url : String? # admin control
4952

5053
# if not bookable via google / O365 calendaring systems
5154
attribute room_booking_url : String?

src/placeos-models/trigger.cr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ module PlaceOS::Model
2222
attribute important : Bool = false
2323

2424
attribute enable_webhook : Bool = false
25+
attribute any_match : Bool = false, es_subfield: "keyword"
2526

2627
METHODS = %w(GET POST PUT PATCH DELETE)
2728
attribute supported_methods : Array(String) = ["POST"]

0 commit comments

Comments
 (0)