Fork me on GitHub
#pathom
<
2020-08-22
>
yenda13:08:42

is such query invalid?

[{[:video/id "faf7789f-d3e2-11ea-9add-02a4a06c46e9"]
  [:video/placeholder-url]}
 {[:video/id "faf7789f-d3e2-11ea-9add-02a4a06c46e9"] [:creator/id]}]

yenda13:08:09

shouldn't the parser merge the outputs instead of overwriting them (which I assume it does since it responds with one or the other)?

souenzzo15:08:36

@yenda it's not a invalid query But both results end up in the same ident. It will not merge

[{([:video/id "faf7789f-d3e2-11ea-9add-02a4a06c46e9"] {:pathom/as :a})
  [:video/placeholder-url]}
 {([:video/id "faf7789f-d3e2-11ea-9add-02a4a06c46e9"] {:pathom/as :b})
  [:creator/id]}]

souenzzo15:08:43

Or using placeholders

[{:>/a [{[:video/id "faf7789f-d3e2-11ea-9add-02a4a06c46e9"]
         [:video/placeholder-url]}]}
 {:>/b [{[:video/id "faf7789f-d3e2-11ea-9add-02a4a06c46e9"]
         [:creator/id]}]}]

yenda18:08:24

I have the following attributes:

[:comment/created-on
                :video/id
                :user/id
                :comment/id
                :comment/text
                :comment/deleted?
                :comment/mentioned-id]

yenda18:08:02

both user/id and comment/mentioned-id are user-ids but I don't see how I can get more info about the mentioned-id with one query

yenda18:08:31

[{[:comment/id "b214304f"] 
                                                             [{:>/mentioned-user [:comment/mentioned-id :user/username]} :comment/created-on 
                                                              {:>/user [:user/id :user/username]}]}]

yenda18:08:52

this doesn't work and picks the username of user/id in both placeholders

yenda18:08:45

I have an alias for mentioned-id (pc/alias-resolver2 :user/id :comment/mentioned-id))

wilkerlucio20:08:49

@yenda that's a modeling issue, because you have multiple paths with different input values, so which path it chooses is unpredictable (not a problem when paths are consistent, but its not this case), a way out is to instead of making those alias, make that a relationship, in this way:

wilkerlucio20:08:50

(pc/defresolver comment-mentioned [_ {:keys [comment/mentioned-id]}]
  {::pc/input #{:comment/mentioned-id}
   ::pc/output [{:comment/mentioned [:user/id]}]}
  {:comment/mentioned {:user/id mentioned-id}})

wilkerlucio20:08:27

then, you can query:

[{[:comment/id "b214304f"]
  [{:comment/mentioned [:user/username]}
   :comment/created-on
   {:>/user [:user/id :user/username]}]}]

wilkerlucio20:08:21

the idea is created a separated context for the specific (mentioned) entry, this way it doesn't conflict with the user in the parent

yenda20:08:28

nice thanks