Skip to content

Commit

Permalink
[backend/frontend] Improv scenario pagination (#898)
Browse files Browse the repository at this point in the history
  • Loading branch information
RomuDeuxfois authored Jun 3, 2024
1 parent 670145f commit 34936c6
Show file tree
Hide file tree
Showing 8 changed files with 482 additions and 329 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package io.openbas.migration;

import org.flywaydb.core.api.migration.BaseJavaMigration;
import org.flywaydb.core.api.migration.Context;
import org.springframework.stereotype.Component;

import java.sql.Connection;
import java.sql.Statement;

@Component
public class V3_16__Add_array_union_agg_method extends BaseJavaMigration {

@Override
public void migrate(Context context) throws Exception {
Connection connection = context.getConnection();
Statement select = connection.createStatement();
select.execute("CREATE FUNCTION array_union(a ANYARRAY, b ANYARRAY)"
+ " RETURNS ANYARRAY AS"
+ " $$"
+ "SELECT array_agg(DISTINCT x)"
+ "FROM ("
+ " SELECT unnest(a) x"
+ " UNION ALL SELECT unnest(b)"
+ " ) AS u"
+ " $$ LANGUAGE SQL;"
+ "CREATE AGGREGATE array_union_agg(ANYARRAY) ("
+ " SFUNC = array_union,"
+ " STYPE = ANYARRAY,"
+ " INITCOND = '{}'"
+ ");");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public List<ScenarioSimple> scenarios() {

@PostMapping("/api/scenarios/search")
public Page<RawPaginationScenario> scenarios(@RequestBody @Valid final SearchPaginationInput searchPaginationInput) {
return this.scenarioService.scenarios(searchPaginationInput)
.map(RawPaginationScenario::new);
return this.scenarioService.scenarios(searchPaginationInput);
}

@GetMapping(SCENARIO_URI + "/{scenarioId}")
Expand Down
Loading

0 comments on commit 34936c6

Please sign in to comment.