Open JasperGrimm opened 8 years ago
Setup connection and model-builder
import ModelBuilder from './modelBuilder' const mb = new ModelBuilder('http://127.0.0.1:8080') import models from './database'
Create City instance
let city = mb.get('city', {}) city.name = 'Jam' city.id = 1 city.save()
or another way
let city = mb.get('city', {}) city.setData({ id: 1, name: 'Jam' }) city.save()
Create User instance and pass City reference into
let user = mb.get('user', {}) user.setData({ id: id, name: name, city: city // reference to City (One-To-One) }) user.save()
Setup connection and model-builder
Create City instance
or another way
Create User instance and pass City reference into