diff --git a/server/storage.ts b/server/storage.ts index 817ad26..ef37b85 100644 --- a/server/storage.ts +++ b/server/storage.ts @@ -1205,6 +1205,72 @@ As we continue to develop the Tercul platform, we're committed to addressing the return filtered; } + + // Analysis methods + async getAnalysisResultsByWorkId(workId: number): Promise { + return Array.from(this.analysisResults.values()).filter( + result => result.workId === workId + ); + } + + async getAnalysisResultById(id: number): Promise { + return this.analysisResults.get(id); + } + + async getAnalysisResultByWorkAndType(workId: number, type: string): Promise { + return Array.from(this.analysisResults.values()).find( + result => result.workId === workId && result.type === type + ); + } + + async createAnalysisResult(insertResult: InsertAnalysisResult): Promise { + const id = this.analysisResultId++; + const now = new Date(); + const result: AnalysisResult = { + ...insertResult, + id, + createdAt: now + }; + this.analysisResults.set(id, result); + return result; + } + + // Annotation methods + async getAnnotationsByWorkId(workId: number): Promise { + return Array.from(this.annotations.values()).filter( + annotation => annotation.workId === workId + ); + } + + async getAnnotationsByTranslationId(translationId: number): Promise { + return Array.from(this.annotations.values()).filter( + annotation => annotation.translationId === translationId + ); + } + + async getAnnotationsByLine(workId: number, lineNumber: number, translationId?: number): Promise { + return Array.from(this.annotations.values()).filter( + annotation => annotation.workId === workId && + annotation.lineNumber === lineNumber && + (translationId === undefined || annotation.translationId === translationId) + ); + } + + async getAnnotationById(id: number): Promise { + return this.annotations.get(id); + } + + async createAnnotation(insertAnnotation: InsertAnnotation): Promise { + const id = this.annotationId++; + const now = new Date(); + const annotation: Annotation = { + ...insertAnnotation, + id, + createdAt: now + }; + this.annotations.set(id, annotation); + return annotation; + } } // Now using JsonStorage instead of MemStorage