-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multiline Data Entry & Post Validation System (#179)
* Broken utils functions have been corrected. Personnel upload has been confirmed in accordance with new schema structure. * feature upgrades. multiline form system implemented and set up to act as bulk update forms. API endpoint set up to connect the form system to connect to the existing SQLLoad app system, needs testing, though * Restructure and implementation of the multiline form interaction are continuing. Saving changes to correct core quadrat schema structure failure. * requisite repairs to the quadrats processing system to make sure that the multiline handler was correctly interacting with the system. correcting modal close functions to also refresh datagrid after closing. * scrubbing old datagrid instances that aren't used anymore * continuing postvalidation construction. saving changes here to test a new display approach so that I can revert if need be. * first-iteration postvalidation UI is completed. need to apply final tuning and then will push to dev site. * postvalidation query testing is complete. integrated into sidebar successfully -- places check to ensure that > 0 coremeasurements before allowing access. Download/Run system checked.
- Loading branch information
1 parent
b38965f
commit 5cd20db
Showing
52 changed files
with
2,777 additions
and
1,846 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
292 changes: 223 additions & 69 deletions
292
frontend/app/(hub)/measurementshub/postvalidation/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
frontend/app/api/bulkcrud/[dataType]/[[...slugs]]/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// bulk data CRUD flow API endpoint -- intended to allow multiline interactions and bulk updates via datagrid | ||
import { NextRequest, NextResponse } from 'next/server'; | ||
import { FileRowSet } from '@/config/macros/formdetails'; | ||
import { PoolConnection } from 'mysql2/promise'; | ||
import { getConn, InsertUpdateProcessingProps } from '@/components/processors/processormacros'; | ||
import { insertOrUpdate } from '@/components/processors/processorhelperfunctions'; | ||
import { HTTPResponses } from '@/config/macros'; | ||
|
||
export async function POST(request: NextRequest, { params }: { params: { dataType: string; slugs?: string[] } }) { | ||
const { dataType, slugs } = params; | ||
if (!dataType || !slugs) { | ||
return new NextResponse('No dataType or SLUGS provided', { status: HTTPResponses.INVALID_REQUEST }); | ||
} | ||
const [schema, plotIDParam, censusIDParam] = slugs; | ||
const plotID = parseInt(plotIDParam); | ||
const censusID = parseInt(censusIDParam); | ||
console.log('params: schema: ', schema, ', plotID: ', plotID, ', censusID: ', censusID); | ||
const rows: FileRowSet = await request.json(); | ||
if (!rows) { | ||
return new NextResponse('No rows provided', { status: 400 }); | ||
} | ||
console.log('rows produced: ', rows); | ||
let conn: PoolConnection | null = null; | ||
try { | ||
conn = await getConn(); | ||
for (const rowID in rows) { | ||
const rowData = rows[rowID]; | ||
console.log('rowData obtained: ', rowData); | ||
const props: InsertUpdateProcessingProps = { | ||
schema, | ||
connection: conn, | ||
formType: dataType, | ||
rowData, | ||
plotID, | ||
censusID, | ||
quadratID: undefined, | ||
fullName: undefined | ||
}; | ||
console.log('assembled props: ', props); | ||
await insertOrUpdate(props); | ||
} | ||
} catch (e: any) { | ||
return new NextResponse( | ||
JSON.stringify({ | ||
responseMessage: `Failure in connecting to SQL with ${e.message}`, | ||
error: e.message | ||
}), | ||
{ status: HTTPResponses.INTERNAL_SERVER_ERROR } | ||
); | ||
} finally { | ||
if (conn) conn.release(); | ||
} | ||
return new NextResponse(JSON.stringify({ message: 'Insert to SQL successful' }), { status: HTTPResponses.OK }); | ||
} |
Oops, something went wrong.