Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(schema): Virtual property resolvers #2900

Merged
merged 1 commit into from
Dec 3, 2022
Merged

feat(schema): Virtual property resolvers #2900

merged 1 commit into from
Dec 3, 2022

Conversation

daffl
Copy link
Member

@daffl daffl commented Nov 29, 2022

This pull request implements virtual property resolvers as discussed in #2821 and allows selecting all fields - including property resolvers - using the $select query syntax and ensures that databases only get the $select fields they care about. A virtual resolver is essentially a property resolver but does not have a value:

import { resolve, virtual } from '@feathersjs/schema'

const messageResolver = resolve<Message, HookContext>({
  user: virtual(async (message, context) => {
    // Associate the user that sent the message
    return context.app.service('users').get(message.userId)
  })
})

Should close #2595 but we'll leave #2821 open to look at defining dependencies and #2604 to see if something more than $select is needed.

@netlify
Copy link

netlify bot commented Nov 29, 2022

Deploy Preview for feathers-dove ready!

Name Link
🔨 Latest commit 2380b61
🔍 Latest deploy log https://app.netlify.com/sites/feathers-dove/deploys/6385690c54daea0009c1388e
😎 Deploy Preview https://deploy-preview-2900--feathers-dove.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@daffl daffl merged commit 7d03b57 into dove Dec 3, 2022
@daffl daffl deleted the virtual-resolver branch December 3, 2022 18:05
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
1 participant