mirror of
https://github.com/SamyRai/tercul-frontend.git
synced 2025-12-27 00:11:35 +00:00
Add ability to analyze content and create personal reading notes
Implements analysis result and annotation methods with in-memory storage for managing work analysis and user annotations. Replit-Commit-Author: Agent Replit-Commit-Session-Id: cbacfb18-842a-4116-a907-18c0105ad8ec Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/39b5c689-6e8a-4d5a-9792-69cc81a56534/6727ab9c-0666-4f48-a09c-58761e6a20ea.jpg
This commit is contained in:
parent
07e354075e
commit
14a42223a8
@ -12,7 +12,9 @@ import {
|
||||
collectionItems, CollectionItem, InsertCollectionItem,
|
||||
timelineEvents, TimelineEvent, InsertTimelineEvent,
|
||||
blogPosts, BlogPost, InsertBlogPost,
|
||||
readingProgress, ReadingProgress, InsertReadingProgress
|
||||
readingProgress, ReadingProgress, InsertReadingProgress,
|
||||
AnalysisResult, InsertAnalysisResult,
|
||||
Annotation, InsertAnnotation
|
||||
} from "@shared/schema";
|
||||
|
||||
export interface IStorage {
|
||||
@ -94,6 +96,19 @@ export interface IStorage {
|
||||
searchWorks(query: string, limit?: number): Promise<Work[]>;
|
||||
searchAuthors(query: string, limit?: number): Promise<Author[]>;
|
||||
filterWorks(params: { language?: string, type?: string, yearStart?: number, yearEnd?: number, tags?: number[] }): Promise<Work[]>;
|
||||
|
||||
// Analysis methods
|
||||
getAnalysisResultsByWorkId(workId: number): Promise<AnalysisResult[]>;
|
||||
getAnalysisResultById(id: number): Promise<AnalysisResult | undefined>;
|
||||
getAnalysisResultByWorkAndType(workId: number, type: string): Promise<AnalysisResult | undefined>;
|
||||
createAnalysisResult(result: InsertAnalysisResult): Promise<AnalysisResult>;
|
||||
|
||||
// Annotation methods
|
||||
getAnnotationsByWorkId(workId: number): Promise<Annotation[]>;
|
||||
getAnnotationsByTranslationId(translationId: number): Promise<Annotation[]>;
|
||||
getAnnotationsByLine(workId: number, lineNumber: number, translationId?: number): Promise<Annotation[]>;
|
||||
getAnnotationById(id: number): Promise<Annotation | undefined>;
|
||||
createAnnotation(annotation: InsertAnnotation): Promise<Annotation>;
|
||||
}
|
||||
|
||||
export class MemStorage implements IStorage {
|
||||
@ -112,6 +127,8 @@ export class MemStorage implements IStorage {
|
||||
private timelineEvents: Map<number, TimelineEvent>;
|
||||
private blogPosts: Map<number, BlogPost>;
|
||||
private readingProgresses: Map<string, ReadingProgress>;
|
||||
private analysisResults: Map<number, AnalysisResult>;
|
||||
private annotations: Map<number, Annotation>;
|
||||
|
||||
private userId: number = 1;
|
||||
private authorId: number = 1;
|
||||
@ -126,6 +143,8 @@ export class MemStorage implements IStorage {
|
||||
private timelineEventId: number = 1;
|
||||
private blogPostId: number = 1;
|
||||
private readingProgressId: number = 1;
|
||||
private analysisResultId: number = 1;
|
||||
private annotationId: number = 1;
|
||||
|
||||
constructor() {
|
||||
this.users = new Map();
|
||||
@ -143,6 +162,8 @@ export class MemStorage implements IStorage {
|
||||
this.timelineEvents = new Map();
|
||||
this.blogPosts = new Map();
|
||||
this.readingProgresses = new Map();
|
||||
this.analysisResults = new Map();
|
||||
this.annotations = new Map();
|
||||
|
||||
// Initialize with some data
|
||||
this.initializeData();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user