From dd5bd35ad405a1620390cb01bdf4c41bdb6c42ac Mon Sep 17 00:00:00 2001 From: Fang-Pen Lin Date: Wed, 29 Oct 2025 18:36:32 -0700 Subject: [PATCH] Fix ts --- backend/src/ee/routes/v1/pki-acme-router.ts | 13 ++++++++++--- .../src/ee/services/pki-acme/pki-acme-service.ts | 5 ++--- backend/src/ee/services/pki-acme/pki-acme-types.ts | 14 +++++++++----- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/backend/src/ee/routes/v1/pki-acme-router.ts b/backend/src/ee/routes/v1/pki-acme-router.ts index 24ae75ff5..e576eb306 100644 --- a/backend/src/ee/routes/v1/pki-acme-router.ts +++ b/backend/src/ee/routes/v1/pki-acme-router.ts @@ -198,9 +198,16 @@ export const registerPkiAcmeRouter = async (server: FastifyZodProvider) => { }, // TODO: replace with verify ACME signature here instead // onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]), - handler: async (req) => { - const result = await server.services.pkiAcme.deactivateAcmeAccount(req.params.profileId, req.params.accountId); - return result; + handler: async (req, res) => { + return sendAcmeResponse( + res, + req.params.profileId, + await server.services.pkiAcme.deactivateAcmeAccount({ + profileId: req.params.profileId, + accountId: req.params.accountId, + payload: req.body + }) + ); } }); diff --git a/backend/src/ee/services/pki-acme/pki-acme-service.ts b/backend/src/ee/services/pki-acme/pki-acme-service.ts index a72ef2b0f..6f35aa15d 100644 --- a/backend/src/ee/services/pki-acme/pki-acme-service.ts +++ b/backend/src/ee/services/pki-acme/pki-acme-service.ts @@ -303,9 +303,8 @@ export const pkiAcmeServiceFactory = ({ return { status: 201, body: { - status: "pending", - // TODO: read config from the profile to get the expiration time instead - expires: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString(), + status: order.status, + expires: order.expiresAt.toISOString(), identifiers: order.authorizations.map((auth: TPkiAcmeAuths) => ({ type: auth.identifierType, value: auth.identifierValue diff --git a/backend/src/ee/services/pki-acme/pki-acme-types.ts b/backend/src/ee/services/pki-acme/pki-acme-types.ts index 2a923d1a5..811d121ad 100644 --- a/backend/src/ee/services/pki-acme/pki-acme-types.ts +++ b/backend/src/ee/services/pki-acme/pki-acme-types.ts @@ -85,11 +85,15 @@ export type TPkiAcmeServiceFactory = { accountId: string; payload: TCreateAcmeOrderPayload; }) => Promise>; - deactivateAcmeAccount: ( - profileId: string, - accountId: string, - body?: TDeactivateAcmeAccountPayload - ) => Promise; + deactivateAcmeAccount: ({ + profileId, + accountId, + payload + }: { + profileId: string; + accountId: string; + payload?: TDeactivateAcmeAccountPayload; + }) => Promise>; listAcmeOrders: ({ profileId, accountId