mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-04 21:32:39 +02:00
12 lines
331 B
TypeScript
12 lines
331 B
TypeScript
|
|
import { defineQuery } from "@rocicorp/zero";
|
||
|
|
import { z } from "zod";
|
||
|
|
import { zql } from "../schema/index";
|
||
|
|
|
||
|
|
export const userQueries = {
|
||
|
|
me: defineQuery(z.object({}), ({ ctx }) => {
|
||
|
|
const userId = ctx?.userId;
|
||
|
|
if (!userId) return zql.user.where("id", "__none__").one();
|
||
|
|
return zql.user.where("id", userId).one();
|
||
|
|
}),
|
||
|
|
};
|