| 569 | // ----------------------------------------------------------------------------- |
| 570 | |
| 571 | export interface TenantStore { |
| 572 | // Organizations |
| 573 | createOrganization(name: string): Organization; |
| 574 | getOrganization(id: string): Organization | undefined; |
| 575 | |
| 576 | // Users |
| 577 | createUser(email: string, orgId: string, role?: UserRole): User; |
| 578 | getUser(id: string): User | undefined; |
| 579 | getUserByEmail(email: string): User | undefined; |
| 580 | getUsersByOrg(orgId: string): User[]; |
| 581 | |
| 582 | // API Keys |
| 583 | createApiKey(userId: string, name: string, expiresAt?: string): { apiKey: ApiKey; rawKey: string }; |
| 584 | getApiKeyByHash(hash: string): ApiKey | undefined; |
| 585 | listApiKeys(userId: string): ApiKey[]; |
| 586 | deleteApiKey(id: string): boolean; |
| 587 | updateApiKeyLastUsed(id: string): void; |
| 588 | |
| 589 | // User-scoped sessions |
| 590 | createSessionForUser(userId: string, url: string, projectId?: string): Session; |
| 591 | listSessionsForUser(userId: string): Session[]; |
| 592 | getSessionForUser(userId: string, sessionId: string): Session | undefined; |
| 593 | getSessionWithAnnotationsForUser(userId: string, sessionId: string): SessionWithAnnotations | undefined; |
| 594 | |
| 595 | // User-scoped annotations |
| 596 | getPendingAnnotationsForUser(userId: string, sessionId: string): Annotation[]; |
| 597 | getAllPendingForUser(userId: string): Annotation[]; |
| 598 | |
| 599 | // Lifecycle |
| 600 | close(): void; |
| 601 | } |
| 602 | |
| 603 | // ----------------------------------------------------------------------------- |
| 604 | // Tenant Store Implementation |
no outgoing calls
no test coverage detected
searching dependent graphs…