fix(teams): trim team names on xls import and allow deleting teams linked to injects (#7558) - #7609
fix(teams): trim team names on xls import and allow deleting teams linked to injects (#7558)#7609Johanah LEKEU (johanah29) wants to merge 5 commits into
Conversation
|
📖 Documentation check — ✅ Passed 2 functional file(s), 0 doc file(s) changed. No documentation gaps detected. |
There was a problem hiding this comment.
Pull request overview
This PR targets team handling consistency by (1) normalizing team names during XLS inject import and (2) allowing teams to be deleted even when they are linked to injects.
Changes:
- Trim imported team name tokens when parsing comma-separated teams during XLS inject import.
- Update
DELETE /teams/{teamId}to load the tenant-scoped team, detach it from linked injects, and then delete it.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| openaev-api/src/main/java/io/openaev/service/InjectImportService.java | Trims parsed team-name tokens from XLS import before resolving/creating teams. |
| openaev-api/src/main/java/io/openaev/rest/team/TeamApi.java | Changes delete behavior to fetch the team in-tenant and detach from injects prior to deletion. |
Suppressed comments (1)
openaev-api/src/main/java/io/openaev/rest/team/TeamApi.java:253
- issue (blocking): Removing the team from inject.getTeams() mutates the join table but does not update inject_updated_at. Inject indexing uses inject_updated_at as part of its cursor/sort key, so team membership changes may not be propagated to Elasticsearch (stale inject_teams until the inject is otherwise updated/reindexed).
team.getInjects().forEach(inject -> inject.getTeams().remove(team));
teamRepository.delete(team);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| .map(String::trim) | ||
| .toList(); |
| .map(String::trim) | ||
| .toList(); |
| Team team = | ||
| teamRepository | ||
| .findByIdAndTenantId(teamId, TenantContext.getCurrentTenant()) | ||
| .orElseThrow(ElementNotFoundException::new); | ||
| try { | ||
| teamRepository.deleteById(teamId); | ||
| team.getInjects().forEach(inject -> inject.getTeams().remove(team)); | ||
| teamRepository.delete(team); |
…nd restrictions (#7199) Signed-off-by: johanah29 <johanah.lekeu@filigran.io>
…contextual team delete fails with HTTP Signed-off-by: johanah29 <johanah.lekeu@filigran.io>
Signed-off-by: johanah29 <johanah.lekeu@filigran.io>
Signed-off-by: johanah29 <johanah.lekeu@filigran.io>
Signed-off-by: johanah29 <johanah.lekeu@filigran.io>
03a4fc1 to
452882f
Compare
|
❔ Container vulnerability scan — Report incomplete The latest run did not produce both readable reports. Check the workflow run for details.
Updated from CI run attempt 1. |
| .split(",")) | ||
| .map(String::trim) | ||
| .filter(value -> !value.isBlank()) | ||
| .distinct() |
There was a problem hiding this comment.
todo: that's a huge issue. Having a disctinct here instead of having it on the prod code. Please put the distinct method in openaev-api/src/main/java/io/openaev/service/InjectImportService.java
|
|
||
| @DisplayName("Test parse teams cell with spaces and trailing comma") | ||
| @Test | ||
| void testParseTeamsCellWithSpacesAndTrailingComma() { |
There was a problem hiding this comment.
TODO: this test don't test your changes. Please do a real import.
| if (!teamRepository.existsByIdAndTenantId(teamId, TenantContext.getCurrentTenant())) { | ||
| throw new ElementNotFoundException(); | ||
| } | ||
| Team team = |
There was a problem hiding this comment.
Todo: you should add a test for this case.
| if (!teamRepository.existsByIdAndTenantId(teamId, TenantContext.getCurrentTenant())) { | ||
| throw new ElementNotFoundException(); | ||
| } | ||
| Team team = |
There was a problem hiding this comment.
TODO: can you test on bulk delete team if we have the issue?
Proposed changes
*Add a trim for the creation of teams from xls files
*Allow hte deletion of teams linked to injects
Testing Instructions