Skip to content

Commit d75cf67

Browse files
committed
sort report by name, add envrc
Signed-off-by: Jayadeep KM <kmjayadeep@gmail.com>
1 parent 4f6653c commit d75cf67

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

.envrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export TW_DATA_LOCATION="~/private/psuite/todo"
2+
export TW_TASKRC_LOCATION="~/private/psuite/todo/taskrc"
3+
export TW_API_TOKENS="dev-token-12345"
4+
export TW_API_CORS_ENABLED="true"
5+
export TW_API_CORS_ORIGINS="http://localhost:5173"

internal/api/handlers/reports.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package handlers
22

33
import (
44
"net/http"
5+
"sort"
56

67
"github.com/dotbinio/taskwarrior-api/internal/taskwarrior"
78
"github.com/gin-gonic/gin"
@@ -38,6 +39,11 @@ func (h *ReportHandler) ListReports(c *gin.Context) {
3839
return
3940
}
4041

42+
// Sort reports by name
43+
sort.Slice(reports, func(i, j int) bool {
44+
return reports[i].Name < reports[j].Name
45+
})
46+
4147
c.JSON(http.StatusOK, gin.H{
4248
"reports": reports,
4349
"count": len(reports),

0 commit comments

Comments
 (0)