Comments (3)
Current approach defining a schema extension from the extender, and importing it in the extended schema:
/**
* TODO: currently we have to import this in the "Response" model
* In the future this should be instead tied to the "NormalizedResponse" model
* To avoid a dependency Response->NormalizedResponse (we only want NormalizedResponse->Response)
* @see https://github.com/VulcanJS/vulcan-npm/issues/133
*/
export const responseSchemaExtension = {
/**
* TODO: this creates a strong dependency to the admin area
* And this field is only used in admin display
*
* Possible solutions:
* - put the NormalizedResponse model and Response model into a shared folder
* - find a way to extend the Response model based on NormalizedResponse
*
* + we could create a relation resolver for this in Vulcan for those
* kind of "virtual" relations (the foreign key is in the related model instead of the current model)
*
* @see https://github.com/VulcanJS/vulcan-npm/issues/133
*
*/
normalizedResponse: {
type: Object,
typeName: "JSON",
blackbox: true,
optional: true,
canRead: ["owners"],
resolveAs: {
fieldName: "normalizedResponse",
typeName: "JSON",
// TODO: use a relation instead
resolver: async (response: ResponseDocument) => {
return await NormalizedResponseConnector.findOne({
responseId: response._id,
});
},
},
},
};
from vulcan-npm.
Better: "belongsToOne" and "belongsToMany" as new relation types
from vulcan-npm.
Field is named "reversedRelation" (because there can already be a relation) and types are "hasOneReversed" and "hasManyReversed". This might be slightly complex to understand, but the way it works become intuitive if you have a separate admin area for instance.
from vulcan-npm.
Related Issues (20)
- Explose refetchQueries for optimistic updates after a mutation
- Better lodash optimization
- Mutator should allow rethrowing errors in "onCreate", "onUpdate" callbacks for server generated fields
- Remix "Eurodance Stack" aka "Enka Stack" aka Vulcan Remix
- Switch to Yarn 2 plug and play mode HOT 1
- Supports Graphback generation
- Merge docusaurus and typedoc via plugin
- Prevent server leak
- 2000 should be 20000 HOT 2
- Update Next to use Mongo selector instead of Mongoose HOT 1
- Update "fix-apollo" to match "ts-invariant" new export using ".js" instead of ".esm.js" HOT 1
- Investigate "barrel" file bundling in Next.js
- Form callbacks
- yarn (3.2.4) install of eurostack crashing HOT 1
- Document how to customize the mongoose model
- Setup TurboRepo HOT 2
- Get rid of bootstrap dependency in react-ui
- Remove the need for explicit createdAt/updatedAt/userId/_id
- Introduce Vulcan REST
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vulcan-npm.