Skip to content

Commit

Permalink
fix: trim down the amount of data the api needs (#195)
Browse files Browse the repository at this point in the history
* fix: trim down the amount of data the api needs
#5
Removed the unnecessary data from API payload like 'Sender' and 'Receiver' fields and handled their dependencies from backend side.

* Rolling back code, warnigs are resolved in other PR
  • Loading branch information
SupraEQNR authored Dec 12, 2024
1 parent f1cce90 commit 54ecfc5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ChemDec.Api/Controllers/Handlers/ShipmentHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,8 @@ private void UpdateEvaluationValues(Db.Shipment savedShipment, Shipment sourceSh
var savedShipment = this.GetShipment(shipment.Id);
var operation = Operation.SaveEvaluation; //checks same as approval
var details = DetailedOperation.SavedEvaluation;


shipment.Receiver = db.Installations.Where(w => w.Id == savedShipment.ReceiverId).ProjectTo<PlantReference>(mapper.ConfigurationProvider).FirstOrDefault();
var validationErrors = CheckIfUserCanSaveEvaluation(savedShipment, shipment, user);
if (validationErrors != null && validationErrors.Any()) return (null, validationErrors);

Expand Down Expand Up @@ -777,6 +778,8 @@ private void ValidatePlannedExecutionDatesIsSet(Shipment shipment, List<string>
{
var validationErrors = new List<string>();

var recSender = db.Installations.FirstOrDefault(w => w.Id == shipment.SenderId);
shipment.Receiver = db.Installations.Where(w => w.Id == recSender.ShipsToId).ProjectTo<PlantReference>(mapper.ConfigurationProvider).FirstOrDefault();
var user = await userService.GetCurrentUser();
if (user == null)
{
Expand Down

0 comments on commit 54ecfc5

Please sign in to comment.