Compare commits

..

No commits in common. "e4bbc8af05343eb83591909a9acc252405f96d89" and "a87f2037829db3ba650be250c758ad6aef8f5c7e" have entirely different histories.

3 changed files with 23 additions and 27 deletions

View File

@ -1,4 +1,4 @@
FROM node:20 as builder FROM node:latest as builder
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY ./package*.json ./ COPY ./package*.json ./
COPY ./.npmrc ./ COPY ./.npmrc ./

4
app.js
View File

@ -19,7 +19,7 @@ const cors = require("cors");
const authenticate = require("./src/middlewares/auth.middlewares"); const authenticate = require("./src/middlewares/auth.middlewares");
// Internal Requires // Internal Requires
const version = require("./src/configs/version.configs");/* const version = require("./src/configs/version.configs");
const listRtr = require("./src/routes/list.routes"); const listRtr = require("./src/routes/list.routes");
const ldbRtr = require("./src/routes/ldb.routes"); const ldbRtr = require("./src/routes/ldb.routes");
const ldbsRtr = require("./src/routes/ldbs.routes"); const ldbsRtr = require("./src/routes/ldbs.routes");
@ -28,7 +28,7 @@ const findRtr = require("./src/routes/find.routes");
const issueRtr = require("./src/routes/issue.routes"); const issueRtr = require("./src/routes/issue.routes");
const statRtr = require("./src/routes/stats.routes"); const statRtr = require("./src/routes/stats.routes");
const regRtr = require("./src/routes/registration.routes"); const regRtr = require("./src/routes/registration.routes");
const pisRtr = require("./src/routes/pis.routes");*/ const pisRtr = require("./src/routes/pis.routes");
const trainRtr = require("./src/routes/train.routes"); const trainRtr = require("./src/routes/train.routes");
const pis2Rtr = require("./src/routes/pis2.routes"); // API Version 2 Routes const pis2Rtr = require("./src/routes/pis2.routes"); // API Version 2 Routes
const ref2Rtr = require("./src/routes/ref2.routes"); // API Version 2 Routes const ref2Rtr = require("./src/routes/ref2.routes"); // API Version 2 Routes

View File

@ -1,3 +1,4 @@
/* eslint-disable no-useless-escape */
//const axios = require("axios"); //const axios = require("axios");
import { logger } from "../utils/logger.utils"; import { logger } from "../utils/logger.utils";
@ -19,31 +20,26 @@ async function processor(data) {
} }
async function sendToGitea(body) { async function sendToGitea(body) {
try { let key = process.env.OWL_GIT_ISSUEBOT;
const key = process.env.OWL_GIT_ISSUEBOT; let url = process.env.OWL_GIT_APIENDPOINT;
const url = process.env.OWL_GIT_APIENDPOINT; let opts = {
const opts = {
method: "POST", method: "POST",
headers: { headers: {
Authorization: key, Authorization: key,
"Content-Type": "application/json",
}, },
body: JSON.stringify(body), body: body,
}; };
//var res = await axios.post(url, body, opts);
const res = await fetch(url, opts); const res = await fetch(url, opts);
/* Need to read the output from the POST and pass the result upwards to the
if (res.status === 201) { client.*/
logger.debug("issueService.sendToGitea: Issue created"); if (res.status == 201) {
logger.info("issueService.sendToGitea: Issue sent to Gitea");
return { status: res.status, message: "issue created" }; return { status: res.status, message: "issue created" };
} else { } else {
logger.error(`issueService.sendtoGitea: Error creating issue RETURN: ${res.status}`); logger.error(res.body, "issueService.sendToGitea: Fail to send issue");
return { status: res.status, message: "issue not created" }; return { status: res.status, message: "issue not created" };
} }
} catch (err) {
logger.error(err, `issueService.sendToGitea`);
return {status:500, message: "Internal Server Error"};
}
} }
module.exports = { module.exports = {