Initial commit
This commit is contained in:
28
app/actions/media/create.rb
Normal file
28
app/actions/media/create.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
module Adamantium
|
||||
module Actions
|
||||
module Media
|
||||
class Create < Action
|
||||
before :authenticate
|
||||
|
||||
include Deps["commands.media.upload"]
|
||||
|
||||
def handle(req, res)
|
||||
data = req.params[:file]
|
||||
|
||||
halt 401 if verify_scope(req: req, scope: :media)
|
||||
|
||||
upload(file: data) do |m|
|
||||
m.failure do |v|
|
||||
res.status = 422
|
||||
end
|
||||
|
||||
m.success do |v|
|
||||
res.status = 201
|
||||
res.body = v
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user