* insert_person saves a person's data to the people table. * @param {object} data - a valid JSON object containing data to be inserted. * @param {function} callback - callback function to be executed on success.
(data, callback)
| 50 | * @param {function} callback - callback function to be executed on success. |
| 51 | */ |
| 52 | function insert_person (data, callback) { |
| 53 | connect( function insert_person_after_connected () { |
| 54 | const { name, username, bio, worksfor, location, website, uid, |
| 55 | stars, followers, following, contribs } = data; |
| 56 | const recent_activity = utils.recent_activity(data); |
| 57 | const query = `INSERT INTO people (name, username, bio, worksfor, location, |
| 58 | website, uid, stars, followers, following, contribs, recent_activity) |
| 59 | VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)`; |
| 60 | const values = [name, username, bio, worksfor, location, website, uid, |
| 61 | stars, followers, following, contribs, recent_activity]; |
| 62 | |
| 63 | PG_CLIENT.query(query, values, function(error, result) { |
| 64 | utils.log_error(error, data, new Error().stack); |
| 65 | return insert_next_page (data, callback); |
| 66 | }); |
| 67 | }); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * select_person gets the person from people table. |
nothing calls this directly
no test coverage detected