Skip to content

Commit

Permalink
update config.edn with new walkable registry
Browse files Browse the repository at this point in the history
  • Loading branch information
myguidingstar committed Feb 27, 2021
1 parent 434009c commit 9876b95
Showing 1 changed file with 141 additions and 83 deletions.
224 changes: 141 additions & 83 deletions resources/conduit/config.edn
Original file line number Diff line number Diff line change
Expand Up @@ -32,93 +32,151 @@
[:duct.migrator.ragtime/sql :conduit.migration/create-table-comment]
{:up [#duct/resource "migrations/create-table-comment-2018-04-23.sql"]
:down [#duct/resource "migrations/drop-table-comment-2018-04-23.sql"]}

:conduit.handler.walkable/inputs-outputs {}

:conduit.handler.walkable/connect
{:inputs-outputs #ig/ref :conduit.handler.walkable/inputs-outputs
:floor-plan
{:true-columns
[:user/email :user/name :user/username :user/bio :user/image
:article/slug :article/title :article/description :article/body :article/image
:article/created-at :article/updated-at
:tag/tag
:comment/id :comment/created-at :comment/updated-at :comment/body]

:roots {[:app.global-feed/articles :app.personal-feed/articles
:app.articles.list/first-item-id :app.articles.list/last-item-id :app.articles.list/total-items]
"article"
[:app/users :session/current-user] "user"
:app.tags/top-list "tag"}

:grouping {:app.tags/top-list {:group-by [:tag/tag]}}

:pagination-fallbacks {[:app.global-feed/articles :app.personal-feed/articles]
{:order-by {:default [:article/created-at :desc]}}
:app.tags/top-list
{:order-by {:default [:tag/count :desc]}
:limit {:default 20}}}

:joins {[:user/followed-by :user/followed-by-me :user/followed-by-count]
[:user/id :follow/followee-id :follow/follower-id :user/id]

:article/tags [:article/id :tag/article-id]

:article/comments [:article/id :comment/article-id]

[:article/liked-by :article/liked-by-count :article/liked-by-me]
[:article/id :favorite/article-id :favorite/user-id :user/id]

:article/author [:article/author-id :user/id]

:comment/author [:comment/author-id :user/id]}

:pseudo-columns {:tag/count [:count :tag/tag]
:comment/can-edit [:= app.auth/current-user :comment/author-id]
:article/can-edit [:= app.auth/current-user :article/author-id]}

:aggregators {[:article/liked-by-count :user/followed-by-count]
[:count-*]

:app.articles.list/total-items
[:count-*]

:app.articles.list/first-item-id
[:min :article/id]

:app.articles.list/last-item-id
[:max :article/id]

[:user/followed-by-me :article/liked-by-me]
[:< 0 [:count-*]]}

:reversed-joins {:user/follows :user/followed-by
:user/likes :article/liked-by
:user/articles :article/author}

:extra-conditions
{[:app.personal-feed/articles]
{:article/author {:user/followed-by [:= app.auth/current-user :user/id]}}

:article/liked-by-me
[:= app.auth/current-user :user/id]

:session/current-user
[:= app.auth/current-user :user/id]

:user/followed-by-me
[:= app.auth/current-user :user/id]}

:cardinality {:session/current-user :one

[:article/author :comment/author]
:one}}}
[{:key :app.global-feed/articles,
:type :root,
:table "article"
:output [:article/id]
:default-order-by [:article/created-at :desc]}
{:key :app.personal-feed/articles,
:type :root,
:table "article"
:output [:article/id]
:filter {:article/author {:user/followed-by [:= app.auth/current-user :user/id]}}
:default-order-by [:article/created-at :desc]}
{:key :app.articles.list/first-item-id,
:type :root,
:table "article"
:aggregate true
:formula [:min :article/id]}
{:key :app.articles.list/last-item-id,
:type :root,
:aggregate true
:formula [:max :article/id]
:table "article"}
{:key :app.articles.list/total-items,
:type :root,
:aggregate true
:formula [:count-*]
:table "article"}
{:key :app/users,
:type :root,
:table "\"user\""
:output [:user/id]}
{:key :session/current-user,
:type :root,
:table "\"user\""
:output [:user/id]
:filter [:= app.auth/current-user :user/id]
:cardinality :one}
{:key :app.tags/top-list
:type :root
:table "tag"
:output [:tag/tag :tag/count]
:group-by [:tag/tag]
:default-order-by [:tag/count :desc]
:default-limit 20}
{:key :user/followed-by,
:type :join,
:output [:user/id]
:join-path [:user/id :follow/followee-id :follow/follower-id :user/id]}
{:key :user/follows,
:type :join,
:output [:user/id]
:join-path [:user/id :follow/follower-id :follow/followee-id :user/id]}
{:key :user/followed-by-me,
:type :join,
:aggregate true
:formula [:< 0 [:count-*]]
:filter [:= app.auth/current-user :user/id]
:join-path [:user/id :follow/followee-id :follow/follower-id :user/id]}
{:key :user/followed-by-count,
:type :join,
:join-path [:user/id :follow/followee-id :follow/follower-id :user/id]
:aggregate true
:formula [:count-*]}
{:key :article/liked-by,
:type :join,
:output [:user/id]
:join-path [:article/id :favorite/article-id :favorite/user-id :user/id]}
{:key :user/likes,
:type :join,
:output [:article/id]
:join-path [:user/id :favorite/user-id :favorite/article-id :article/id]}
{:key :article/liked-by-count,
:type :join,
:aggregate true
:formula [:count-*]
:join-path [:article/id :favorite/article-id :favorite/user-id :user/id]}
{:key :article/liked-by-me,
:type :join,
:aggregate true,
:formula [:< 0 [:count-*]]
:filter [:= app.auth/current-user :user/id]
:join-path [:article/id :favorite/article-id :favorite/user-id :user/id]}
{:key :article/tags,
:type :join,
:output [:tag/tag]
:join-path [:article/id :tag/article-id]}
{:key :article/comments,
:type :join,
:output [:comment/id]
:join-path [:article/id :comment/article-id]}
{:key :article/author,
:type :join,
:output [:user/id]
:join-path [:article/author-id :user/id]
:cardinality :one}
{:key :user/articles,
:type :join,
:output [:article/id]
:join-path [:user/id :article/author-id]}
{:key :comment/author,
:type :join,
:output [:user/id]
:join-path [:comment/author-id :user/id]
:cardinality :one}
{:key :tag/count,
:type :pseudo-column,
:formula [:count :tag/tag]}
{:key :comment/can-edit,
:type :pseudo-column,
:formula [:= app.auth/current-user :comment/author-id]}
{:key :article/can-edit,
:type :pseudo-column,
:formula [:= app.auth/current-user :article/author-id]}
{:key :article/id
:type :true-column
:primary-key true
:output [:article/slug :article/title
:article/description :article/body :article/image
:article/created-at :article/updated-at
:article/can-edit
:article/liked-by-count :article/liked-by-me
:article/author
:article/liked-by
:article/tags]}
{:key :comment/id
:type :true-column
:primary-key true
:output [:comment/created-at :comment/updated-at
:comment/can-edit :comment/body
:comment/author]}
{:key :user/id
:type :true-column
:table "\"user\""
:primary-key true
:output [:user/email :user/name :user/username :user/bio :user/image
:user/followed-by-me :user/followed-by-count
:user/followed-by
:user/articles]}]

:conduit.handler.walkable/resolver
{:com.wsscode.pathom.core/placeholder-prefixes #{"placeholder" "ph"}
:duct/logger #ig/ref :duct/logger
:app/db #ig/ref :duct.database/sql
:connect #ig/ref :conduit.handler.walkable/connect}
[{:connect #ig/ref :conduit.handler.walkable/connect}
{:app/db #ig/ref :duct.database/sql
:com.wsscode.pathom.core/placeholder-prefixes #{"placeholder" "ph"}
:duct/logger #ig/ref :duct/logger}]

:duct.router/ataraxy
{:routes {:get [:index]
Expand Down

0 comments on commit 9876b95

Please sign in to comment.