Commit 32bd6ccb authored by xkorenk's avatar xkorenk
Browse files

Fixed HarvestEntityMapper

parent 4bf9d7cf
Pipeline #132016 failed with stages
in 54 seconds
package cz.muni.fi.pa165.winery.services.mappers.wine;
import cz.muni.fi.pa165.winery.dto.wine.HarvestDto;
import cz.muni.fi.pa165.winery.persistence.entities.Grape;
import cz.muni.fi.pa165.winery.persistence.entities.Harvest;
import cz.muni.fi.pa165.winery.services.mappers.EntityMapperImpl;
import org.modelmapper.ModelMapper;
......@@ -26,4 +27,13 @@ public class HarvestEntityMapper extends EntityMapperImpl<HarvestDto, Harvest> {
.addMappings(m -> m.map(entity -> entity.getGrape().getId(), HarvestDto::setGrapeId));
}
@Override
public Harvest mapToEntity(HarvestDto record) {
Harvest entity = super.mapToEntity(record);
Grape grape = new Grape();
grape.setId(record.getId());
entity.setGrape(grape);
return entity;
}
}
\ No newline at end of file
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