We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
rest-api/src/placeos-rest-api/controllers/drivers.cr
Line 53 in 8d6ac47
query.search_field "name" query.sort(NAME_SORT_ASC) paginate_results(elastic, query) end @[AC::Route::GET("/:id")] def show( @[AC::Param::Info(name: "compilation_status", description: "check if the driver is compiled?", example: "false")] include_compilation_status : Bool = true ) : Model::Driver | Hash(String, Hash(String, Bool) | JSON::Any) # TODO:: find an alternative for with_fields !include_compilation_status ? current_driver : with_fields(current_driver, { "compilation_status" => Api::Drivers.compilation_status(current_driver, request_id), }) end @[AC::Route::PATCH("/:id", body: :driver)] @[AC::Route::PUT("/:id", body: :driver)] def update(driver : Model::Driver) : Model::Driver current = current_driver current.assign_attributes(driver) raise Error::ModelValidation.new({ActiveModel::Error.new(current_driver, :role, "Driver role must not change")}) if current_driver.role_changed? raise Error::ModelValidation.new(current.errors) unless current.save current end @[AC::Route::POST("/", body: :driver, status_code: HTTP::Status::CREATED)] def create(driver : Model::Driver) : Model::Driver raise Error::ModelValidation.new(driver.errors) unless driver.save driver end @[AC::Route::DELETE("/:id", status_code: HTTP::Status::ACCEPTED)] def destroy : Nil current_driver.destroy end @[AC::Route::POST("/:id/recompile", status: { Nil => HTTP::Status::ALREADY_REPORTED, })] def recompile : Model::Driver? if current_driver.commit.starts_with?("RECOMPILE") nil else if (recompiled = Drivers.recompile(current_driver)) if recompiled.destroyed? raise Error::NotFound.new("driver was deleted") else recompiled end else raise IO::TimeoutError.new("time exceeded waiting for driver to recompile") end end end
The text was updated successfully, but these errors were encountered:
stakach
No branches or pull requests
rest-api/src/placeos-rest-api/controllers/drivers.cr
Line 53 in 8d6ac47
The text was updated successfully, but these errors were encountered: