diff --git a/app/features/img-upload/queries/countAllUnvalidatedImg.server.ts b/app/features/img-upload/queries/countAllUnvalidatedImg.server.ts index 20a6d41a6..f79ea6b09 100644 --- a/app/features/img-upload/queries/countAllUnvalidatedImg.server.ts +++ b/app/features/img-upload/queries/countAllUnvalidatedImg.server.ts @@ -2,7 +2,13 @@ import { sql } from "~/db/sql"; const stm = sql.prepare(/*sql*/ ` select count(*) as "count" from "UnvalidatedUserSubmittedImage" - where "validatedAt" is null + left join "Team" on + "UnvalidatedUserSubmittedImage"."id" = "Team"."avatarImgId" or + "UnvalidatedUserSubmittedImage"."id" = "Team"."bannerImgId" + left join "Art" on + "UnvalidatedUserSubmittedImage"."id" = "Art"."imgId" + where "UnvalidatedUserSubmittedImage"."validatedAt" is null + and ("Team"."id" is not null or "Art"."id" is not null) `); export function countAllUnvalidatedImg() { diff --git a/app/features/img-upload/queries/oneUnvalidatedImage.ts b/app/features/img-upload/queries/oneUnvalidatedImage.ts index 0240fc338..dc48bac62 100644 --- a/app/features/img-upload/queries/oneUnvalidatedImage.ts +++ b/app/features/img-upload/queries/oneUnvalidatedImage.ts @@ -7,7 +7,13 @@ const stm = sql.prepare(/* sql */ ` "UnvalidatedUserSubmittedImage"."url", "UnvalidatedUserSubmittedImage"."submitterUserId" from "UnvalidatedUserSubmittedImage" + left join "Team" on + "UnvalidatedUserSubmittedImage"."id" = "Team"."avatarImgId" or + "UnvalidatedUserSubmittedImage"."id" = "Team"."bannerImgId" + left join "Art" on + "UnvalidatedUserSubmittedImage"."id" = "Art"."imgId" where "UnvalidatedUserSubmittedImage"."validatedAt" is null + and ("Team"."id" is not null or "Art"."id" is not null) limit 1 `);