From c387671706fb52b17de25c39dcf9994ad153dd45 Mon Sep 17 00:00:00 2001 From: kayra1 Date: Thu, 21 Nov 2024 12:09:06 +0300 Subject: [PATCH] chore: rename frontend too --- internal/db/db.go | 12 ++++++------ .../app/(notary)/certificate_requests/table.test.tsx | 6 +++--- ui/src/app/(notary)/certificate_requests/table.tsx | 2 +- ui/src/types.ts | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/db/db.go b/internal/db/db.go index f7d0857..67ba0db 100644 --- a/internal/db/db.go +++ b/internal/db/db.go @@ -48,11 +48,11 @@ const queryCreateCertificateRequestsTable = ` certificate_chain TEXT DEFAULT '', status TEXT DEFAULT 'Outstanding', - CHECK (request_status IN ('Outstanding', 'Rejected', 'Revoked', 'Active')), - CHECK (NOT (certificate_chain == '' AND request_status == 'Active' )), - CHECK (NOT (certificate_chain != '' AND request_status == 'Outstanding')) - CHECK (NOT (certificate_chain != '' AND request_status == 'Rejected')) - CHECK (NOT (certificate_chain != '' AND request_status == 'Revoked')) + CHECK (status IN ('Outstanding', 'Rejected', 'Revoked', 'Active')), + CHECK (NOT (certificate_chain == '' AND status == 'Active' )), + CHECK (NOT (certificate_chain != '' AND status == 'Outstanding')) + CHECK (NOT (certificate_chain != '' AND status == 'Rejected')) + CHECK (NOT (certificate_chain != '' AND status == 'Revoked')) )` const queryCreateUsersTable = ` @@ -68,7 +68,7 @@ const ( listCertificateRequestsStmt = "SELECT &CertificateRequest.* FROM %s" getCertificateRequestStmt = "SELECT &CertificateRequest.* FROM %s WHERE id==$CertificateRequest.id or csr==$CertificateRequest.csr" createCertificateRequestStmt = "INSERT INTO %s (csr) VALUES ($CertificateRequest.csr)" - updateCertificateRequestStmt = "UPDATE %s SET certificate_chain=$CertificateRequest.certificate_chain, request_status=$CertificateRequest.request_status WHERE id==$CertificateRequest.id or csr==$CertificateRequest.csr" + updateCertificateRequestStmt = "UPDATE %s SET certificate_chain=$CertificateRequest.certificate_chain, status=$CertificateRequest.status WHERE id==$CertificateRequest.id or csr==$CertificateRequest.csr" deleteCertificateRequestStmt = "DELETE FROM %s WHERE id=$CertificateRequest.id or csr=$CertificateRequest.csr" ) diff --git a/ui/src/app/(notary)/certificate_requests/table.test.tsx b/ui/src/app/(notary)/certificate_requests/table.test.tsx index 15dc36c..ee5a4c2 100644 --- a/ui/src/app/(notary)/certificate_requests/table.test.tsx +++ b/ui/src/app/(notary)/certificate_requests/table.test.tsx @@ -25,7 +25,7 @@ uMNMgwl0fxGMQZjrlXyCBhXBm1k6PmwcJGJF5LQ31c+5aTTMFU7SyZhlymctB8mS y+ErBQsRpcQho6Ok+HTXQQUcx7WNcwI= -----END CERTIFICATE REQUEST-----`, 'certificate_chain': "", - 'csr_status': "Outstanding", + 'status': "Outstanding", }, { 'id': 2, @@ -49,7 +49,7 @@ WsDOAOH6qKQKQg3BO/xmRoohC6GL4CuhP7HYGi7+wziNhNZQa4GtE/k9DyIXVtJy yuf2PnfXCKnaIWRJNoEqDCZRVMfA5BFSwTPITqyo -----END CERTIFICATE REQUEST-----`, 'certificate_chain': "", - 'csr_status': "Rejected" + 'status': "Rejected" }, { 'id': 3, @@ -93,7 +93,7 @@ gCX3nqYpp70oZIFDrhmYwE5ij5KXlHD4/1IOfNUKCDmQDgGPLI1tVtwQLjeRq7Hg XVelpl/LXTQawmJyvDaVT/Q9P+WqoDiMjrqF6Sy7DzNeeccWVqvqX5TVS6Ky56iS Mvo/+PAJHkBciR5Xn+Wg2a+7vrZvT6CBoRSOTozlLSM= -----END CERTIFICATE-----`, - 'csr_status': 'Active' + 'status': 'Active' }, ] diff --git a/ui/src/app/(notary)/certificate_requests/table.tsx b/ui/src/app/(notary)/certificate_requests/table.tsx index 8d1a17e..4b7ecbf 100644 --- a/ui/src/app/(notary)/certificate_requests/table.tsx +++ b/ui/src/app/(notary)/certificate_requests/table.tsx @@ -139,7 +139,7 @@ export function CertificateRequestsTable({ csrs: rows }: TableProps) { }; const csrrows = rows.map((csrEntry) => { - const { id, csr, certificate_chain, csr_status } = csrEntry; + const { id, csr, certificate_chain, status: csr_status } = csrEntry; const csrObj = extractCSR(csr); const certs = splitBundle(certificate_chain); const clientCertificate = certs?.at(0); diff --git a/ui/src/types.ts b/ui/src/types.ts index 9af23ff..3cce885 100644 --- a/ui/src/types.ts +++ b/ui/src/types.ts @@ -2,7 +2,7 @@ export type CSREntry = { id: number, csr: string, certificate_chain: string - csr_status: "Outstanding" | "Active" | "Rejected" | "Revoked" + status: "Outstanding" | "Active" | "Rejected" | "Revoked" } export type User = {