const q = require("q");
const findService = require('./FindService');

module.exports = {

  findAuditDocument: async (documentId, userId, options) => {
    options = options ? options : {};
    const result = DBProvider.auditService.findAuditDocumentQuery(documentId, options);
    const versions = await findService.findAll(result.query, userId, result.sortQuery, true, options);
    return versions.map(version => ({ versionId: version.systemHeader.versionId, createdDate: version.systemHeader.createdDate }));
  }
};