Use wrapper for yada/resource

This commit is contained in:
Marcin Kulik 2017-02-28 17:56:29 +01:00
parent 3424505587
commit bb4c602a4c
2 changed files with 49 additions and 41 deletions

View File

@ -7,6 +7,7 @@
[user-database :as udb]]
[asciinema.model.asciicast :as asciicast]
[asciinema.util.io :refer [with-tmp-dir]]
[asciinema.yada :refer [resource]]
[clj-time.core :as t]
[clojure.java
[io :as io]
@ -53,7 +54,8 @@
(service-unavailable-response ctx)))
(defn asciicast-json-resource [db file-store]
(yada/resource {:produces "application/json"
(resource
{:produces "application/json"
:parameters {:path {:token String}
:query {(s/optional-key :dl) s/Bool}}
:properties (fn [ctx]
@ -69,7 +71,8 @@
(fstore/serve-file file-store ctx path (when dl {:filename filename}))))}))
(defn asciicast-png-resource [db file-store exp-set executor]
(yada/resource {:produces "image/png"
(resource
{:produces "image/png"
:parameters {:path {:token String}
:query {(s/optional-key :time) s/Num
(s/optional-key :theme) Theme

5
src/asciinema/yada.clj Normal file
View File

@ -0,0 +1,5 @@
(ns asciinema.yada
(:require [yada.yada :as yada]))
(defn resource [model]
(yada/resource model))