diff --git a/shard.lock b/shard.lock index 8afd0831..d56fc1fe 100644 --- a/shard.lock +++ b/shard.lock @@ -31,7 +31,7 @@ shards: bindata: git: https://github.com/spider-gazelle/bindata.git - version: 1.9.1 + version: 1.10.0 clear: git: https://github.com/place-labs/clear.git @@ -47,7 +47,7 @@ shards: email: git: https://github.com/arcage/crystal-email.git - version: 0.6.3 + version: 0.6.4 faker: git: https://github.com/askn/faker.git @@ -91,12 +91,20 @@ shards: neuroplastic: git: https://github.com/spider-gazelle/neuroplastic.git - version: 1.10.0 + version: 1.11.0 office365: git: https://github.com/placeos/office365.git version: 1.14.0 + open_api: + git: https://github.com/elbywan/open_api.cr.git + version: 1.3.0 + + openapi-generator: + git: https://github.com/place-labs/openapi-generator.git + version: 2.1.0+git.commit.a65ffc2f7dcc6a393e7d1f9229650b520d9525be + openssl_ext: git: https://github.com/spider-gazelle/openssl_ext.git version: 2.1.5 @@ -119,7 +127,7 @@ shards: placeos-models: git: https://github.com/placeos/models.git - version: 6.2.0 + version: 6.3.0 promise: git: https://github.com/spider-gazelle/promise.git diff --git a/src/controllers/bookings.cr b/src/controllers/bookings.cr index 11ccd15d..c25e8c08 100644 --- a/src/controllers/bookings.cr +++ b/src/controllers/bookings.cr @@ -128,16 +128,20 @@ class Bookings < Application }) spawn do - get_placeos_client.root.signal("staff/guest/attending", { - action: :booking_created, - id: guest.id, - booking_id: booking.id, - resource_id: booking.asset_id, - title: booking.title, - booking_start: booking.booking_start, - attendee_name: attendee.name, - attendee_email: attendee.email, - }) + begin + get_placeos_client.root.signal("staff/guest/attending", { + action: :booking_created, + id: guest.id, + booking_id: booking.id, + resource_id: booking.asset_id, + title: booking.title, + booking_start: booking.booking_start, + attendee_name: attendee.name, + attendee_email: attendee.email, + }) + rescue error + Log.warn(exception: error) { "failed to signal guest attendance" } + end end end end @@ -302,16 +306,20 @@ class Bookings < Application if !previously_visiting spawn do - get_placeos_client.root.signal("staff/guest/attending", { - action: :booking_updated, - id: guest.id, - booking_id: existing_booking.id, - resource_id: existing_booking.asset_id, - title: existing_booking.title, - booking_start: existing_booking.booking_start, - attendee_name: attendee.name, - attendee_email: attendee.email, - }) + begin + get_placeos_client.root.signal("staff/guest/attending", { + action: :booking_updated, + id: guest.id, + booking_id: existing_booking.id, + resource_id: existing_booking.asset_id, + title: existing_booking.title, + booking_start: existing_booking.booking_start, + attendee_name: attendee.name, + attendee_email: attendee.email, + }) + rescue error + Log.warn(exception: error) { "failed to signal guest attendance" } + end end end end diff --git a/src/controllers/events.cr b/src/controllers/events.cr index a55eea51..d5a1df49 100644 --- a/src/controllers/events.cr +++ b/src/controllers/events.cr @@ -131,14 +131,18 @@ class Events < Application }) spawn do - placeos_client.root.signal("staff/event/changed", { - action: :create, - system_id: input_event.system_id, - event_id: created_event.id, - host: host, - resource: sys.email, - ext_data: input_event.extension_data, - }) + begin + placeos_client.root.signal("staff/event/changed", { + action: :create, + system_id: input_event.system_id, + event_id: created_event.id, + host: host, + resource: sys.email, + ext_data: input_event.extension_data, + }) + rescue error + Log.warn(exception: error) { "failed to signal event creation" } + end end # Save custom data @@ -197,17 +201,21 @@ class Events < Application }) spawn do - placeos_client.root.signal("staff/guest/attending", { - action: :meeting_created, - system_id: sys.id, - event_id: created_event.id, - host: host, - resource: sys.email, - event_summary: created_event.body, - event_starting: created_event.event_start.not_nil!.to_unix, - attendee_name: attendee.name, - attendee_email: attendee.email, - }) + begin + placeos_client.root.signal("staff/guest/attending", { + action: :meeting_created, + system_id: sys.id, + event_id: created_event.id, + host: host, + resource: sys.email, + event_summary: created_event.body, + event_starting: created_event.event_start.not_nil!.to_unix, + attendee_name: attendee.name, + attendee_email: attendee.email, + }) + rescue error + Log.warn(exception: error) { "failed to signal guest attendance" } + end end end end @@ -453,7 +461,33 @@ class Events < Application if !previously_visiting || changing_room spawn do + begin + sys = system.not_nil! + + placeos_client.root.signal("staff/guest/attending", { + action: :meeting_update, + system_id: sys.id, + event_id: event_id, + host: host, + resource: sys.email, + event_summary: updated_event.not_nil!.body, + event_starting: updated_event.not_nil!.event_start.not_nil!.to_unix, + attendee_name: attendee.name, + attendee_email: attendee.email, + }) + rescue error + Log.warn(exception: error) { "failed to signal guest attendance" } + end + end + end + end + elsif changing_room + existing.each do |attend| + next unless attend.visit_expected + spawn do + begin sys = system.not_nil! + guest = attend.guest placeos_client.root.signal("staff/guest/attending", { action: :meeting_update, @@ -463,32 +497,14 @@ class Events < Application resource: sys.email, event_summary: updated_event.not_nil!.body, event_starting: updated_event.not_nil!.event_start.not_nil!.to_unix, - attendee_name: attendee.name, - attendee_email: attendee.email, + attendee_name: guest.name, + attendee_email: guest.email, }) + rescue error + Log.warn(exception: error) { "failed to signal guest attendance" } end end end - elsif changing_room - existing.each do |attend| - next unless attend.visit_expected - spawn do - sys = system.not_nil! - guest = attend.guest - - placeos_client.root.signal("staff/guest/attending", { - action: :meeting_update, - system_id: sys.id, - event_id: event_id, - host: host, - resource: sys.email, - event_summary: updated_event.not_nil!.body, - event_starting: updated_event.not_nil!.event_start.not_nil!.to_unix, - attendee_name: guest.name, - attendee_email: guest.email, - }) - end - end end end @@ -497,15 +513,19 @@ class Events < Application # Update PlaceOS with an signal "staff/event/changed" spawn do - sys = system.not_nil! - placeos_client.root.signal("staff/event/changed", { - action: :update, - system_id: sys.id, - event_id: event_id, - host: host, - resource: sys.email, - ext_data: eventmeta.try &.ext_data, - }) + begin + sys = system.not_nil! + placeos_client.root.signal("staff/event/changed", { + action: :update, + system_id: sys.id, + event_id: event_id, + host: host, + resource: sys.email, + ext_data: eventmeta.try &.ext_data, + }) + rescue error + Log.warn(exception: error) { "failed to signal event update" } + end end render json: StaffApi::Event.augment(updated_event.not_nil!, system.not_nil!.email, system, eventmeta) @@ -636,12 +656,16 @@ class Events < Application EventMetadata.query.by_tenant(tenant.id).where({event_id: event_id}).delete_all spawn do - placeos_client.root.signal("staff/event/changed", { - action: :cancelled, - system_id: system.not_nil!.id, - event_id: event_id, - resource: system.not_nil!.email, - }) + begin + placeos_client.root.signal("staff/event/changed", { + action: :cancelled, + system_id: system.not_nil!.id, + event_id: event_id, + resource: system.not_nil!.email, + }) + rescue error + Log.warn(exception: error) { "failed to signal event deletion" } + end end end @@ -797,19 +821,23 @@ class Events < Application # Update PlaceOS with an signal "staff/guest/checkin" spawn do - get_placeos_client.root.signal("staff/guest/checkin", { - action: :checkin, - checkin: checkin, - system_id: system_id, - event_id: event_id, - host: event.host, - resource: eventmeta.resource_calendar, - event_summary: event.not_nil!.body, - event_starting: eventmeta.event_start, - attendee_name: guest.name, - attendee_email: guest.email, - ext_data: eventmeta.ext_data, - }) + begin + get_placeos_client.root.signal("staff/guest/checkin", { + action: :checkin, + checkin: checkin, + system_id: system_id, + event_id: event_id, + host: event.host, + resource: eventmeta.resource_calendar, + event_summary: event.not_nil!.body, + event_starting: eventmeta.event_start, + attendee_name: guest.name, + attendee_email: guest.email, + ext_data: eventmeta.ext_data, + }) + rescue error + Log.warn(exception: error) { "failed to signal guest checkin" } + end end render json: attending_guest(attendee, attendee.guest)