Open JosieBarber opened 3 days ago
Okay so in the GridController.java file name there are two methods written out for saveGrid, both of them have different errors and so I think this is a pick the lesser of two evils decision we need to make as a team.
The first one is: Grid grid = ctx.bodyAsClass(Grid.class); gridCollection.insert(grid); ctx.json(Map.of("id", grid._id)); ctx.status(HttpStatus.CREATED);
and returns:
"com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "editable" (class umm3601.grid.GridCell), not marked as ignorable (0 known properties: ])
at [Source: REDACTED (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION
disabled); line: 1, column: 62] (through reference chain: umm3601.grid.Grid["grid"]->java.lang.Object[][0]->java.lang.Object[][0]->umm3601.grid.GridCell["editable"])"
The second one is : String body = ctx.body(); Grid grid = ctx.bodyValidator(Grid.class) .check(td -> td.owner != null, "Owner must be non-empty") .check(td -> td.grid != null, "Error with grid, grid was : " + body) .get(); gridCollection.insertOne(grid); ctx.json(Map.of("id", grid._id)); ctx.status(HttpStatus.CREATED);
and returns: "DESERIALIZATION_FAILED"
"{"_id":"womp","owner":"currentUser","grid":[[{"editable":true,"value":"b","edges":{"top":false,"right":false,"bottom":false,"left":false}},{"editable":true,"value":"","edges":{"top":false,"right":false,"bottom":false,"left":false}}],[{"editable":true,"value":"","edges":{"top":false,"right":false,"bottom":false,"left":false}},{"editable":true,"value":"","edges":{"top":false,"right":false,"bottom":false,"left":false}}]]}"
Currently running into "Failed to load resource: the server responded with a status of 500 (Server Error)" where the error reads "Endpoint GET /api/save-grid not found" Attached is the localhost:400/api:
api.pdf
button click on client side is meant to be a post command not get. Bug suspected to be from client side