Skip to content

Commit

Permalink
fix(availability): PPT-1629 return 404 when tenant not found (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
naqvis authored Dec 2, 2024
1 parent 09628eb commit 44dcd56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ shards:

debug:
git: https://github.com/sija/debug.cr.git
version: 2.0.3
version: 2.0.4

defined:
git: https://github.com/wyhaines/defined.cr.git
Expand Down Expand Up @@ -183,7 +183,7 @@ shards:

raven:
git: https://github.com/sija/raven.cr.git
version: 1.9.4+git.commit.59020d2838c19e769d7fb5e0ee3a242cd9fdb055
version: 1.9.4+git.commit.a43f45229d1ee8030f8f07b101cb159896273195

redis:
git: https://github.com/stefanwille/crystal-redis.git
Expand Down
7 changes: 6 additions & 1 deletion src/controllers/calendars.cr
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ class Calendars < Application
@[AC::Route::Filter(:around_action)]
Application.add_request_queue

@[AC::Route::Filter(:before_action)]
private def ensure_tenant
current_tenant
end

@[AC::Route::Filter(:before_action, except: [:index])]
private def find_matching_calendars(
@[AC::Param::Info(description: "a comma seperated list of calendar ids, recommend using `system_id` for resource calendars", example: "[email protected],[email protected]")]
Expand Down Expand Up @@ -60,8 +65,8 @@ class Calendars < Application
all_calendars = Set.new((calendars || "").split(',').map(&.strip.downcase).reject(&.empty?))
all_calendars.concat(candidate_calendars)
calendars = all_calendars.to_a
return [] of Availability if calendars.empty?

render :no_content, json: [] of Availability if calendars.empty?
# perform availability request
period_start = Time.unix(period_start)
period_end = Time.unix(period_end)
Expand Down

0 comments on commit 44dcd56

Please sign in to comment.