Updated the dependencies, adjusted book handler code

This commit is contained in:
2023-05-02 06:50:40 +10:00
parent 19b661f9bc
commit 40ce5badbd
8 changed files with 461 additions and 66 deletions
+3 -2
View File
@@ -12,7 +12,8 @@ module.exports = sequelize.define('author', {
name: {
type: Sequelize.TEXT,
allowNull: true,
defaultValue: null
allowNull: false,
defaultValue: null,
unique: true,
}
});
+3 -2
View File
@@ -12,8 +12,9 @@ module.exports = sequelize.define('book', {
title: {
type: Sequelize.TEXT,
allowNull: true,
defaultValue: null
allowNull: false,
defaultValue: null,
unique: true,
},
published: {
+1
View File
@@ -3,6 +3,7 @@ const Author = require('./author');
//relations
Author.hasMany(Book);
Book.belongsTo(Author);
//collate
module.exports = {