* define api routes and create controllers, sketch out index and create actions * add api v1 organizations CRUD spec and docs spec, need to run swagger * swagger dry run on admin organizations routes, typo fix in api.rb * flesh out specs and sketch out admin actions * move actions out of concerns/include pattern and into v1 inline * remove private constant call * add v1 accept header to doc spec, fix syntax in a before block * update controllers to address failing specs * simplify controller and clarify route config * flesh out tests for errors * fix long line * add missing commas * return username show route to v0 concern controller * create separate show route and action name, remove nesting from create/update params requirement * clean up syntax in controller params and update show path in specs; move routes * fix up syntax in params permit * create organization in index spec * one more syntax tweak for org params * refactoring to one show route that handles username or id * tweak spec syntax to expect the right array * tweak controller and specs, simplify routing to show * remove create route, action, and specs from this branch * add clarifying comment in show controller action * add explicit not found return to show route * fix controller formatting causing 404 errors * remove comment, update specs * remove commment and fix id show response and specs * fix show route and request spec for username param * update unauthorized user specs to use put for now instead of post, regenerate swagger docs * adjust update 422 spec to break org validity * fix admin update spec, rerun swagger * reorganiza controller actions, update specs, ensure authorized update and delete * improve spec, handle finding one org more gracefully, delete via worker * copy routes into api namespace instead of moving them from general namespace * update param in v0 show route to fit more general naming * regenerate v1 swagger docs * use profile image url getter in update controller response * update swagger docs and remove unneeded comment from org' model * configure organizations destroy action for super admins only (for now)
33 lines
1.7 KiB
Ruby
33 lines
1.7 KiB
Ruby
namespace :admin do
|
|
scope :apps do
|
|
resources :listings, only: %i[index edit update destroy]
|
|
resources :listing_categories, only: %i[index edit update new create
|
|
destroy], path: "listings/categories"
|
|
end
|
|
end
|
|
|
|
namespace :api, defaults: { format: "json" } do
|
|
scope module: :v1, constraints: ApiConstraints.new(version: 1, default: false) do
|
|
resources :listings, only: %i[index show create update]
|
|
get "/listings/category/:category", to: "listings#index", as: :listings_category
|
|
get "/organizations/:organization_id_or_slug/listings", to: "organizations#listings",
|
|
as: :organization_listings
|
|
end
|
|
|
|
scope module: :v0, constraints: ApiConstraints.new(version: 0, default: true) do
|
|
resources :listings, only: %i[index show create update]
|
|
get "/listings/category/:category", to: "listings#index"
|
|
get "/organizations/:organization_id_or_slug/listings", to: "organizations#listings"
|
|
end
|
|
end
|
|
resources :listings, only: %i[index new create edit update destroy dashboard]
|
|
|
|
get "/search/listings", to: "search#listings"
|
|
get "/listings/dashboard", to: "listings#dashboard"
|
|
get "/listings/:category", to: "listings#index", as: :listing_category
|
|
get "/listings/:category/:slug", to: "listings#index", as: :listing_slug
|
|
get "/listings/:category/:slug/:view", to: "listings#index", constraints: { view: /moderate/ }
|
|
get "/listings/:category/:slug/delete_confirm", to: "listings#delete_confirm"
|
|
delete "/listings/:category/:slug", to: "listings#destroy"
|
|
get "/social_previews/listing/:id", to: "social_previews#listing", as: :listing_social_preview
|
|
get "/about-listings", to: "pages#about_listings"
|