newStaffLDB-API #48

Merged
fred.boniface merged 85 commits from newStaffLDB-API into main 2023-10-03 21:35:03 +01:00
1 changed files with 4 additions and 4 deletions
Showing only changes of commit d395b65512 - Show all commits

View File

@ -1,6 +1,6 @@
/* eslint-disable no-useless-escape */
const axios = require("axios");
const log = require("../utils/logs.utils");
import { logger } from "../utils/logger.utils";
const issueLabels = {
bug: 120,
@ -11,7 +11,7 @@ const issueLabels = {
};
async function processor(data) {
log.out("issueService.processor: Issue received", "info");
logger.debug("issueService.processor: Issue received");
let out = {};
out.labels = [issueLabels[data?.label] || 0, issueLabels["web-user"]];
out.title = data?.subject.replace(/<[^>]+>|[\*\$]/g, "");
@ -31,10 +31,10 @@ async function sendToGitea(body) {
/* Need to read the output from the POST and pass the result upwards to the
client.*/
if (res.status == 201) {
log.out("issueService.sendToGitea: Issue sent to Gitea", "info");
logger.info("issueService.sendToGitea: Issue sent to Gitea");
return { status: res.status, message: "issue created" };
} else {
log.out(`issueService.sendToGitea: Fail to send issue: ${res.body}`, "err");
logger.error(res.body, "issueService.sendToGitea: Fail to send issue");
return { status: res.status, message: "issue not created" };
}
}