( uuid: string )
| 183 | } |
| 184 | |
| 185 | export async function getFileMappingByUuid( |
| 186 | uuid: string |
| 187 | ): Promise<FileMappingDocType | null> { |
| 188 | const db = await getTaskyonDB(); |
| 189 | |
| 190 | // Find the document with the matching UUID |
| 191 | const fileMappingDoc = await db.filemappings.findOne(uuid).exec(); |
| 192 | |
| 193 | // Check if the document exists |
| 194 | if (!fileMappingDoc) { |
| 195 | console.log(`No file mapping found for UUID: ${uuid}`); |
| 196 | return null; |
| 197 | } |
| 198 | |
| 199 | // Return the found document |
| 200 | return { |
| 201 | uuid: fileMappingDoc.uuid, |
| 202 | opfs: fileMappingDoc.opfs, |
| 203 | openAIFileId: fileMappingDoc.openAIFileId, |
| 204 | }; |
| 205 | } |
| 206 | |
| 207 | export async function getFile(uuid: string) { |
| 208 | const fileMap = await getFileMappingByUuid(uuid); |
no test coverage detected