Download packages/api/src/lib/visibility.ts from Atmint/cpns: direct link, hf CLI and curl.
- Browser
- Download file 367 Bytes
-
https://huggingface.co/spaces/Atmint/cpns/resolve/main/packages/api/src/lib/visibility.ts
- Command line
-
hf download hf://spaces/Atmint/cpns/packages/api/src/lib/visibility.ts
-
curl -L -o visibility.ts https://huggingface.co/spaces/Atmint/cpns/resolve/main/packages/api/src/lib/visibility.ts
367 Bytes
| import { eq, or, SQL } from "drizzle-orm"; | |
| interface VisibilityTable { | |
| isPublic: any; | |
| creatorUserId: any; | |
| } | |
| export function buildVisibilityCondition<T extends VisibilityTable>( | |
| table: T, | |
| userId?: string, | |
| ): SQL | undefined { | |
| if (!userId) { | |
| return eq(table.isPublic, true); | |
| } | |
| return or(eq(table.isPublic, true), eq(table.creatorUserId, userId)); | |
| } | |