Get all badges not just owned

This commit is contained in:
Kalle
2022-07-02 11:29:55 +03:00
parent c9c53bc4c5
commit 00225645fc

View File

@@ -19,13 +19,9 @@ export function countsByUserId(userId: User["id"]) {
return countsByUserIdStm.all({ userId }) as CountsByUserId;
}
// xxx: make it so that it returns all badges not just owned
const allWithAtLeastOneOwnerStm = sql.prepare(`
select "Badge"."id", "Badge"."code", "Badge"."displayName"
from "Badge"
join "BadgeOwner" on "BadgeOwner"."badgeId" = "Badge"."id"
group by "Badge"."id"
having count("BadgeOwner"."userId") > 0
`);
export type AllWithAtLeastOneOwner = Array<