limit model should be .js files

Signed-off-by: Raccoon <raccoon@hackmd.io>
This commit is contained in:
Raccoon 2021-06-12 13:30:27 +08:00
parent 74f9e57148
commit f04e63279c
No known key found for this signature in database
GPG Key ID: 06770355DC9ECD38

View File

@ -43,7 +43,7 @@ const db: any = {}
fs.readdirSync(__dirname) fs.readdirSync(__dirname)
.filter(function (file) { .filter(function (file) {
return (file.indexOf('.') !== 0) && (file !== 'index.js') return (file.indexOf('.') !== 0) && (file !== 'index.js') && file.endsWith('.js')
}) })
.forEach(function (file) { .forEach(function (file) {
const model = sequelize.import(path.join(__dirname, file)) const model = sequelize.import(path.join(__dirname, file))