Compare commits
3 Commits
5469a0dc5c
...
880902c478
| Author | SHA1 | Date | |
|---|---|---|---|
| 880902c478 | |||
| 100c9ff9be | |||
| a8af021621 |
13
backend/opendock/opendock.routes.ts
Normal file
13
backend/opendock/opendock.routes.ts
Normal 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);
|
||||
};
|
||||
34
backend/opendock/opendockGetRelease.route.ts
Normal file
34
backend/opendock/opendockGetRelease.route.ts
Normal 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;
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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
9
brunoApi/bruno.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"version": "1",
|
||||
"name": "lst_v3",
|
||||
"type": "collection",
|
||||
"ignore": [
|
||||
"node_modules",
|
||||
".git"
|
||||
]
|
||||
}
|
||||
16
brunoApi/datamart/Get queries.bru
Normal file
16
brunoApi/datamart/Get queries.bru
Normal 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
|
||||
}
|
||||
31
brunoApi/datamart/add new query.bru
Normal file
31
brunoApi/datamart/add new query.bru
Normal 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
|
||||
}
|
||||
8
brunoApi/datamart/folder.bru
Normal file
8
brunoApi/datamart/folder.bru
Normal file
@@ -0,0 +1,8 @@
|
||||
meta {
|
||||
name: datamart
|
||||
seq: 2
|
||||
}
|
||||
|
||||
auth {
|
||||
mode: inherit
|
||||
}
|
||||
20
brunoApi/datamart/sync queries.bru
Normal file
20
brunoApi/datamart/sync queries.bru
Normal 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
|
||||
}
|
||||
28
brunoApi/datamart/update new query.bru
Normal file
28
brunoApi/datamart/update new query.bru
Normal 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
|
||||
}
|
||||
3
brunoApi/environments/lstv3.bru
Normal file
3
brunoApi/environments/lstv3.bru
Normal file
@@ -0,0 +1,3 @@
|
||||
vars {
|
||||
url: http://localhost:3000
|
||||
}
|
||||
15
brunoApi/opendock/GetApt.bru
Normal file
15
brunoApi/opendock/GetApt.bru
Normal file
@@ -0,0 +1,15 @@
|
||||
meta {
|
||||
name: GetApt
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url:
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
}
|
||||
16
brunoApi/system/Status.bru
Normal file
16
brunoApi/system/Status.bru
Normal 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
|
||||
}
|
||||
16
brunoApi/utils/Active Jobs.bru
Normal file
16
brunoApi/utils/Active Jobs.bru
Normal 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
|
||||
}
|
||||
22
brunoApi/utils/Change status.bru
Normal file
22
brunoApi/utils/Change status.bru
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user