Files
TasGrid/public/loading_data_from_Prism.md
T
2026-03-06 18:50:21 -06:00

45 lines
2.4 KiB
Markdown

# Accessing Job Files from Sister App
This plan outlines how a sister application can access job data and physical files managed by Prism.
## Proposed Strategy
### 1. Accessing Job Metadata (Database)
The source of truth for all job information (names, numbers, addresses, and file paths) is the PocketBase instance.
**Recommendation: Direct PocketBase SDK Integration**
- The sister app should use the [PocketBase JavaScript/TypeScript SDK](https://github.com/pocketbase/js-sdk).
- Point the SDK to the same URL as Prism (e.g., `http://127.0.0.1:8090` or your production domain).
- **Authentication**: The sister app will need its own authentication or a way to share the `pb_auth` token.
### 2. Accessing Physical Files (NAS/Local Folders)
Prism uses two types of file links:
- **`Job_Folder_Link`**: URLs (SharePoint, OneDrive, etc.). These can be opened directly as `<a>` tags or via `window.open()`.
- **`Folder_Local`**: UNC paths (e.g., `\\server\share\folder`).
**Recommendation: Shared Local RPC Tool**
- Prism currently uses a local helper running on `http://localhost:8080` to open folders in File Explorer.
- The sister app can use the exact same logic found in [nasOpener.ts](file:///c:/Users/TimothyCardoza/Documents/AI-Apps/Prism/PRISM/src/lib/nasOpener.ts) to communicate with this tool.
- This allows both apps to provide a seamless "Open Folder" experience on the same machine.
### 3. Proposed API Enhancements (Optional)
If the sister app cannot talk to PocketBase directly (e.g., security restrictions), we can add a "Service Account" or "API Key" mechanism to Prism to proxy requests.
## Proposed Changes
### [Component Name]
No changes are strictly required to Prism's code unless you want a dedicated API for the sister app.
#### [MODIFY] [nasOpener.ts](file:///c:/Users/TimothyCardoza/Documents/AI-Apps/Prism/PRISM/src/lib/nasOpener.ts)
- Potentially export the RPC URL as a shared constant if both apps are in the same monorepo or share a library.
## Verification Plan
### Automated Tests
- Test that the sister app can fetch job data from PocketBase using the same collection names (`Job_Info_Prod`).
- Verify that `http://localhost:8080/health` is reachable from the sister app's environment.
### Manual Verification
- Attempt to open a job folder from the sister app and confirm it opens in the local system's File Explorer.
- Confirm that the sister app correctly resolves job IDs to their respective `Job_Number` or metadata.