feathers-hook

Using feathers-client and sequelize many-to-many relation

旧时模样 提交于 2021-02-10 18:18:10
问题 I'm trying to get data from an n:m association using feathers. I'm using react for my front-end and connecting to feathers using the feathers-client and socketio. //connection string where the feathers api is running const host = 'http://localhost:3030'; const socket = io(host, { transports: ['websocket'], forceNew: true }); // construct feathers app export const client = feathers() .configure(hooks()) .configure(auth({ storage: window.localStorage })) .configure(socketio(socket)); But when I

is there any way where i can apply group and pagination using createQuery?

不想你离开。 提交于 2019-12-23 06:27:23
问题 Query like this, http://localhost:3030/dflowzdata?$skip=0&$group=uuid&$limit=2 and dflowzdata service contains data like, [ { "uuid": 123456, "id": 1 }, { "uuid": 123456, "id": 2 }, { "uuid": 7890, "id": 3 }, { "uuid": 123456, "id": 4 }, { "uuid": 4567, "id": 5 } ] Before Find Hook like, if (query.$group !== undefined) { let value = hook.params.query.$group delete hook.params.query.$group const query = hook.service.createQuery(hook.params.query); hook.params.rethinkdb = query.group(value) }

is there any way where i can apply group and pagination using createQuery?

孤街醉人 提交于 2019-12-23 06:27:11
问题 Query like this, http://localhost:3030/dflowzdata?$skip=0&$group=uuid&$limit=2 and dflowzdata service contains data like, [ { "uuid": 123456, "id": 1 }, { "uuid": 123456, "id": 2 }, { "uuid": 7890, "id": 3 }, { "uuid": 123456, "id": 4 }, { "uuid": 4567, "id": 5 } ] Before Find Hook like, if (query.$group !== undefined) { let value = hook.params.query.$group delete hook.params.query.$group const query = hook.service.createQuery(hook.params.query); hook.params.rethinkdb = query.group(value) }

Structure restrictToOwner & restrictToRoles in feathersjs

戏子无情 提交于 2019-12-13 03:26:13
问题 I've read through the documentation, but I can't seem to get it right. I'm trying to implement a restrictToOwner and restrictToRoles such that users with admin or superadmin role can access every other method in this service const restrict = [ ‎ authenticate('jwt'), ‎ restrictToOwner({ idField: '_id', ownerField: '_id' }) ] ‎ const restrictUser = [ authenticate('jwt'), restrictToRoles({ roles: ['admin', 'super-admin'], fieldName: 'roles' }) ] before: { all: [], find: [ ...restrictUser ], get: