this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

remove repo handler

dholms 28cf3e90 379225b1

+24 -2
+24 -2
nexus/handlers.go
··· 17 17 func (n *Nexus) registerRoutes() { 18 18 n.echo.GET("/health", n.handleHealthcheck) 19 19 n.echo.GET("/listen", n.handleListen) 20 - n.echo.POST("/add-dids", n.handleAddDids) 20 + n.echo.POST("/add-repos", n.handleAddRepos) 21 + n.echo.POST("/remove-repos", n.handleAddRepos) 21 22 } 22 23 23 24 func (n *Nexus) handleHealthcheck(c echo.Context) error { ··· 83 84 DIDs []string `json:"dids"` 84 85 } 85 86 86 - func (n *Nexus) handleAddDids(c echo.Context) error { 87 + func (n *Nexus) handleAddRepos(c echo.Context) error { 87 88 var payload DidPayload 88 89 if err := c.Bind(&payload); err != nil { 89 90 return err ··· 108 109 "count": len(payload.DIDs), 109 110 }) 110 111 } 112 + 113 + func (n *Nexus) handleRemoveRepos(c echo.Context) error { 114 + var payload DidPayload 115 + if err := c.Bind(&payload); err != nil { 116 + return err 117 + } 118 + 119 + for _, did := range payload.DIDs { 120 + err := deleteRepo(n.db, did) 121 + if err != nil { 122 + n.logger.Error("failed to delete repo", "error", err) 123 + return echo.NewHTTPError(http.StatusInternalServerError) 124 + } 125 + } 126 + 127 + n.logger.Info("added dids", "count", len(payload.DIDs)) 128 + 129 + return c.JSON(http.StatusOK, map[string]interface{}{ 130 + "count": len(payload.DIDs), 131 + }) 132 + }