All files / src/server/api audit.ts

100% Statements 3/3
100% Branches 0/0
100% Functions 3/3
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16          5x     5x       5x      
import type { Database } from "@/lib/db";
import type { AuditLog } from "@/types";
import { AuditLogRepository } from "@/server/repositories/implementations/AuditLogRepository";
 
export class AuditController {
  constructor(private auditRepo: AuditLogRepository) {}
 
  static fromDb(db: Database): AuditController {
    return new AuditController(new AuditLogRepository(db));
  }
 
  async listByCollection(collectionId: string, opts?: { limit?: number }): Promise<AuditLog[]> {
    return this.auditRepo.findByCollection(collectionId, opts);
  }
}