Skip to content

Commit b38abcf

Browse files
committed
fix: bug when tg account is empty string on update user request
1 parent e37dbb5 commit b38abcf

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

backend/controllers/user.controller.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ const updateUser = async (
308308
"tgAccount"
309309
`;
310310

311+
console.log(values.filter((el) => !!el));
312+
311313
const insertUser = await db.query(
312314
query,
313315
values.filter((el) => !!el)

backend/utils/queryBuilders.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ const getSetString = (body: any) => {
1616
return false;
1717
}
1818

19+
if (key === 'tgAccount' && !body[key]) {
20+
return false;
21+
}
22+
1923
if (
2024
(key === 'percentFromJob' ||
2125
key === 'percentFromParts' ||
@@ -34,6 +38,8 @@ const getSetString = (body: any) => {
3438
queryStr += ', "updatedDate" = NOW() ';
3539
queryStr += `WHERE id = $${(counter += 1)}`;
3640

41+
console.log(queryStr);
42+
3743
return queryStr;
3844
};
3945

0 commit comments

Comments
 (0)