File size: 608 Bytes
a8f4b72
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import { SnapshotRepository } from '@projectos/storage-fabric/sqlite/repositories';
import type { DatabaseSync } from 'node:sqlite';

export class SnapshotService {
  readonly repository: SnapshotRepository;
  constructor(db: DatabaseSync, repository = new SnapshotRepository(db)) { this.repository = repository; }
  capture(projectId: string, options: Parameters<SnapshotRepository['create']>[1] = {}) { return this.repository.create(projectId, options); }
  get(snapshotId: string) { return this.repository.get(snapshotId); }
  restore(snapshotId: string) { return this.repository.restore(snapshotId); }
}