Fix insert and del

This commit is contained in:
Fang-Pen Lin
2025-11-21 10:19:26 -08:00
parent 924d029889
commit b4e16fa1f4
2 changed files with 4 additions and 2 deletions

View File

@@ -44,7 +44,6 @@ export const registerDNSMadeEasyConnectionRouter = async (server: FastifyZodProv
onRequest: verifyAuth([AuthMode.JWT]), onRequest: verifyAuth([AuthMode.JWT]),
handler: async (req) => { handler: async (req) => {
const { connectionId } = req.params; const { connectionId } = req.params;
const zones = await server.services.appConnection.dnsMadeEasy.listZones(connectionId, req.permission); const zones = await server.services.appConnection.dnsMadeEasy.listZones(connectionId, req.permission);
return zones; return zones;
} }

View File

@@ -5,6 +5,7 @@ import { request } from "@app/lib/config/request";
import { crypto } from "@app/lib/crypto/cryptography"; import { crypto } from "@app/lib/crypto/cryptography";
import { TDNSMadeEasyConnection } from "@app/services/app-connection/dns-made-easy/dns-made-easy-connection-types"; import { TDNSMadeEasyConnection } from "@app/services/app-connection/dns-made-easy/dns-made-easy-connection-types";
import { IntegrationUrls } from "@app/services/integration-auth/integration-list"; import { IntegrationUrls } from "@app/services/integration-auth/integration-list";
import { logger } from "@app/lib/logger";
const getDNSMadeEasyUrl = (path: string) => { const getDNSMadeEasyUrl = (path: string) => {
const appCfg = getConfig(); const appCfg = getConfig();
@@ -100,7 +101,7 @@ export const dnsMadeEasyDeleteTxtRecord = async (
if (Array.isArray(dnsRecords) && dnsRecords.length > 0) { if (Array.isArray(dnsRecords) && dnsRecords.length > 0) {
const recordToDelete = dnsRecords.find( const recordToDelete = dnsRecords.find(
(record) => record.type === "TXT" && record.name === domain && record.value === value (record) => record.type === "TXT" && record.name === domain && JSON.parse(record.value) === value
); );
if (recordToDelete) { if (recordToDelete) {
@@ -113,6 +114,8 @@ export const dnsMadeEasyDeleteTxtRecord = async (
} }
} }
); );
} else {
logger.warn({ domain, value }, `Record to delete not found for domain: ${domain} and value: ${value}`);
} }
} }
} catch (error) { } catch (error) {