Comments (2)
Hm, I don't disagree.
- The only viable workaround I can think of is a custom auth hook. I will include one with the 1.0.0 release.
It might be similar to this:
// Clients can't interact with the `params` object, so the seeder could just stick `{seeder: true}` in there.
//
// The hook can then just delete `params.provider`, and bypass the auth filter.
function seedHook(hook) {
if (hook.params.seeder === true)
delete hook.params.provider;
return hook;
}
- Ok, I see what you mean.
// Kinda tedious to this, but here's the nested service...
app.use('/users/:id/clients', (req, res, next) => {
req.feathers.id = req.params.id;
return next();
}, {
get(id, params) {
return new Promise((resolve, reject) => {
db.collection('clients')
.find({userId: new ObjectId(params.id)})
.then((err, data) => {
return err ? reject(err) : resolve({data});
});
});
}
});
// Your seeder config needs to pass the user id to the client seeder, or else you can't seed...
// Which brings me to this idea:
const seederConfig = {
path: 'users',
// ...
// If we pass the created context, along with the 'seed' function to a callback, then we can seed clients?
callback(user, seed) {
// Return Promise or synchronous computation, doesn't matter
return seed({
path: 'users/:id/clients',
params: {id: user._id},
template: {foo: 'bar'}
});
}
};
I need to add more tests to this library, regardless, so I'll make sure to add provisions for this. As it is, I haven't touched this codebase in months, because I was under the impression that nobody was using it.
Open for suggestions
from feathers-seeder.
The latest commit, 637ec86, should resolve this for you. :)
Check out this test.
from feathers-seeder.
Related Issues (19)
- enabling https HOT 3
- Error on postinstall (Unknown plugin "add-module-exports") HOT 2
- question: creating users from predefined data HOT 1
- bug: number types in templates are empty HOT 1
- Import data 1:1 without randomization HOT 4
- Provide placeholder for Iterator number HOT 9
- executing order of service array HOT 4
- Reset autoincrement value for sequelize-adapter HOT 4
- 1.0.8 not working anymore HOT 1
- support faker locale option HOT 3
- How to handle several dependent seeds HOT 3
- Seeder not working with nuxt-js project HOT 4
- MIT License HOT 11
- GeneralError: Cannot read property 'remove' of undefined HOT 1
- Getting dates in ISO format
- ResourceRequest timed out HOT 3
- Low Severe Vulnerabilities Found
- error: MethodNotAllowed: Can not remove multiple entries HOT 1
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 feathers-seeder.