@a11ywatch/core
Version:
a11ywatch central API
21 lines • 1.32 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateIssues = void 0;
const find_1 = require("../find");
const updateIssues = ({ userId, url, issuesCount, issues }) => __awaiter(void 0, void 0, void 0, function* () {
const [siteExist, collection] = yield (0, find_1.getIssue)({ userId, url }, true);
const issue = Object.assign(Object.assign({}, siteExist), { issuesCount: issuesCount || issues.count, issues });
yield collection.updateOne({ url, userId }, { $set: { issuesCount, issues } });
return issue;
});
exports.updateIssues = updateIssues;
//# sourceMappingURL=index.js.map
;