Files
nxxmdata/government-backend/check-harmless-place-model.js

31 lines
1.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 测试HarmlessPlace模型的导出和方法
const HarmlessPlace = require('./models/HarmlessPlace');
const User = require('./models/User');
console.log('=== 检查HarmlessPlace模型 ===');
console.log('HarmlessPlace的类型:', typeof HarmlessPlace);
console.log('HarmlessPlace是否为对象:', typeof HarmlessPlace === 'object' && HarmlessPlace !== null);
console.log('HarmlessPlace是否有findAndCountAll方法:', typeof HarmlessPlace.findAndCountAll !== 'undefined');
if (HarmlessPlace.findAndCountAll) {
console.log('findAndCountAll的类型:', typeof HarmlessPlace.findAndCountAll);
}
console.log('\nHarmlessPlace对象的所有属性和方法:');
console.log(Object.keys(HarmlessPlace));
console.log('\n=== 检查User模型作为对比===');
console.log('User的类型:', typeof User);
console.log('User是否为对象:', typeof User === 'object' && User !== null);
console.log('User是否有findAndCountAll方法:', typeof User.findAndCountAll !== 'undefined');
if (User.findAndCountAll) {
console.log('findAndCountAll的类型:', typeof User.findAndCountAll);
}
console.log('\nUser对象的所有属性和方法:');
console.log(Object.keys(User));
// 检查是否存在循环引用或其他问题
console.log('\n=== 检查模型实例化 ===');
try {
console.log('尝试实例化HarmlessPlace:', new HarmlessPlace());
} catch (error) {
console.log('实例化HarmlessPlace错误:', error.message);
}