You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# TODO:: we should make this part of the model (JSON write only lazy getter)
})endpaginate_results(elastic,query)end
@[AC::Route::GET("/:id")]defshow(
@[AC::Param::Info(name: "instances",description: "return assets that are a subset of this asset?",example: "true")]include_instances : Bool=false) : Model::Asset | Hash(String,Array(PlaceOS::Model::AssetInstance) | JSON::Any)ifinclude_instances# TODO:: we should make this part of the model (JSON write only lazy getter)# in the mean time this will work and our docs still look okayrenderjson: with_fields(current_asset,{"asset_instances"=>current_asset.asset_instances.to_a,})endcurrent_assetend
@[AC::Route::PATCH("/:id",body: :asset)]
@[AC::Route::PUT("/:id",body: :asset)]defupdate(asset : Model::Asset) : Model::Assetcurrent=current_assetcurrent.assign_attributes(asset)raiseError::ModelValidation.new(current.errors)unlesscurrent.savecurrentend
@[AC::Route::POST("/",body: :asset,status_code: HTTP::Status::CREATED)]defcreate(asset : Model::Asset) : Model::AssetraiseError::ModelValidation.new(asset.errors)unlessasset.saveassetend
@[AC::Route::DELETE("/:id",status_code: HTTP::Status::ACCEPTED)]defdestroy : Nilcurrent_asset.destroy# expires the cache in after callbackhead:okend
@[AC::Route::GET("/:id/asset_instances")]defasset_instances : Array(Model::AssetInstance)instances=current_asset.asset_instances.to_aset_collection_headers(instances.size,Model::AssetInstance.table_name)instancesendendend
The text was updated successfully, but these errors were encountered:
in the mean time this will work and our docs still look okay
##########################################################################
rest-api/src/placeos-rest-api/controllers/assets.cr
Line 54 in d956068
The text was updated successfully, but these errors were encountered: