Add media get endpoint
This commit is contained in:
@@ -3,10 +3,13 @@ module Adamantium
|
|||||||
module Media
|
module Media
|
||||||
class Create < Action
|
class Create < Action
|
||||||
include Deps["commands.media.upload"]
|
include Deps["commands.media.upload"]
|
||||||
|
before :authorize!
|
||||||
|
|
||||||
def handle(req, res)
|
def handle(req, res)
|
||||||
data = req.params[:file]
|
data = req.params[:file]
|
||||||
|
|
||||||
|
halt 401 unless verify_scope(req: req, scope: :media)
|
||||||
|
|
||||||
upload.call(file: data) do |m|
|
upload.call(file: data) do |m|
|
||||||
m.failure do |v|
|
m.failure do |v|
|
||||||
res.status = 422
|
res.status = 422
|
||||||
|
@@ -12,6 +12,7 @@ module Adamantium
|
|||||||
get "/", to: "site.config"
|
get "/", to: "site.config"
|
||||||
post "/", to: "posts.handle"
|
post "/", to: "posts.handle"
|
||||||
post "/media", to: "media.create"
|
post "/media", to: "media.create"
|
||||||
|
get "/media", to: "media.show"
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/", to: "site.home"
|
get "/", to: "site.home"
|
||||||
|
Reference in New Issue
Block a user