Comments (2)
Also, to get lux seed
to work in the test app, I had to make a slight amendment to /test/test-app/db/seed.js. It appears connection
is undefined, so connection.batchInsert()
throws the following error:
TypeError: Cannot read property 'batchInsert' of undefined
at Object.keys.map.reduce (/Users/will/Code/lux/test/test-app/dist/bundle.js:1402:33)
at Array.reduce (native)
at seed (/Users/will/Code/lux/test/test-app/dist/bundle.js:1401:9)
at /Users/will/Code/lux/test/test-app/node_modules/knex/lib/transaction.js:81:20
at runCallback (timers.js:651:20)
at tryOnImmediate (timers.js:624:5)
at processImmediate [as _immediateCallback] (timers.js:596:5)
From previous event:
at /Users/will/Code/lux/test/test-app/node_modules/knex/lib/transaction.js:75:10
at runCallback (timers.js:651:20)
at tryOnImmediate (timers.js:624:5)
From previous event:
at new Transaction (/Users/will/Code/lux/test/test-app/node_modules/knex/lib/transaction.js:68:41)
at Client_SQLite3.transaction (/Users/will/Code/lux/test/test-app/node_modules/knex/lib/client.js:158:12)
at Function.transaction (/Users/will/Code/lux/test/test-app/node_modules/knex/lib/util/make-knex.js:75:21)
at Database.then.store (/Users/will/.nvm/versions/node/v6.10.0/lib/node_modules/lux-framework/src/packages/cli/commands/dbseed.js:23:22)
The following code ran the seeds successfully:
import __fixtures__ from './__fixtures__.json'
const CHUNK_SIZE = 100
export default async function seed(trx) {
const promises = Object
.keys(__fixtures__)
.map(key => [
key,
__fixtures__[key].map(row => (
Object.assign(row, {
created_at: new Date(row.created_at),
updated_at: new Date(row.updated_at),
})
))
])
.reduce((arr, [table, rows]) => {
arr[arr.length] = trx
.batchInsert(table, rows, CHUNK_SIZE)
.transacting(trx)
return arr
}, [])
return Promise.all(promises)
}
from lux.
@willviles I was able to reproduce your issue regarding updating has many through relationships. I'm going to look into this a bit deeper and see if there is an easy fix.
In the mean time, could you expose the through
model's controller and modify the relationships from there? I confirmed that it is working in the in v1.2.1
.
Add Relationship
POST /friendships HTTP/1.1
Content-Type: application/vnd.api+json
Content-Length: 282
{
"data": {
"type": "friendships",
"relationships": {
"follower": {
"data": {
"id": ":id",
"type": "users"
}
},
"followee": {
"data": {
"id": ":id",
"type": "users"
}
}
}
}
}
Remove Relationship
DELETE /friendships/:id HTTP/1.1
from lux.
Related Issues (20)
- Disconnect event not listened to on worker shutdown
- Generate type descriptors for TypeScript and Flow
- Error un cluster module usage
- Offer access to data gathered from queries in actions after they are executed.
- Support custom filters HOT 5
- api requests made over https contain links to http endpoints (not https) (when behind a reverse proxy/load balancer)
- Update for changes in remark, remark-lint
- Partial updates with PATCH not working HOT 2
- (page) links not serialized properly when one of the params is a date HOT 2
- Attribute added in `beforeCreate` hook not serialized into payload HOT 1
- db:create with mysql : unknown database
- Model scope method is not a function
- db seed with mysql database : Cannot read property 'concat' of undefined
- Relationship with falsy ID (i.e. 0) not serialized HOT 3
- Circle v1 not supported after Aug 31, 2018
- [BUG] PK not set properly when creating a record w/ a hasOne relationship HOT 1
- Controller params default to empty array, not to serializer attributes
- Switch from fb-watchman to chokidar
- include nested relationship HOT 2
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 lux.