newStaffLDB-API #48
@ -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" };
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user