Skip to content

Commit 5216c94

Browse files
authored
Merge pull request #109 from Shimork04/master
updates in validators/index.js
2 parents 26cc4f7 + b2d2863 commit 5216c94

File tree

5 files changed

+118
-14
lines changed

5 files changed

+118
-14
lines changed

common/validators/index.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
// import moment from "moment";
1+
import moment from "moment";
2+
23
const moment = require("moment");
4+
const mongoose = require("mongoose");
35

4-
const Valiadtors = {
6+
const Validators = {
57
isValidEmail: (email) => {
68
var pattern = /(([a-zA-Z0-9\-?\.?]+)@(([a-zA-Z0-9\-_]+\.)+)([a-z]{2,3}))+$/;
79
return new RegExp(pattern).test(email);
@@ -44,22 +46,16 @@ const Valiadtors = {
4446
},
4547

4648
getWeekOfYear: (params) => {
47-
params.currDate = Date.now();
48-
var year = new Date(parseInt(params.currDate)).getFullYear();
49-
var month = new Date(parseInt(params.currDate)).getMonth() + 1;
50-
var date = new Date(parseInt(params.currDate)).getDate();
51-
return moment(month + "-" + date + "-" + "-" + year, "MM-DD-YYYY").week();
49+
return moment().week();
5250
},
5351

5452
getMonthOfYear: (params) => {
55-
params.currDate = Date.now();
56-
var month = new Date(parseInt(params.currDate)).getMonth() + 1;
57-
return month;
53+
return moment().month() + 1;
5854
},
5955

6056
validatePincode: (pin) => {
6157
return /^(\d{4}|\d{6})$/.test(pin);
6258
},
6359
};
6460

65-
module.exports = Valiadtors;
61+
module.exports = Validators;

config/db.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// import mongoose from "mongoose";
1+
import mongoose from "mongoose";
2+
23
const mongoose = require("mongoose");
34

45
const connectDB = async () => {

middleware/morgan/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// import morgan from "morgan";
1+
import morgan from "morgan";
22
const morgan = require("morgan");
33

4-
// import logger from "../../common/logger";
4+
import logger from "../../common/logger";
55
const logger = require("../../common/logger");
66

77
logger.stream = {

package-lock.json

Lines changed: 106 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"request": "^2.88.2",
3131
"strategy": "^1.1.1",
3232
"twilio": "^3.82.1",
33+
"user-auth-microservice": "^3.1.0",
3334
"uuid": "^7.0.3",
3435
"winston": "^3.8.2"
3536
},

0 commit comments

Comments
 (0)