|
|
|
@ -173,12 +173,12 @@ exports.friendRequest = async (request, reply) => {
|
|
|
|
|
const existingRequest = await FriendRequest.findOne({ customerId: sender.customerId, supplierId: receiver.supplierId});
|
|
|
|
|
|
|
|
|
|
if (existingRequest) {
|
|
|
|
|
existingRequest.timestamp = moment().tz('Asia/Kolkata').format("DD-MM-YYYY hh:mm:ss");
|
|
|
|
|
existingRequest.timestamp = moment().tz('Asia/Kolkata').format("DD-MM-YYYY HH:mm:ss");
|
|
|
|
|
|
|
|
|
|
await existingRequest.save();
|
|
|
|
|
reply.send({ timestamp: existingRequest.timestamp, message: 'Friend request sent again' });
|
|
|
|
|
} else {
|
|
|
|
|
const timestamp = moment().tz('Asia/Kolkata').format("DD-MM-YYYY hh:mm:ss");
|
|
|
|
|
const timestamp = moment().tz('Asia/Kolkata').format("DD-MM-YYYY HH:mm:ss");
|
|
|
|
|
|
|
|
|
|
const friendRequest = new FriendRequest({
|
|
|
|
|
customerId: sender.customerId,
|
|
|
|
@ -192,7 +192,7 @@ exports.friendRequest = async (request, reply) => {
|
|
|
|
|
const rule = new schedule.RecurrenceRule();
|
|
|
|
|
rule.hour = new schedule.Range(0, 23, 5); // Run every 5 hours
|
|
|
|
|
schedule.scheduleJob(rule, async function() {
|
|
|
|
|
const timestamp = moment().tz('Asia/Kolkata').format("DD-MM-YYYY hh:mm:ss");
|
|
|
|
|
const timestamp = moment().tz('Asia/Kolkata').format("DD-MM-YYYY HH:mm:ss");
|
|
|
|
|
const newFriendRequest = new FriendRequest({
|
|
|
|
|
customerId: sender.customerId,
|
|
|
|
|
supplierId: receiver.supplierId,
|
|
|
|
|