Giter VIP home page Giter VIP logo

sails-ember-rest's People

Contributors

mdconaway avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sails-ember-rest's Issues

Validations error returns 500 code

templates/actions/create.js

Model.create(data).exec((err, newInstance) => {
            // Differentiate between waterline-originated validation errors
            // and serious underlying issues. Respond with badRequest if a
            // validation error is encountered, w/ validation info.
            if (err) return res.serverError(err, actionUtil.parseLocals(req));

It seems the comment discusses handling this but it is not handled.

'includeIn' can no longer be set as an attribute property

Hey friend, thanks for the fantastic work here. I just used this in a project and am extremely happy with it. Ember is awesome, Sails is awesome, and you're awesome.

I came across a sad today, and I'm not sure the issue belongs in your repo, so feel free to redirect me to knock on someone else's door. But either way, I thought you might want to know that it seems like Waterline (Sails 1.0.0-41) is now ignoring the following:

validations: {
  ignoreProperties: ['includeIn']
}

...in sails.config.models. This makes configuring the presentation options impossible on a per-model basis with the latest version of sails-ember-rest.

error: The attribute `guests` on the `event` model contains invalid properties. The property `includeIn` isn't a recognized property.

error: Could not load Sails app.

I've been sleuthing around in Waterline trying to find something, anything, about specifying one's own reserved properties, but to no avail. I can't even find a doc about this breaking change. They appear to be defined here: https://github.com/balderdashy/waterline-schema/blob/master/accessible/valid-attribute-properties.js and enforced here: https://github.com/balderdashy/waterline-schema/blob/master/lib/waterline-schema/schema.js#L237

Anyway, thanks so much for this awesome repo. Let me know if there's any way I can help with this.

Actions 2 support

Thanks for this library!
When I wanted to use the recommended actions2
I've get an error: The action find in someController/find.js conflicts with a previously-loaded action.

Can I somehow work this around?
Thank you

The findOne action seems to be returning a wrong response format

Hi,

First of all I want to thank you. You did a really good job in it.
But when I saw the Ember's DS.RESTAdapter documentation (https://www.emberjs.com/api/ember-data/release/classes/DS.RESTAdapter), in the JSON structure section, I figure out that the response of the findOne action is returning an array instead an object. e.g.

/posts/1 is returning:

{ "posts": [{ "title": "My post", "body": "My post content" }] }

instead of:

{ "posts": { "title": "My post", "body": "My post content" } }

SailsEmber.policies.emberSetHeader is not a constructor

When i did run the code sails generate ember-rest policies on Sails.js,
It did returns me

error: A hook (policies) failed to load!
error: Failed to lift app: { Error: Attempted to require(D:\projetos\monitor-api\api\policies\emberSetHeader.js)  , but an error occurred: 

TypeError: SailsEmber.policies.emberSetHeader is not a constructor
    at Object.<anonymous> (D:\projetos\monitor-api\api\policies\emberSetHeader.js:2:18)

The solution that i found was modify the archive ./templates/policies/emberSetHeader adding the contructor :


const EmberController = require('./../controllers/EmberController');
module.exports = function(controller) {
  controller = controller ? controller : new EmberController();
  return function(req, res, next) {
    if (!req.headers.ember) {
        req.headers.ember = true;
    }
    next();
  };
};

Controller generator output

Change:

"const SailsEmber = require('sails-ember-rest');\nmodule.exports = SailsEmber.controller;\n"

To:

"const SailsEmber = require('sails-ember-rest');\nlet controller = new SailsEmber.controller({\n});\nmodule.exports = controller;"

Better for adding interrupts :)

Support for multiple-word model names?

I have installed this module, and its been working fine until I got to the model that had a multi-word name. For these multi-word names:

  • I'm able to delete, and able to create a record, but with no attributes or relationships

  • I'm unable to POST with attributes or PATCH/PUT any attributes

Are multiple word names supported / can they easily be? Thanks

TypeError: _.pluck is not a function in sails-ember-rest/templates/actions/find

Hi - and many thanks for this code. I'm loving Sails and Ember but I'm not experienced enough to think through and implement on my own all that you've done here.

I was trying something out for a new app, and this came up.

Ember:
console.log('Attempting to connect...'); let sailsSocket = io.sails; sailsSocket.useCORSRouteToGetCookie = false let connection = sailsSocket.connect('http://localhost:1337'); connection.get('/registrations', [], function (resData, jwres){ console.log(resData); });
But this was crashing Sails with a message:

Sails in terminal
TypeError: _.pluck is not a function at actionUtil.populateIndexes (/Users/leonidas/Sites/nautilus/nautilus-sails/node_modules/sails-ember-rest/templates/actions/find.js:50:48)

P.S.
I did a little searching, and found this:

So I went ahead and did the same in sails-ember-rest/templates/actions/find.js:50:48, i.e. changed

if (req._sails.hooks.pubsub && req.isSocket) { Model.subscribe(req, _.pluck(matchingRecords, Model.primaryKey)); ...

to

if (req._sails.hooks.pubsub && req.isSocket) { Model.subscribe(req, _.map(matchingRecords, Model.primaryKey)); ...

which seems to have solved the problem. Thought this might be useful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.