Skip to content

Commit 48f51d9

Browse files
committed
Remove unused /Spools/barcode endpoint
1 parent a822ab6 commit 48f51d9

8 files changed

Lines changed: 1 addition & 60 deletions

File tree

Application/Controllers/Spools.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,4 @@ public async Task<IActionResult> UpdateTray([FromBody] UpdateTrayInput input) =>
1818
[HttpGet]
1919
public async Task<IActionResult> Get([FromQuery] GetAllSpoolsInput input) =>
2020
Ok(await handler.HandleAsync(input));
21-
22-
[HttpGet("barcode")]
23-
public async Task<IActionResult> GetByBarcode([FromQuery] string barcode) =>
24-
Ok(await handler.HandleAsync(new GetByBarcodeInput(barcode)));
2521
}

Domain/UseCases/Spool/GetByBarcode/Input.cs

Lines changed: 0 additions & 10 deletions
This file was deleted.

Domain/UseCases/Spool/GetByBarcode/Output.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

Domain/UseCases/Spool/GetByBarcode/UseCase.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

Gateways/Spoolman/Client.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ public class SpoolmanClient(IHealthEndpoint healthEndpoint, ISpoolEndpoint spool
66
{
77
public async Task<List<Spool>> GetAllAsync() => await spoolEndpoint.GetAllAsync();
88

9-
public async Task<List<Spool>> GetByBarcodeAsync(string barcode) =>
10-
await spoolEndpoint.GetSpoolsByBarcode(barcode);
11-
129
public async Task<bool> UseSpoolWeightAsync(int spoolId, float usedWeight) =>
1310
await spoolEndpoint.UseSpoolWeight(spoolId, usedWeight);
1411

Gateways/Spoolman/Endpoints/ISpoolmanEndpoint.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ public interface ISpoolEndpoint
2727

2828
Task<List<Spool>> GetAllAsync();
2929

30-
Task<List<Spool>> GetSpoolsByBarcode(string barcode);
31-
3230
Task<Spool> GetByIdAsync(int spoolId);
3331
}
3432

Gateways/Spoolman/Endpoints/Spool.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,6 @@ public SpoolSpoolmanEndpoint(
2222

2323
public async Task<List<Spool>> GetAllAsync() => await GetAllAsync(string.Empty, false);
2424

25-
public async Task<List<Spool>> GetSpoolsByBarcode(string barcode)
26-
{
27-
var allSpools = await GetAllAsync(string.Empty, false);
28-
29-
return allSpools?.Where(GetExtraFieldPredicate("barcode", barcode)).ToList() ?? new List<Spool>();
30-
}
31-
32-
private Func<Spool, bool> GetExtraFieldPredicate(string key, string value)
33-
{
34-
var jsonEncoded = JsonSerializer.Serialize(value, JsonOptions);
35-
36-
return spool => spool.Extra.ContainsKey(key) && spool.Extra[key] == jsonEncoded;
37-
}
38-
3925
public async Task<List<Spool>> GetCurrentSpoolsInTray(string trayId)
4026
{
4127
var jsonEncoded = JsonSerializer.Serialize(trayId, JsonOptions);

UI/src/app/components/scan/scan.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class ScanComponent {
8787
}).subscribe({
8888
next: ({ spools, trays }) => {
8989
this.loading = false;
90-
const spool = spools.find(s => s.barcode === barcode);
90+
const spool = spools.find(s => s.extra?.['barcode'] === barcode);
9191
if (!spool) {
9292
this.error = `No spool found for barcode: ${barcode}`;
9393
return;

0 commit comments

Comments
 (0)