Если нужны еще куски кода, то скину
Сама ошибка:
/root/fake-transfer/index.js:570
createUserStatement.run(Object.values(user).map(mapObjectValue));
SqliteError: NOT NULL constraint failed: users.id
at getOrCreateUser (/root/fake-transfer/index.js:570:24)
at getUser (/root/fake-transfer/index.js:564:22)
at getTimeNow (/root/fake-transfer/index.js:609:60)
at modifyHistoryInput (/root/fake-transfer/index.js:827:13)
at modifyIPhoneHistoryInput (/root/fake-transfer/index.js:778:14)
at HistoryType.withItems.size [as modifyInput] (/root/fake-transfer/index.js:378:110)
at sendFake (/root/fake-transfer/index.js:895:27)
Кусок кода:
function getUser(id) {
return users[id] || getOrCreateUser(id);
function getOrCreateUser(id) {
const count = getUserCountStatement.get(id);
if (count["count()"] == 0) {
const user = new User(id);
createUserStatement.run(Object.values(user).map(mapObjectValue)); // 570 error line
return user;
}
users[id] = loadUserStatement.get(id);
users[id].bills = JSON.parse(users[id].bills);
return users[id];
}
}
function saveUser(user) {
const values = userKeysNoIds.map(x => mapObjectValue(user[x]));
values.push(user.id);
updateUserStatement.run(values);
}
База пустая создается