Skip to content

Commit

Permalink
fixed merge error
Browse files Browse the repository at this point in the history
  • Loading branch information
codewith-zach committed Aug 30, 2022
2 parents 23d902f + d504f64 commit c723922
Showing 1 changed file with 40 additions and 40 deletions.
80 changes: 40 additions & 40 deletions api/users/user.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const pool = require('../../config/database'); //importing the pool we created


module.exports = {
getUsers: callBack => {
getUsers: callBack => {
pool.query(
`select * from users`,
[],
Expand All @@ -13,8 +13,8 @@ module.exports = {
return callBack(null, results);
}
);
},
createUsers: (data, callBack) => {
},
createUsers: (data, callBack) => {
console.log(data)
pool.query(
`insert into users (username, email, first_name, last_name, phone_number, gender_id, department_id, password )
Expand All @@ -31,55 +31,55 @@ module.exports = {
],
(error, results, field) => {
if (error) {
return callBack(error);
return callBack(error);
}
return callBack(null, results);
}
);
},
createVisitors: (data, callBack) => {
pool.query(
`insert into visitors(fullname, user_id, purpose_id, address) values(?,?,?,?)`,
[
data.fullname,
data.user_id,
data.purpose_id,
data.address
],
(error, results, field) => {
if (error) {
return callBack(error);
}
signInVisitor(results);
return callBack(null, results);
}
},
createVisitors: (data, callBack) => {
pool.query(
`insert into visitors(fullname, user_id, purpose_id, address) values(?,?,?,?)`,
[
data.fullname,
data.user_id,
data.purpose_id,
data.address
],
(error, results, field) => {
if (error) {
return callBack(error);
}
signInVisitor(results);
return callBack(null, results);
}


);
},

getVisitors: callBack => {
pool.query(
`
);
},

getVisitors: callBack => {
pool.query(
`
select v.id as id, v.fullname as fullname, v.purpose_id as purpose, v.date_added as date_added, v.address as address,
c.time_in as time_in, c.time_out as time_out,u.first_name as first_name, u.last_name as last_name
from clock_in c
join visitors v on v.id = c.visitor_id
join users u on u.id = v.user_id
where date(c.time_in) = current_date
`,
[],
(error, results, fields) => {
if (error) {
return callBack(error);
}
return callBack(null, results);
[],
(error, results, fields) => {
if (error) {
return callBack(error);
}
);
},
getAllVisitors: callBack => {
pool.query(
`
return callBack(null, results);
}
);
},
getAllVisitors: callBack => {
pool.query(
`
select v.id as id, v.fullname as fullname, v.purpose_id as purpose, v.date_added as date_added, v.address as address,
c.time_in as time_in, c.time_out as time_out,u.first_name as first_name, u.last_name as last_name
from visitors v
Expand Down Expand Up @@ -182,7 +182,7 @@ module.exports = {
if (error) {
callBack(error);
}
return callBack(null, results[0]);
return callBack(null, results);
}
);
},
Expand Down Expand Up @@ -260,5 +260,5 @@ signInVisitor = (results) => {
console.log(results);
return results;
}
)
)
}

0 comments on commit c723922

Please sign in to comment.