MCPcopy Create free account
hub / github.com/OneBitCodeBlog/onebitlife / updateHabit

Function updateHabit

src/Services/HabitsService.js:56–77  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

54};
55
56const updateHabit = (obj) => {
57 return new Promise((resolve, reject) => {
58 db.transaction((tx) => {
59 tx.executeSql(
60 "UPDATE habits SET habitName=?, habitFrequency=?, habitHasNotification=?, habitNotificationFrequency=?, habitNotificationTime=? WHERE habitArea=?;",
61 [
62 obj.habitName,
63 obj.habitFrequency,
64 obj.habitHasNotification,
65 obj.habitNotificationFrequency,
66 obj.habitNotificationTime,
67 obj.habitArea,
68 ],
69 (_, { rowsAffected }) => {
70 if (rowsAffected > 0) resolve(rowsAffected);
71 else reject("Error updating obj");
72 },
73 (_, error) => reject(error)
74 );
75 });
76 });
77};
78
79const deleteByName = (habitArea) => {
80 return new Promise((resolve, reject) => {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected