Commit a8882bc4 authored by cizek's avatar cizek
Browse files

Merge branch 'main' of gitlab.fi.muni.cz:xcizek3/flea-market-manager into main

parents 646066b1 98a54f83
...@@ -18,6 +18,7 @@ import org.springframework.stereotype.Component; ...@@ -18,6 +18,7 @@ import org.springframework.stereotype.Component;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.Date; import java.util.Date;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
...@@ -73,18 +74,31 @@ public class MarketEventInitializer extends DomainInitializerImpl { ...@@ -73,18 +74,31 @@ public class MarketEventInitializer extends DomainInitializerImpl {
event.setName(location.getName() + " market"); event.setName(location.getName() + " market");
eventService.create(event); eventService.create(event);
List<String> standTypes = List.of("Front", "Back", "Middle"); List<String> standTypes = List.of("Front", "Back", "Middle", "Pre Burzujov", "Ako Strom", "Nik Ho Nechce");
Map<String, Long> standPrices = Map.of("Front", 2000L, "Middle", 1500L, "Back", 1000L); Map<String, Long> standPrices = Map.of("Front", 2000L, "Middle", 1500L, "Back", 1000L, "Pre Burzujov", 5000L, "Ako Strom", 3500L, "Nik Ho Nechce", 1000L);
event.setStands(Set.of(new Stand(), new Stand(), new Stand()));
event.getStands().forEach(stand -> stand.setItemCategories(Set.of(ItemCategory.values()[faker.number().numberBetween(0,6)])));
event.getStands().forEach(stand -> stand.setStandType( Set<Stand> allStands = new HashSet<>();
new StandType( standTypes.forEach(standTypeName -> {
standTypes.get(faker.number().numberBetween(0, 3)) StandType standType = new StandType();
))); standType.setName(standTypeName);
event.getStands().forEach(stand -> stand.getStandType().setPriceInCents(standPrices.get(stand.getStandType().getName()))); standType.setPriceInCents(standPrices.get(standType.getName()));
standTypeService.create(standType);
Set<Stand> stands = new HashSet<>();
for (int j = 0; j < 3; j++) {
stands.add(new Stand());
}
stands.forEach(stand -> stand.setStandType(standType));
stands.forEach(stand -> stand.setItemCategories(Set.of(ItemCategory.values()[faker.number().numberBetween(0,6)])));
allStands.addAll(stands);
});
event.setStands(allStands);
event.getStands().forEach(stand -> stand.setEvent(event)); event.getStands().forEach(stand -> stand.setEvent(event));
event.getStands().forEach(stand -> standTypeService.create(stand.getStandType()));
event.getStands().forEach(standService::create); event.getStands().forEach(standService::create);
eventService.update(event); eventService.update(event);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment