Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
53386e3974
|
@ -1,5 +1,4 @@
|
||||||
const Imap = require('imap');
|
const Imap = require('imap');
|
||||||
const {NULL} = require('node-sass');
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethod('checkInbox', {
|
Self.remoteMethod('checkInbox', {
|
||||||
description: 'Check an email inbox and process it',
|
description: 'Check an email inbox and process it',
|
||||||
|
@ -91,7 +90,6 @@ module.exports = Self => {
|
||||||
};
|
};
|
||||||
|
|
||||||
async function emailConfirm(buffer) {
|
async function emailConfirm(buffer) {
|
||||||
console.log('buffer', buffer);
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const from = JSON.stringify(Imap.parseHeader(buffer).from);
|
const from = JSON.stringify(Imap.parseHeader(buffer).from);
|
||||||
const subject = JSON.stringify(Imap.parseHeader(buffer).subject);
|
const subject = JSON.stringify(Imap.parseHeader(buffer).subject);
|
||||||
|
@ -102,7 +100,7 @@ module.exports = Self => {
|
||||||
const user = await getUser(from);
|
const user = await getUser(from);
|
||||||
let workerMail;
|
let workerMail;
|
||||||
|
|
||||||
if (user.id != NULL) {
|
if (user.id != null) {
|
||||||
workerMail = await Self.app.models.WorkerTimeControlMail.findOne({
|
workerMail = await Self.app.models.WorkerTimeControlMail.findOne({
|
||||||
where: {
|
where: {
|
||||||
week: week,
|
week: week,
|
||||||
|
@ -111,7 +109,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (workerMail != NULL) {
|
if (workerMail != null) {
|
||||||
await workerMail.updateAttributes({
|
await workerMail.updateAttributes({
|
||||||
updated: now,
|
updated: now,
|
||||||
state: 'CONFIRMED'
|
state: 'CONFIRMED'
|
||||||
|
@ -120,8 +118,6 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function emailReply(buffer, emailBody) {
|
async function emailReply(buffer, emailBody) {
|
||||||
console.log('buffer', buffer);
|
|
||||||
console.log('emailBody', emailBody);
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const from = JSON.stringify(Imap.parseHeader(buffer).from);
|
const from = JSON.stringify(Imap.parseHeader(buffer).from);
|
||||||
const subject = JSON.stringify(Imap.parseHeader(buffer).subject);
|
const subject = JSON.stringify(Imap.parseHeader(buffer).subject);
|
||||||
|
@ -132,7 +128,7 @@ module.exports = Self => {
|
||||||
const user = await getUser(from);
|
const user = await getUser(from);
|
||||||
let workerMail;
|
let workerMail;
|
||||||
|
|
||||||
if (user.id != NULL) {
|
if (user.id != null) {
|
||||||
workerMail = await Self.app.models.WorkerTimeControlMail.findOne({
|
workerMail = await Self.app.models.WorkerTimeControlMail.findOne({
|
||||||
where: {
|
where: {
|
||||||
week: week,
|
week: week,
|
||||||
|
@ -141,7 +137,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (workerMail != NULL) {
|
if (workerMail != null) {
|
||||||
await workerMail.updateAttributes({
|
await workerMail.updateAttributes({
|
||||||
updated: now,
|
updated: now,
|
||||||
state: 'REVISE',
|
state: 'REVISE',
|
||||||
|
|
Loading…
Reference in New Issue