Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(availability): PPT-1629 return 404 when tenant not found #334

Merged
merged 6 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ shards:

action-controller:
git: https://github.com/spider-gazelle/action-controller.git
version: 7.4.3
version: 7.4.4

active-model:
git: https://github.com/spider-gazelle/active-model.git
Expand Down
10 changes: 9 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
raise Error::NotImplemented.new("domain does not have a tenant configured") unless 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,7 +65,10 @@ 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?

# raise Error::TenantNotFound.new("no tenants exist") if calendars.empty?

# perform availability request
period_start = Time.unix(period_start)
Expand Down