fix: one-to-one associations didn't work properly
This commit is contained in:
parent
5db3bb4eb3
commit
45d991d1e9
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hapi-sequelize-crud",
|
"name": "hapi-sequelize-crud",
|
||||||
"version": "1.5.0",
|
"version": "1.5.1",
|
||||||
"description": "Hapi plugin that automatically generates RESTful API for CRUD",
|
"description": "Hapi plugin that automatically generates RESTful API for CRUD",
|
||||||
"main": "build/index.js",
|
"main": "build/index.js",
|
||||||
"config": {
|
"config": {
|
||||||
|
@ -24,7 +24,11 @@ export const get = (server, a, b) => {
|
|||||||
if (request.query.include)
|
if (request.query.include)
|
||||||
include = [request.models[request.query.include]];
|
include = [request.models[request.query.include]];
|
||||||
|
|
||||||
let instance = await b.findOne({
|
let where = _.omit(request.query, 'include');
|
||||||
|
|
||||||
|
let [instance] = await b.findAll({
|
||||||
|
where,
|
||||||
|
|
||||||
include: include.concat({
|
include: include.concat({
|
||||||
model: a,
|
model: a,
|
||||||
where: {
|
where: {
|
||||||
|
Loading…
Reference in New Issue
Block a user