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
COPY ./package*.json ./
COPY ./.npmrc ./

4
app.js
View File

@ -19,7 +19,7 @@ const cors = require("cors");
const authenticate = require("./src/middlewares/auth.middlewares");
// Internal Requires
const version = require("./src/configs/version.configs");/*
const version = require("./src/configs/version.configs");
const listRtr = require("./src/routes/list.routes");
const ldbRtr = require("./src/routes/ldb.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 statRtr = require("./src/routes/stats.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 pis2Rtr = require("./src/routes/pis2.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");
import { logger } from "../utils/logger.utils";
@ -19,30 +20,25 @@ async function processor(data) {
}
async function sendToGitea(body) {
try {
const key = process.env.OWL_GIT_ISSUEBOT;
const url = process.env.OWL_GIT_APIENDPOINT;
const opts = {
let key = process.env.OWL_GIT_ISSUEBOT;
let url = process.env.OWL_GIT_APIENDPOINT;
let opts = {
method: "POST",
headers: {
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);
if (res.status === 201) {
logger.debug("issueService.sendToGitea: Issue created");
return {status: res.status, message: "issue created"};
/* Need to read the output from the POST and pass the result upwards to the
client.*/
if (res.status == 201) {
logger.info("issueService.sendToGitea: Issue sent to Gitea");
return { status: res.status, message: "issue created" };
} else {
logger.error(`issueService.sendtoGitea: Error creating issue RETURN: ${res.status}`);
return {status: res.status, message: "issue not created"};
}
} catch (err) {
logger.error(err, `issueService.sendToGitea`);
return {status:500, message: "Internal Server Error"};
logger.error(res.body, "issueService.sendToGitea: Fail to send issue");
return { status: res.status, message: "issue not created" };
}
}