-
+
diff --git a/src/pages/api/payments/assigned.ts b/src/pages/api/payments/assigned.ts
index 107e619e..d15de946 100644
--- a/src/pages/api/payments/assigned.ts
+++ b/src/pages/api/payments/assigned.ts
@@ -30,16 +30,20 @@ async function get(req: NextApiRequest, res: NextApiResponse) {
return;
}
- const codeQuery = query(
- collection(db, "payments"),
- // where("agent", "==", "xRMirufz6PPQqxKBgvPTWiWKBD63"),
- where(req.session.user.type, "==", req.session.user.id)
- // Based on the logic of query we should be able to do this:
- // where("isPaid", "==", paid === "paid"),
- // but for some reason it is ignoring all but the first clause
- // I opted into only fetching relevant content for the user
- // and then filter it with JS
- );
+ // if it's an admin, don't apply query filters
+ const whereClauses = ["admin", "developer"].includes(req.session.user.type)
+ ? []
+ : [
+ // where("agent", "==", "xRMirufz6PPQqxKBgvPTWiWKBD63"),
+ where(req.session.user.type, "==", req.session.user.id),
+ // Based on the logic of query we should be able to do this:
+ // where("isPaid", "==", paid === "paid"),
+ // but for some reason it is ignoring all but the first clause
+ // I opted into only fetching relevant content for the user
+ // and then filter it with JS
+ ];
+
+ const codeQuery = query(collection(db, "payments"), ...whereClauses);
const snapshot = await getDocs(codeQuery);
if (snapshot.empty) {