another fix

This commit is contained in:
Ryahn 2025-01-27 19:24:20 -05:00
parent ccba392ca0
commit 7c0ff8130b
2 changed files with 17 additions and 1 deletions

View File

@ -18,6 +18,23 @@ class Message extends BaseModel {
}
};
}
$beforeUpdate() {
this.updated_at = this.formatDateForMySQL(new Date());
this.received_at = this.formatDateForMySQL(new Date());
this.created_at = this.formatDateForMySQL(new Date());
}
async $beforeInsert() {
await super.$beforeInsert();
this.updated_at = this.formatDateForMySQL(new Date());
this.received_at = this.formatDateForMySQL(new Date());
this.created_at = this.formatDateForMySQL(new Date());
}
formatDateForMySQL(date) {
return date.toISOString().slice(0, 19).replace('T', ' ');
}
}
module.exports = Message;

View File

@ -33,7 +33,6 @@ exports.register = function () {
subject: subject,
body: body,
headers: headers,
domain: transaction.rcpt_to[0].host,
};
await MessageService.store(messageData);