plainblack / ving

An opinionated web services starter for Nuxt3 that provides REST and per-field privileges out of the box.
https://plainblack.github.io/ving/
58 stars 7 forks source link

rethink relationships #38

Closed rizen closed 5 months ago

rizen commented 5 months ago

Right now we have a get on methods like apikeys and avatar in the User record, which abstracts the fact that it's a method. The problem is that really avatar is async and it doesn't look like it. We should rethink this to try to make it more consistent. I'm thinking we should get rid of get from the class for relationships, but I need to think some more about it.

rizen commented 5 months ago

decided we should use get on child relationships because it's not async, but shouldn't on parent because it is

const user = await s3file.user() makes sense

const users = await s3file.avatarUsers().findMany() makes less sense than const users = await s3file.avatarUsers.findMany()