File tree Expand file tree Collapse file tree 6 files changed +65
-9
lines changed Expand file tree Collapse file tree 6 files changed +65
-9
lines changed Original file line number Diff line number Diff line change 1+ (ns source.routes.bundle
2+ (:require [ring.util.response :as res]
3+ [source.services.interface :as services]))
4+
5+ (defn get
6+ {:summary " get bundle metadata by authorized uuid"
7+ :parameters {:query [:map [:uuid :string ]]}
8+ :responses {200 {:body [:map
9+ [:id :int ]
10+ [:name :string ]
11+ [:uuid :string ]
12+ [:user-id :int ]
13+ [:video :int ]
14+ [:podcast :int ]
15+ [:blog :int ]
16+ [:hash [:maybe :string ]]
17+ [:content-type-id :int ]
18+ [:ts-and-cs [:maybe :int ]]]}
19+ 404 {:body [:map [:message :string ]]}}}
20+
21+ [{:keys [ds bundle-id] :as _request}]
22+ (res/response (services/bundle ds {:id bundle-id})))
Original file line number Diff line number Diff line change 1+ (ns source.routes.bundle-feeds
2+ (:require [ring.util.response :as res]
3+ [source.services.interface :as services]
4+ [source.db.util :as db.util]))
5+
6+ (defn get
7+ {:summary " get all feeds present in the bundle authorised by uuid"
8+ :parameters {:query [:map [:uuid :string ]]}
9+ :responses {200 {:body [:vector
10+ [:map
11+ [:id :int ]
12+ [:title :string ]
13+ [:display-picture [:maybe :string ]]
14+ [:url [:maybe :string ]]
15+ [:rss-url :string ]
16+ [:user-id :int ]
17+ [:provider-id [:maybe :int ]]
18+ [:created-at :string ]
19+ [:updated-at [:maybe :string ]]
20+ [:content-type-id :int ]
21+ [:cadence-id :int ]
22+ [:baseline-id :int ]
23+ [:ts-and-cs [:maybe :int ]]
24+ [:state [:enum " live" " not live" " pending" ]]]]}
25+ 404 {:body [:map [:message :string ]]}}}
26+
27+ [{:keys [ds bundle-id] :as _request}]
28+ (let [bundle-ds (db.util/conn :bundle bundle-id)
29+ feed-ids (mapv :feed-id (services/outgoing-posts bundle-ds))]
30+ (res/response (services/feeds ds {:where [:in :id feed-ids]}))))
Original file line number Diff line number Diff line change 55
66(defn get
77 {:summary " get a single outgoing post in the uuid-authorized bundle by post id"
8- :parameters {:path [:map [:id {:title " id"
8+ :parameters {:query [:map [:uuid :string ]]
9+ :path [:map [:id {:title " id"
910 :description " post id" } :int ]]}
1011 :responses {200 {:body [:map
1112 [:id :int ]
2021 [:stream-url [:maybe :string ]]
2122 [:season [:maybe :int ]]
2223 [:episode [:maybe :int ]]
23- [:redacted [:maybe :int ]]
24+ [:redacted { :optional true } [:maybe :int ]]
2425 [:posted-at [:maybe :string ]]]}
2526 404 {:body [:map [:message :string ]]}}}
2627
Original file line number Diff line number Diff line change 88 {:summary " get all outgoing posts in the uuid-authorized bundle"
99 :parameters {:query [:map
1010 [:uuid :string ]
11- [:limit :int ]
12- [:start :int ]]}
11+ [:limit { :optional true } :int ]
12+ [:start { :optional true } :int ]]}
1313 :responses {200 {:body [:vector
1414 [:map
1515 [:id :int ]
2424 [:stream-url [:maybe :string ]]
2525 [:season [:maybe :int ]]
2626 [:episode [:maybe :int ]]
27- [:redacted [:maybe :int ]]
27+ [:redacted { :optional true } [:maybe :int ]]
2828 [:posted-at [:maybe :string ]]]]}
29- 404 {:body [:map [:message :string ]]}}}
29+ 404 {:boy [:map [:message :string ]]}}}
3030
3131 [{:keys [bundle-id query-params] :as _request}]
3232 (let [bundle-ds (db.util/conn :bundle bundle-id)
3333 {:keys [limit start]} (walk/keywordize-keys query-params)]
3434 (res/response (services/outgoing-posts bundle-ds {:where (when start [:>= :id start])
3535 :limit limit
3636 :order-by [[:id :asc ]]}))))
37-
Original file line number Diff line number Diff line change 2020 [:stream-url [:maybe :string ]]
2121 [:season [:maybe :int ]]
2222 [:episode [:maybe :int ]]
23- [:redacted [:maybe :int ]]
23+ [:redacted { :optional true } [:maybe :int ]]
2424 [:posted-at [:maybe :string ]]]]}
2525 401 {:body [:map [:message :string ]]}
2626 403 {:body [:map [:message :string ]]}}}
Original file line number Diff line number Diff line change 4141 [source.routes.integrations :as integrations]
4242 [source.routes.integration :as integration]
4343 [source.routes.integration-categories :as integration-categories]
44+ [source.routes.bundle :as bundle]
45+ [source.routes.bundle-feeds :as bundle-feeds]
4446 [source.routes.bundle-posts :as bundle-posts]
4547 [source.routes.bundle-post :as bundle-post]
4648 [source.routes.posts :as posts]
179181 [" /categories" (route {:get feed-categories/get
180182 :post feed-categories/post})]]]
181183
182- [" /bundles " {:middleware [[mw/apply-bundle]]
184+ [" /bundle " {:middleware [[mw/apply-bundle]]
183185 :tags #{" bundles" }}
186+ [" " (route {:get bundle/get})]
187+ [" /feeds" (route {:get bundle-feeds/get})]
184188 [" /posts"
185189 [" " (route {:get bundle-posts/get})]
186190 [" /:id" (route {:get bundle-post/get})]]]
You can’t perform that action at this time.
0 commit comments