Add media get endpoint

This commit is contained in:
2023-01-31 08:53:07 +11:00
parent 71f415f451
commit 2d1c718378
2 changed files with 4 additions and 0 deletions

View File

@@ -3,10 +3,13 @@ module Adamantium
module Media
class Create < Action
include Deps["commands.media.upload"]
before :authorize!
def handle(req, res)
data = req.params[:file]
halt 401 unless verify_scope(req: req, scope: :media)
upload.call(file: data) do |m|
m.failure do |v|
res.status = 422

View File

@@ -12,6 +12,7 @@ module Adamantium
get "/", to: "site.config"
post "/", to: "posts.handle"
post "/media", to: "media.create"
get "/media", to: "media.show"
end
get "/", to: "site.home"