feat(api, web): enhance health check and domain management features
Build, Test, and Push CFDM Docker Image / test (push) Successful in 3m3s
Build, Test, and Push CFDM Docker Image / build-and-push (push) Successful in 1m48s
Build, Test, and Push CFDM Docker Image / update-wiki (push) Successful in 6s
Build, Test, and Push CFDM Docker Image / create-release (push) Has been skipped
Build, Test, and Push CFDM Docker Image / test (push) Successful in 3m3s
Build, Test, and Push CFDM Docker Image / build-and-push (push) Successful in 1m48s
Build, Test, and Push CFDM Docker Image / update-wiki (push) Successful in 6s
Build, Test, and Push CFDM Docker Image / create-release (push) Has been skipped
- Integrated domain monitoring routes and bulk update functionality for domains in the API. - Improved health check service to include domain monitoring and logging of health status changes. - Updated web components to reflect health status with new HealthCheckBadge and enhanced domain filtering options. - Refactored domain service to support bulk updates and improved domain management capabilities. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
dd167a4fec
commit
64585ccd47
38 files changed
+4199
-677
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import type { FastifyInstance } from "fastify";
|
||||
import { updateDomainSchema } from "@cfdm/shared";
|
||||
import { bulkUpdateDomainsSchema, updateDomainSchema } from "@cfdm/shared";
|
||||
import { z } from "zod";
|
||||
import * as domainService from "../services/domain-service.js";
|
||||
|
||||
@@ -25,6 +25,20 @@ export async function domainRoutes(app: FastifyInstance) {
|
||||
);
|
||||
});
|
||||
|
||||
app.post("/domains/bulk", async (request) => {
|
||||
const body = bulkUpdateDomainsSchema.parse(request.body);
|
||||
const updated = domainService.bulkUpdateDomains(
|
||||
request.server.db,
|
||||
body.ids,
|
||||
{
|
||||
group_id: body.group_id,
|
||||
environment: body.environment,
|
||||
tags_add: body.tags_add,
|
||||
},
|
||||
);
|
||||
return { updated };
|
||||
});
|
||||
|
||||
app.get("/domains/:id", async (request) => {
|
||||
const { id } = request.params as { id: string };
|
||||
return domainService.getDomain(request.server.db, Number(id));
|
||||
@@ -33,14 +47,7 @@ export async function domainRoutes(app: FastifyInstance) {
|
||||
app.patch("/domains/:id", async (request) => {
|
||||
const { id } = request.params as { id: string };
|
||||
const body = updateDomainSchema.parse(request.body);
|
||||
const existing = domainService.getDomain(request.server.db, Number(id));
|
||||
return domainService.updateDomain(
|
||||
request.server.db,
|
||||
Number(id),
|
||||
body.group_id !== undefined ? body.group_id : existing.group_id,
|
||||
body.status ?? existing.status,
|
||||
body.cert_monitoring,
|
||||
);
|
||||
return domainService.updateDomain(request.server.db, Number(id), body);
|
||||
});
|
||||
|
||||
app.delete("/domains/:id", async (request) => {
|
||||
|
||||
Reference in new issue
Block a user