mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-26 21:39:43 +02:00
fix(zero):scope content workspace queries
This commit is contained in:
parent
737d63f3dc
commit
be95f65c6b
3 changed files with 20 additions and 11 deletions
|
|
@ -3,7 +3,10 @@ import { z } from "zod";
|
|||
import { zql } from "../schema/index";
|
||||
|
||||
export const notificationQueries = {
|
||||
byUser: defineQuery(z.object({ userId: z.string() }), ({ args: { userId } }) =>
|
||||
zql.notifications.where("userId", userId).orderBy("createdAt", "desc")
|
||||
),
|
||||
byUser: defineQuery(z.object({ userId: z.string() }), ({ args: { userId }, ctx }) => {
|
||||
if (!ctx?.userId || userId !== ctx.userId) {
|
||||
return zql.notifications.where("userId", "__none__").orderBy("createdAt", "desc");
|
||||
}
|
||||
return zql.notifications.where("userId", ctx.userId).orderBy("createdAt", "desc");
|
||||
}),
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue