diff --git a/src/app/api/upload/csv/route.ts b/src/app/api/upload/csv/route.ts index 5df4189..a996540 100644 --- a/src/app/api/upload/csv/route.ts +++ b/src/app/api/upload/csv/route.ts @@ -27,7 +27,7 @@ export async function POST(request: NextRequest) { const s3 = new S3({ signatureVersion: "v4", region: process.env.PRESIGN_AWS_REGION, - accessKeyId: process.env.PRSIGN_AWS_ACCESS_KEY, + accessKeyId: process.env.PRESIGN_AWS_ACCESS_KEY, secretAccessKey: process.env.PRESIGN_AWS_SECRET_KEY, }); diff --git a/src/app/components/Navbar.tsx b/src/app/components/Navbar.tsx index ae3e603..746bc40 100644 --- a/src/app/components/Navbar.tsx +++ b/src/app/components/Navbar.tsx @@ -42,8 +42,8 @@ function Nav({ userImage }: { userImage: string }) {
{makeLink("/home", "Home")} - {makeLink("/due-considerations", "Due Considerations")} - {makeLink("/eco-spreadsheet", "Eco Spreadsheet")} + {/* {makeLink("/due-considerations", "Due Considerations")} */} + {/* {makeLink("/eco-spreadsheet", "Eco Spreadsheet")} */} {makeLink("/help", "Help")}
diff --git a/src/app/db/documents_schema/documents.ts b/src/app/db/documents_schema/documents.ts index 11006b5..6948d09 100644 --- a/src/app/db/documents_schema/documents.ts +++ b/src/app/db/documents_schema/documents.ts @@ -9,6 +9,7 @@ export const reportType: [string, ...string[]] = [ "U_VALUE_CALCULATOR_REPORT", "OVERWRITING_U_VALUE_DECLARATION_FORM", "OSMOSIS_CONDITION_PAS_2035_REPORT", + "DOMNA_CONDITION_PAS_2035_REPORT", ]; const reportTypeEnum = pgEnum("report_type", reportType); diff --git a/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/DocumentSection.tsx b/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/DocumentSection.tsx index 5b52f10..08840fc 100644 --- a/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/DocumentSection.tsx +++ b/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/DocumentSection.tsx @@ -21,6 +21,8 @@ const descriptions: Record = { OVERWRITING_U_VALUE_DECLARATION_FORM: "Signed form for overwriting U-values", OSMOSIS_CONDITION_PAS_2035_REPORT: "Osmosis-generated PAS 2035 Condition Report", + DOMNA_CONDITION_PAS_2035_REPORT: + "Domna-generated PAS 2035 Condition Report" }; export const DocumentSection = ({ diff --git a/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/DocumentsTable.tsx b/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/DocumentsTable.tsx index 52c40d2..403aee7 100644 --- a/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/DocumentsTable.tsx +++ b/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/DocumentsTable.tsx @@ -63,6 +63,7 @@ export const DocumentsTable: React.FC = ({ const handleUpload = () => { // Handle the upload logic here console.log("Upload button clicked"); + console.log("Junte was here"); }; // We split out the various document types. Filter all of the quidos pre-site notes @@ -70,8 +71,8 @@ export const DocumentsTable: React.FC = ({ (doc) => doc.documentType === "QUIDOS_PRESITE_NOTE" ); - const osmosisConditionReport = documents.filter( - (doc) => doc.documentType === "OSMOSIS_CONDITION_PAS_2035_REPORT" + const domnaConditionReport = documents.filter( + (doc) => doc.documentType === "DOMNA_CONDITION_PAS_2035_REPORT" ); const floors = documents.filter((doc) => doc.documentType === "FLOOR_PLAN"); @@ -97,9 +98,9 @@ export const DocumentsTable: React.FC = ({ diff --git a/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/UploadModal.tsx b/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/UploadModal.tsx index 53ef373..9b4b515 100644 --- a/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/UploadModal.tsx +++ b/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/UploadModal.tsx @@ -24,6 +24,31 @@ const titles: Record = { QUIDOS_PRESITE_NOTE: "RdSAP Summary Report", }; +async function generatePresignedUrls({ + key, + bucket, + contentType, + expiresInSeconds, +}: { + key: string; + bucket: string; + contentType: string; + expiresInSeconds: number; +}) { + const body = JSON.stringify({ key, bucket, contentType, expiresInSeconds }); + console.log("bucket is ", bucket); + const presignedResponse = await fetch("/api/upload/s3_bucket_presigned_url", { + method: "POST", + body, + }); + + if (!presignedResponse.ok) { + throw new Error("Network response was not ok"); + } + + return presignedResponse.json(); +} + export const UploadModal = ({ open, onClose, @@ -33,6 +58,20 @@ export const UploadModal = ({ const [uploadFiles, setUploadFiles] = useState([]); const [buttonDisabled, setButtonDisabled] = useState(true); + async function handleS3Upload() { + console.log("Get Presigned url in a specific bucket location") + + const { url } = await generatePresignedUrls({ + key: "foo/test/trololol", // path in bucket + bucket: process.env.RETROFIT_ENERGY_ASSESSMENTS_BUCKET || "back up", //s3 bucket location + // bucket: "retrofit-energy-assessments-dev", //s3 bucket location + contentType: "application/pdf", + expiresInSeconds: 5 * 60, + }); + console.log("URl is ", url); + onClose(); //probably khalim call back to update the front end properl + } + function handleInputOnChange(e: React.ChangeEvent) { if (e.target.files) { const filesArray = Array.from(e.target.files); @@ -86,10 +125,7 @@ export const UploadModal = ({ Cancel