mirror of
https://github.com/Ratstail91/sineql-demo.git
synced 2026-05-06 07:40:09 +10:00
Added Author query, creation handlers
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
const Sequelize = require('sequelize');
|
||||
const sequelize = require('..');
|
||||
|
||||
module.exports = sequelize.define('author', {
|
||||
const Book = require("./book");
|
||||
|
||||
const Author = sequelize.define('author', {
|
||||
index: {
|
||||
type: Sequelize.INTEGER(11),
|
||||
allowNull: false,
|
||||
@@ -17,3 +19,7 @@ module.exports = sequelize.define('author', {
|
||||
unique: true,
|
||||
}
|
||||
});
|
||||
|
||||
Author.hasMany(Book);
|
||||
|
||||
module.exports = Author;
|
||||
@@ -1,7 +1,7 @@
|
||||
const Sequelize = require('sequelize');
|
||||
const sequelize = require('..');
|
||||
|
||||
module.exports = sequelize.define('book', {
|
||||
const Book = sequelize.define('book', {
|
||||
index: {
|
||||
type: Sequelize.INTEGER(11),
|
||||
allowNull: false,
|
||||
@@ -23,3 +23,5 @@ module.exports = sequelize.define('book', {
|
||||
defaultValue: null
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = Book;
|
||||
Reference in New Issue
Block a user