This repository has no description
1.0 kB
29 lines
1import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
2import {
3 IGraphQueryRepository,
4 GraphDataDTO,
5} from '../../domain/IGraphQueryRepository';
6import { GraphQueryService } from './query-services/GraphQueryService';
7import { UrlGraphTraversalService } from './query-services/UrlGraphTraversalService';
8
9export class DrizzleGraphQueryRepository implements IGraphQueryRepository {
10 private graphQueryService: GraphQueryService;
11 private urlGraphTraversalService: UrlGraphTraversalService;
12
13 constructor(private db: PostgresJsDatabase) {
14 this.graphQueryService = new GraphQueryService(db);
15 this.urlGraphTraversalService = new UrlGraphTraversalService(db);
16 }
17
18 async getGraphData(
19 page?: number,
20 limit?: number,
21 userId?: string,
22 ): Promise<GraphDataDTO> {
23 return this.graphQueryService.getGraphData(page, limit, userId);
24 }
25
26 async getUrlSubGraph(url: string, depth: number): Promise<GraphDataDTO> {
27 return this.urlGraphTraversalService.getUrlSubGraph(url, depth);
28 }
29}