Skip to content

Commit 7b3cb67

Browse files
committed
Hotfix for broken query
1 parent f08a028 commit 7b3cb67

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

models/stream.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,17 @@ module.exports = (sequelize, DataTypes) => {
2828
// Assumes that the pastStream.source is "unique-enough";
2929
// However, we know that multiple streamers sometimes
3030
// use the same name to stream, e.g., Bear Gang, Concrete Reporting, Unicorn Riot, Boop Troop, etc.
31+
const matchingFilter = [
32+
{link: this.link},
33+
]
34+
if(this.source) {
35+
matchingFilter.push({ source: this.source })
36+
}
3137
const pastStream = await Stream.findOne({
3238
where: {
3339
[Op.and]: [
3440
{
35-
[Op.or]: [
36-
{ source: this.source },
37-
{ link: this.link },
38-
]
41+
[Op.or]: matchingFilter,
3942
},
4043
{
4144
[Op.or]: [

0 commit comments

Comments
 (0)