Skip to content

Commit

Permalink
fix: Make search also return Project info
Browse files Browse the repository at this point in the history
This solves the existing bug when you search based on normal text instead of issue ids.
  • Loading branch information
jonandernovella committed Sep 13, 2023
1 parent 3123a00 commit 6bac901
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 5 additions & 3 deletions backend/api/issueSearchHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ func issueSearchHandler(c *fiber.Ctx) error {

searchResponse := struct {
Results []struct {
Id int `json:"id"`
Type string `json:"type"`
Title string `json:"title"`
Id int `json:"id"`
Type string `json:"type"`
Title string `json:"title"`
Project Project `json:"project"`
} `json:"results"`
}{}

Expand Down Expand Up @@ -73,6 +74,7 @@ func issueSearchHandler(c *fiber.Ctx) error {
issue := Issue{
Id: issue.Id,
Subject: issuesResponse.Issues[0].Subject,
Project: issuesResponse.Issues[0].Project,
}
foundIssues = append(foundIssues, issue)
}
Expand Down
9 changes: 7 additions & 2 deletions backend/api/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ type user struct {
Login string `json:"login"`
}

type Project struct {
Id int `json:"id"`
}

type Issue struct {
Id int `json:"id"`
Subject string `json:"subject"`
Id int `json:"id"`
Subject string `json:"subject"`
Project Project `json:"project"`
}

type IssueWithTitle struct {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/QuickAdd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export const QuickAdd = ({
messages: "0",
// projects: "0" produces weird results.
open_issues: "1",
projects: "1",
};

const foundIssues: { issues: Issue[] } = await fetch(
Expand Down

0 comments on commit 6bac901

Please sign in to comment.