Skip to content

Commit 7d3c9e2

Browse files
authored
Merge pull request #130 from modulr-software/feat/outgoing-endpoints-implementation
outgoing endpoints
2 parents 1cf2407 + db79f54 commit 7d3c9e2

File tree

4 files changed

+29
-7
lines changed

4 files changed

+29
-7
lines changed

src/source/jobs/handlers.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
{:feed-id feed-id
3939
:creator-id creator-id
4040
:content-type-id content-type-id
41-
:posted-at (util/format-rfc-1123-date posted-at)
41+
:posted-at (util/format-rss-date posted-at)
4242
:thumbnail (if (and thumbnail
4343
(seq thumbnail)
4444
(not (string/includes? thumbnail ".mp3")))

src/source/routes/bundle_feeds.clj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@
3939
(->> (hsql/where
4040
[:in :feed-id feed-ids]
4141
[:in :category-id category-ids])
42-
(hsql/order-by (when latest [:created-at :desc]))
4342
(services/feed-categories ds)
4443
(mapv :feed-id)))
45-
type-filtered (->> (when type [:= :content-type-id type])
46-
(hsql/where [:in :id category-filtered-feed-ids])
47-
(services/feeds ds))]
44+
query (-> (when type [:= :content-type-id type])
45+
(hsql/where [:in :id category-filtered-feed-ids])
46+
(hsql/order-by (when latest [:created-at :desc])))
47+
type-filtered (services/feeds ds query)]
4848

4949
(res/response type-filtered)))

src/source/routes/feeds.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
[:ts-and-cs [:maybe :int]]
2525
[:state [:enum "live" "not live" "pending"]]]]}}}
2626

27-
[{:keys [ds] :as _request}]
28-
(-> (services/feeds ds)
27+
[{:keys [ds user] :as _request}]
28+
(-> (services/feeds ds {:where [:= :user-id (:id user)]})
2929
(res/response)))
3030

3131
(defn post

src/source/routes/reitit.clj

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,28 @@
212212
["" (route {:post bundle-posts/post})]
213213
["/:id" (route {:get bundle-post/get})]]]
214214

215+
["/api" {:middleware [[mw/apply-api-key]]
216+
:tags #{"api"}
217+
:swagger {:security [{"apiKey" []}]}
218+
:openapi {:security [{:apiKey []}]}}
219+
["/bundle" {:middleware [[mw/apply-bundle]]}
220+
["" (route {:get bundle/get})]
221+
["/categories"
222+
["" (route {:get bundle-categories/get})]]
223+
["/feeds"
224+
["" (route {:post bundle-feeds/post})]
225+
["/:id"
226+
["" (route {:get bundle-feed/get})]
227+
["/posts"
228+
["" (route {:get bundle-feed-posts/get})]
229+
["/:post-id" (route {:get bundle-feed-post/get})]]]]
230+
["/posts"
231+
["" (route {:post bundle-posts/post})]
232+
["/:id" (route {:get bundle-post/get})]]]
233+
["/categories"
234+
["" (route {:get categories/get})]
235+
["/:id" (route {:get category/get})]]]
236+
215237
["/admin" {:middleware [[mw/apply-auth {:required-type :admin}]]
216238
:tags #{"admin"}
217239
:swagger {:security [{"auth" []}]}

0 commit comments

Comments
 (0)