preparing location search

This commit is contained in:
2026-07-23 08:47:50 +02:00
parent 75927c4395
commit c148800e72
3 changed files with 13 additions and 6 deletions
@@ -207,7 +207,7 @@ public class SqliteDb extends BaseDb implements StockDb {
}
@Override
public Map<Long, Item> find(Collection<Owner> owners, Collection<String> keys, boolean fulltext) {
public Map<Long, Item> findItems(Collection<Owner> owners, Collection<String> keys, boolean fulltext) {
try {
var items = new HashMap<Long,Item>();
var ownerCodes = owners.stream().map(Owner::dbCode).toArray();
@@ -230,6 +230,11 @@ public class SqliteDb extends BaseDb implements StockDb {
}
}
@Override
public Map<Long, Location> findLocations(Collection<Owner> owners, Collection<String> keys, boolean fulltext) {
return Map.of();
}
@Override
public Collection<DbLocation> listChildLocations(long parentId) {
try {
@@ -10,7 +10,8 @@ import java.util.Map;
public interface StockDb {
Property addNewProperty(long itemId, String name, Object value, String unit);
Location delete(DbLocation location);
Map<Long, Item> find(Collection<Owner> owners, Collection<String> keys, boolean fulltext);
Map<Long, Item> findItems(Collection<Owner> owners, Collection<String> keys, boolean fulltext);
Map<Long, Location> findLocations(Collection<Owner> owners, Collection<String> keys, boolean fulltext);
Collection<DbLocation> listChildLocations(long parentId);
Collection<DbLocation> listCompanyLocations(Company company);
Collection<Item> listItemsAt(Location location);
@@ -463,8 +463,9 @@ public class StockModule extends BaseHandler implements StockService {
var fulltext = json.has(FULLTEXT) && json.get(FULLTEXT) instanceof Boolean val && val;
Set<Owner> owners = new HashSet<>(companyService().listCompaniesOf(user).values());
owners.add(user);
var items = stockDb.find(owners,keys,fulltext);
return sendContent(ex,mapValues(items));
var items = stockDb.findItems(owners,keys,fulltext);
var locations = stockDb.findLocations(owners,keys,fulltext);
return sendContent(ex,Map.of("items",mapValues(items),"locations",mapValues(locations)));
}
@Override