Skip to content

Commit

Permalink
feat(bookings): [PPT-1846] add all_day bool flag
Browse files Browse the repository at this point in the history
  • Loading branch information
naqvis committed Feb 18, 2025
1 parent 332b9c8 commit 74b5549
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- +micrate Up
-- SQL in section 'Up' is executed when this migration is applied

ALTER TABLE "bookings" ADD COLUMN IF NOT EXISTS all_day BOOL DEFAULT false;

-- +micrate Down
-- SQL section 'Down' is executed when this migration is rolled back
ALTER TABLE "bookings" DROP COLUMN IF EXISTS all_day;
6 changes: 4 additions & 2 deletions src/placeos-models/booking.cr
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module PlaceOS::Model
attribute user_id : String?
attribute user_email : PlaceOS::Model::Email, format: "email", converter: PlaceOS::Model::EmailConverter
attribute user_name : String
attribute zones : Array(String) = ->{ [] of String }
attribute zones : Array(String) = -> { [] of String }
# used to hold information relating to the state of the booking process
attribute process_state : String?
attribute last_changed : Int64?
Expand Down Expand Up @@ -129,6 +129,8 @@ module PlaceOS::Model

attribute recurrence_end : Int64? = nil, description: "an optional end date for booking recurrences"

attribute all_day : Bool = false

belongs_to Tenant, pk_type: Int64

has_many(
Expand Down Expand Up @@ -712,7 +714,7 @@ module PlaceOS::Model
parents : Array(Booking),
limit : Int32 = DEFAULT_LIMIT,
skip : Int32 = 0,
is_checked_out : Bool? = nil
is_checked_out : Bool? = nil,
) : ExpansionDetails
recurring = parents.select(&.recurring_booking?)
return ExpansionDetails.new(parents, 0, 0) if recurring.empty?
Expand Down

0 comments on commit 74b5549

Please sign in to comment.