A11yWatch/a11ywatch-core

View on GitHub
src/core/controllers/issues/update/index.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { getIssue } from "../find";

export const updateIssues = async ({ userId, url, issuesCount, issues }) => {
  const [siteExist, collection] = await getIssue({ userId, url }, true);

  const issue = {
    ...siteExist,
    issuesCount: issuesCount || issues.count,
    issues,
  };

  await collection.updateOne(
    { url, userId },
    { $set: { issuesCount, issues } }
  );

  return issue;
};