Data layer: return null if id not in database, not empty model
This commit is contained in:
@@ -254,6 +254,10 @@ async function _removeMessages(ids) {
|
||||
|
||||
async function getMessageById(id, { Message }) {
|
||||
const message = await channels.getMessageById(id);
|
||||
if (!message) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Message(message);
|
||||
}
|
||||
|
||||
@@ -352,6 +356,10 @@ async function getAllUnprocessed() {
|
||||
|
||||
async function getUnprocessedById(id, { Unprocessed }) {
|
||||
const unprocessed = await channels.getUnprocessedById(id);
|
||||
if (!unprocessed) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Unprocessed(unprocessed);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user