(
id: string,
options?: { includeDeleted?: boolean }
)
| 209 | * Get file metadata by ID |
| 210 | */ |
| 211 | export async function getFileMetadataById( |
| 212 | id: string, |
| 213 | options?: { includeDeleted?: boolean } |
| 214 | ): Promise<FileMetadataRecord | null> { |
| 215 | const { includeDeleted = false } = options ?? {} |
| 216 | const conditions = [eq(workspaceFiles.id, id)] |
| 217 | if (!includeDeleted) conditions.push(isNull(workspaceFiles.deletedAt)) |
| 218 | const [record] = await db |
| 219 | .select() |
| 220 | .from(workspaceFiles) |
| 221 | .where(conditions.length > 1 ? and(...conditions) : conditions[0]) |
| 222 | .limit(1) |
| 223 | return record ?? null |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * Delete file metadata by key |
no test coverage detected