Fix SQL query

pull/5817/head
Chocobozzz 2023-05-12 09:06:16 +02:00
parent 5752683ea5
commit 65b2ec673d
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 6 additions and 6 deletions

View File

@ -311,7 +311,7 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo
if (t.host) { if (t.host) {
return { return {
[Op.and]: [ [Op.and]: [
ActorModel.wherePreferredUsername(t.name, '$preferredUsername$'), ActorModel.wherePreferredUsername(t.name),
{ $host$: t.host } { $host$: t.host }
] ]
} }
@ -319,7 +319,7 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo
return { return {
[Op.and]: [ [Op.and]: [
ActorModel.wherePreferredUsername(t.name, '$preferredUsername$'), ActorModel.wherePreferredUsername(t.name),
{ $serverId$: null } { $serverId$: null }
] ]
} }

View File

@ -381,7 +381,7 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {
const query = { const query = {
where: { where: {
[Op.and]: [ [Op.and]: [
this.wherePreferredUsername(preferredUsername), this.wherePreferredUsername(preferredUsername, '"ActorModel"."preferredUsername"'),
{ {
serverId: null serverId: null
} }
@ -431,7 +431,7 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {
static loadByNameAndHost (preferredUsername: string, host: string): Promise<MActorFull> { static loadByNameAndHost (preferredUsername: string, host: string): Promise<MActorFull> {
const query = { const query = {
where: this.wherePreferredUsername(preferredUsername), where: this.wherePreferredUsername(preferredUsername, '"ActorModel"."preferredUsername"'),
include: [ include: [
{ {
model: ServerModel, model: ServerModel,

View File

@ -702,7 +702,7 @@ export class VideoChannelModel extends Model<Partial<AttributesOnly<VideoChannel
required: true, required: true,
where: { where: {
[Op.and]: [ [Op.and]: [
ActorModel.wherePreferredUsername(name), ActorModel.wherePreferredUsername(name, 'Actor.preferredUsername'),
{ serverId: null } { serverId: null }
] ]
}, },
@ -728,7 +728,7 @@ export class VideoChannelModel extends Model<Partial<AttributesOnly<VideoChannel
{ {
model: ActorModel, model: ActorModel,
required: true, required: true,
where: ActorModel.wherePreferredUsername(name), where: ActorModel.wherePreferredUsername(name, 'Actor.preferredUsername'),
include: [ include: [
{ {
model: ServerModel, model: ServerModel,