mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 11:55:42 +00:00
Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -753,6 +753,19 @@ export class RatesService {
|
||||
await this.buildUpdate(await this.findById(id), dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* The exact column changes applying this patch would make, without writing.
|
||||
*
|
||||
* A change request diffs against THIS rather than the raw patch: the form
|
||||
* posts selectors that are never stored (`cargoKind`, `intercityKind`), and
|
||||
* the real edit they encode lands on derived columns — flipping a rate to
|
||||
* bulk moves `rateType` and swaps `containerTypeId`/`cargoTypeId`. Diffing
|
||||
* the raw patch missed all of it, so the approver saw an empty change list.
|
||||
*/
|
||||
async previewUpdate(id: string, dto: UpdateRateDto): Promise<Partial<Rate>> {
|
||||
return this.buildUpdate(await this.findById(id), dto);
|
||||
}
|
||||
|
||||
private async applyUpdate(existing: Rate, dto: UpdateRateDto): Promise<Rate> {
|
||||
const updates = await this.buildUpdate(existing, dto);
|
||||
const updated = await this.repository.update(existing.id, updates);
|
||||
|
||||
Reference in New Issue
Block a user