import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { TaskActivityAudit } from './task_activity_audit.entity';
import { TaskActivityAuditRecord, TaskActivityAuditStore } from './task_activity_audit.store';

@Injectable()
export class TaskActivityAuditDatabaseService implements TaskActivityAuditStore {
  constructor(
    @InjectRepository(TaskActivityAudit)
    private readonly repository: Repository<TaskActivityAudit>,
  ) {}

  async append(record: TaskActivityAuditRecord): Promise<void> {
    await this.repository.insert(record);
  }
}
