misc: addressed type

This commit is contained in:
Sheen Capadngan
2025-05-17 22:39:43 +08:00
parent 56b7328231
commit 260679b01d
3 changed files with 25 additions and 38 deletions
@@ -6,9 +6,15 @@ import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
import { CaStatus, CaType } from "@app/services/certificate-authority/certificate-authority-enums";
import { TCertificateAuthority } from "@app/services/certificate-authority/certificate-authority-types";
import {
TCertificateAuthority,
TCertificateAuthorityInput
} from "@app/services/certificate-authority/certificate-authority-types";
export const registerCertificateAuthorityEndpoints = <T extends TCertificateAuthority>({
export const registerCertificateAuthorityEndpoints = <
T extends TCertificateAuthority,
I extends TCertificateAuthorityInput
>({
server,
caType,
createSchema,
@@ -21,13 +27,13 @@ export const registerCertificateAuthorityEndpoints = <T extends TCertificateAuth
name: string;
projectId: string;
status: CaStatus;
configuration: T["configuration"];
configuration: I["configuration"];
disableDirectIssuance: boolean;
}>;
updateSchema: z.ZodType<{
name?: string;
status?: CaStatus;
configuration?: T["configuration"];
configuration?: I["configuration"];
disableDirectIssuance?: boolean;
}>;
responseSchema: z.ZodTypeAny;
@@ -53,17 +53,16 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
req.permission
);
// await server.services.auditLog.createAuditLog({
// ...req.auditLogInfo,
// projectId: ca.projectId,
// event: {
// type: EventType.GET_CA,
// metadata: {
// caId: ca.id,
// dn: ca.dn
// }
// }
// });
await server.services.auditLog.createAuditLog({
...req.auditLogInfo,
projectId: req.query.projectId,
event: {
type: EventType.GET_CAS,
metadata: {
caIds: [...(internalCas ?? []).map((ca) => ca.id), ...(acmeCas ?? []).map((ca) => ca.id)]
}
}
});
return {
certificateAuthorities: [...(internalCas ?? []), ...(acmeCas ?? [])]