We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Considering this situation:
lux new testApp --database mysql lux g resource user email:string password:string
lux new testApp --database mysql
lux g resource user email:string password:string
Updated routes.js
this.resource('users', function () { this.post('/emails', 'emails'); });
Added scope to model
class User extends Model { static scopes = { findByEmail(email) { return this.first().where({ email: email }); } }; }
Added method to controller
class UsersController extends Controller { params = [ 'email', 'password' ]; query = [ 'data' ]; emails({ params: { data: { attributes: { identification } } } }) { return User.findByEmail(identification); } }
When I POST http://localhost:4000/users/emails with body {"data":{"attributes":{"identification":"xxx@yyy.com"}}}
I receive a 500 with response :
{ "errors": [ { "status": "500", "title": "Internal Server Error", "detail": "User.findByEmail is not a function" } ], "jsonapi": { "version": "1.0" } }
What is wrong in the situation for the method findByEmail not to be found? This scope method should be callable from the controller no?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Considering this situation:
lux new testApp --database mysql
lux g resource user email:string password:string
Updated routes.js
Added scope to model
Added method to controller
When I POST http://localhost:4000/users/emails with body
{"data":{"attributes":{"identification":"xxx@yyy.com"}}}
I receive a 500 with response :
What is wrong in the situation for the method findByEmail not to be found?
This scope method should be callable from the controller no?
The text was updated successfully, but these errors were encountered: