Skip to content

Commit

Permalink
Add validate endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Braktar committed Mar 9, 2022
1 parent 40160ab commit 5a86dd9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions api/v01/vrp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,32 @@ class Vrp < APIBase
end
end

resource :validate do
desc 'Validate VRP problem', {
nickname: 'submit_vrp',
success: [{
code: 200,
message: 'Vrp has been validated'
}],
failure: [{
code: 400,
message: 'Bad Request',
model: ::Api::V01::Status
}]
}
params {
use(:input)
}
post do
d_params = declared(params, include_missing: false) # Filtered in sentry if user_context
vrp_params = d_params[:points] ? d_params : d_params[:vrp]
::Models::Vrp.create(vrp_params)
present(d_params)
end
ensure
::Models.delete_all
end

resource :jobs do
desc 'Fetch vrp job status', {
nickname: 'get_job',
Expand Down

0 comments on commit 5a86dd9

Please sign in to comment.