Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding team.slug to findTeams query #15338

Merged
merged 2 commits into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions components/gitpod-db/src/team-db.spec.db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,17 @@ class TeamDBSpec {
const result = await this.db.findTeams(0, 10, "creationTime", "DESC", searchTerm);
expect(result.rows.length).to.eq(1);
}

@test(timeout(10000))
public async findTeamsBySlug() {
const user = await this.userDb.newUser();
await this.db.createTeam(user.id, "First Team");
await this.db.createTeam(user.id, "Second Team");

const searchTerm = "first-team";
const result = await this.db.findTeams(0, 10, "creationTime", "DESC", searchTerm);
expect(result.rows.length).to.eq(1);
}
}

module.exports = new TeamDBSpec();
2 changes: 1 addition & 1 deletion components/gitpod-db/src/typeorm/team-db-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class TeamDBImpl implements TeamDB {
const teamRepo = await this.getTeamRepo();
const queryBuilder = teamRepo
.createQueryBuilder("team")
.where("team.name LIKE :searchTerm", { searchTerm: `%${searchTerm}%` })
.where("team.name LIKE :searchTerm OR team.slug LIKE :searchTerm", { searchTerm: `%${searchTerm}%` })
.skip(offset)
.take(limit)
.orderBy(orderBy, orderDir);
Expand Down