Data layer: return null if id not in database, not empty model
This commit is contained in:
parent
c88df69094
commit
8c8475076b
1 changed files with 8 additions and 0 deletions
|
@ -254,6 +254,10 @@ async function _removeMessages(ids) {
|
||||||
|
|
||||||
async function getMessageById(id, { Message }) {
|
async function getMessageById(id, { Message }) {
|
||||||
const message = await channels.getMessageById(id);
|
const message = await channels.getMessageById(id);
|
||||||
|
if (!message) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return new Message(message);
|
return new Message(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,6 +356,10 @@ async function getAllUnprocessed() {
|
||||||
|
|
||||||
async function getUnprocessedById(id, { Unprocessed }) {
|
async function getUnprocessedById(id, { Unprocessed }) {
|
||||||
const unprocessed = await channels.getUnprocessedById(id);
|
const unprocessed = await channels.getUnprocessedById(id);
|
||||||
|
if (!unprocessed) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return new Unprocessed(unprocessed);
|
return new Unprocessed(unprocessed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue