Refactor PersonRepositoryImpl class for better readability
The refactoring simplified the 'insertInto' method within the PersonRepositoryImpl class. Now, instead of transforming the item to a Multi and collecting the last item, it directly finds the person by Id. This change enhances the code's readability and maintainability.
This commit is contained in:
parent
7c414bae64
commit
9d5df57645
@ -35,9 +35,7 @@ public class PersonRepositoryImpl implements PersonRepository {
|
||||
return Uni.createFrom().item(dsl.insertInto(PERSON).set(mapper.toRecord(person)).getSQL(ParamType.NAMED_OR_INLINED))
|
||||
.map(pgPool::query)
|
||||
.flatMap(Query::execute)
|
||||
.onItem().transformToMulti(RowSet::toMulti)
|
||||
.collect().last()
|
||||
.onItem().ifNotNull().transform(toDomain());
|
||||
.flatMap(ignore -> findById(person.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user