aloux-iam 0.0.30 → 0.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/services/auth.js +3 -2
- package/lib/services/bigQuery.js +18 -0
- package/package.json +1 -1
package/lib/services/auth.js
CHANGED
|
@@ -500,16 +500,17 @@ self.createCustomer = async (req, res) => {
|
|
|
500
500
|
let newCustomer = await user.save()
|
|
501
501
|
const token = await newCustomer.generateAuthToken()
|
|
502
502
|
if (process.env.UPLOAD_CUSTOMER === 'true') {
|
|
503
|
+
let date = await bigQuery.factoryDateTime(newCustomer.createdAt)
|
|
503
504
|
let row = {
|
|
504
505
|
id: newCustomer._id.toString() || 'NA',
|
|
505
506
|
name: newCustomer.name || 'NA',
|
|
506
|
-
lastName: newCustomer.lastName || 'NA',
|
|
507
507
|
email: newCustomer.email || 'NA',
|
|
508
508
|
age: newCustomer.data.age.toString() || 'NA',
|
|
509
509
|
gender: newCustomer.data.gender || 'NA',
|
|
510
510
|
scholarship: newCustomer.data.scholarship || 'NA',
|
|
511
511
|
entity: newCustomer.data.Entity || 'NA',
|
|
512
|
-
municipality: newCustomer.data.municipality || 'NA'
|
|
512
|
+
municipality: newCustomer.data.municipality || 'NA',
|
|
513
|
+
createdAt: date
|
|
513
514
|
}
|
|
514
515
|
await bigQuery.callAppendRows([row], process.env.UPLOAD_CUSTOMER_TABLE)
|
|
515
516
|
}
|
package/lib/services/bigQuery.js
CHANGED
|
@@ -61,4 +61,22 @@ self.callAppendRows = async (row, table) => {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
return results
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
self.factoryDateTime = async (dateNumber) => {
|
|
67
|
+
const d = new Date(dateNumber)
|
|
68
|
+
let year = d.getFullYear()
|
|
69
|
+
let month = d.getMonth() + 1
|
|
70
|
+
let day = d.getDate()
|
|
71
|
+
let hour = d.getHours()
|
|
72
|
+
let min = d.getMinutes()
|
|
73
|
+
let seg = d.getSeconds()
|
|
74
|
+
|
|
75
|
+
month = month < 10 ? "0" + month : month
|
|
76
|
+
day = day < 10 ? "0" + day : day
|
|
77
|
+
hour = hour < 10 ? "0" + hour : hour
|
|
78
|
+
min = min < 10 ? "0" + min : min
|
|
79
|
+
seg = seg < 10 ? "0" + seg : seg
|
|
80
|
+
|
|
81
|
+
return year + "-" + month + "-" + day + "T" + hour + ":" + min + ":" + seg
|
|
64
82
|
}
|