3 Commits

Author SHA1 Message Date
880902c478 added bruno 2026-02-20 12:19:32 -06:00
100c9ff9be moved brunoapi stuff inside the app 2026-02-20 12:17:51 -06:00
a8af021621 added opendock apt check route 2026-02-20 12:17:39 -06:00
15 changed files with 236 additions and 2 deletions

View File

@@ -0,0 +1,13 @@
import { type Express, Router } from "express";
import { requireAuth } from "../middleware/auth.middleware.js";
import getApt from "./opendockGetRelease.route.js";
export const setupOpendockRoutes = (baseUrl: string, app: Express) => {
//setup all the routes
// Apply auth to entire router
const router = Router();
router.use(requireAuth);
router.use(getApt);
app.use(`${baseUrl}/api/opendock`, router);
};

View File

@@ -0,0 +1,34 @@
import { desc, lte, sql } from "drizzle-orm";
import { Router } from "express";
import { open } from "inspector/promises";
import { db } from "../db/db.controller.js";
import { opendockApt } from "../db/schema/opendock.schema.js";
import { apiReturn } from "../utils/returnHelper.utils.js";
import { tryCatch } from "../utils/trycatch.utils.js";
const r = Router();
r.get("/", async (_, res) => {
//const limit
const { data, error } = await tryCatch(
db
.select()
.from(opendockApt)
.where(lte(opendockApt.createdAt, sql.raw(`NOW() - INTERVAL '30 days'`)))
.orderBy(desc(opendockApt.createdAt))
.limit(500),
);
apiReturn(res, {
success: true,
level: "info",
module: "opendock",
subModule: "apt",
message: "The first x Apt",
data: data ?? [],
status: 200,
});
});
export default r;

View File

@@ -3,6 +3,7 @@ import { setupAuthRoutes } from "./auth/auth.routes.js";
// import the routes and route setups
import { setupApiDocsRoutes } from "./configs/scaler.config.js";
import { setupDatamartRoutes } from "./datamart/datamart.routes.js";
import { setupOpendockRoutes } from "./opendock/opendock.routes.js";
import { setupProdSqlRoutes } from "./prodSql/prodSql.routes.js";
import { setupSystemRoutes } from "./system/system.routes.js";
import { setupUtilsRoutes } from "./utils/utils.routes.js";
@@ -15,6 +16,7 @@ export const setupRoutes = (baseUrl: string, app: Express) => {
setupDatamartRoutes(baseUrl, app);
setupAuthRoutes(baseUrl, app);
setupUtilsRoutes(baseUrl, app);
setupOpendockRoutes(baseUrl, app);
// routes that get activated if the module is set to activated.

View File

@@ -3,7 +3,7 @@ import { createLogger } from "../logger/logger.controller.js";
interface Data {
success: boolean;
module: "system" | "ocp" | "routes" | "datamart" | "utils";
module: "system" | "ocp" | "routes" | "datamart" | "utils" | "opendock";
subModule:
| "db"
| "labeling"
@@ -13,7 +13,8 @@ interface Data {
| "sendmail"
| "auth"
| "datamart"
| "jobs";
| "jobs"
| "apt";
level: "info" | "error" | "debug" | "fatal";
message: string;
data?: unknown[];

9
brunoApi/bruno.json Normal file
View File

@@ -0,0 +1,9 @@
{
"version": "1",
"name": "lst_v3",
"type": "collection",
"ignore": [
"node_modules",
".git"
]
}

View File

@@ -0,0 +1,16 @@
meta {
name: Get queries
type: http
seq: 1
}
get {
url: {{url}}/lst/api/datamart/deliveryByDateRange
body: none
auth: inherit
}
settings {
encodeUrl: true
timeout: 0
}

View File

@@ -0,0 +1,31 @@
meta {
name: add new query
type: http
seq: 2
}
post {
url: {{url}}/lst/api/datamart
body: multipartForm
auth: inherit
}
body:json {
{
"name": "active av",
"description":"this is just the query on what it dose",
"query": "select * \nfrom tableA"
}
}
body:multipart-form {
name: sqlStats
description: returns all active articles for the server with custom data
options: ""
queryFile: @file(C:\Users\matthes01\Nextcloud2\sqlQuerys\basisArticles.sql)
}
settings {
encodeUrl: true
timeout: 0
}

View File

@@ -0,0 +1,8 @@
meta {
name: datamart
seq: 2
}
auth {
mode: inherit
}

View File

@@ -0,0 +1,20 @@
meta {
name: sync queries
type: http
seq: 4
}
get {
url: {{url}}/lst/api/datamart/sync?time=15
body: none
auth: inherit
}
params:query {
time: 15
}
settings {
encodeUrl: true
timeout: 0
}

View File

@@ -0,0 +1,28 @@
meta {
name: update new query
type: http
seq: 3
}
patch {
url: {{url}}/lst/api/datamart/f737aeba-186d-495f-a86e-57412ba6687e
body: multipartForm
auth: inherit
}
body:json {
{
"name": "active av",
"description":"this is just the query on what it dose",
"query": "select * \nfrom tableA"
}
}
body:multipart-form {
setPublicActive: true
}
settings {
encodeUrl: true
timeout: 0
}

View File

@@ -0,0 +1,3 @@
vars {
url: http://localhost:3000
}

View File

@@ -0,0 +1,15 @@
meta {
name: GetApt
type: http
seq: 1
}
get {
url:
body: none
auth: inherit
}
settings {
encodeUrl: true
}

View File

@@ -0,0 +1,16 @@
meta {
name: Status
type: http
seq: 1
}
get {
url: {{url}}/lst/api/stats
body: none
auth: inherit
}
settings {
encodeUrl: true
timeout: 0
}

View File

@@ -0,0 +1,16 @@
meta {
name: Active Jobs
type: http
seq: 5
}
get {
url: {{url}}/lst/api/utils/croner
body: none
auth: inherit
}
settings {
encodeUrl: true
timeout: 0
}

View File

@@ -0,0 +1,22 @@
meta {
name: Change status
type: http
seq: 2
}
patch {
url: {{url}}/lst/api/utils/croner/stop
body: json
auth: inherit
}
body:json {
{
"name": "open-dock-monitor"
}
}
settings {
encodeUrl: true
timeout: 0
}