Added Author query, creation handlers

This commit is contained in:
2023-06-03 22:32:27 +10:00
parent e6b51f5374
commit 71c201cae5
5 changed files with 181 additions and 36 deletions
+7 -1
View File
@@ -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;