Skip to content

Commit 46284cd

Browse files
refactor!: Deletes deprecated endpoints
1 parent 19189f1 commit 46284cd

File tree

2 files changed

+0
-44
lines changed

2 files changed

+0
-44
lines changed

recController.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,6 @@ func (recController recController) postRecs(w http.ResponseWriter, r *http.Reque
6161
w.Write(recJSON)
6262
}
6363

64-
// GET /recs/tag/:tag
65-
func (recController recController) getRecsByTag(w http.ResponseWriter, r *http.Request) {
66-
recs, err := recController.store.readRecs("siteMeter")
67-
if err != nil {
68-
log.Printf("Storage Error: %s", err)
69-
w.WriteHeader(http.StatusInternalServerError)
70-
return
71-
}
72-
73-
httpJson, err := json.Marshal(recs)
74-
if err != nil {
75-
log.Printf("Cannot encode response JSON")
76-
w.WriteHeader(http.StatusBadRequest)
77-
return
78-
}
79-
80-
w.WriteHeader(http.StatusOK)
81-
w.Write(httpJson)
82-
}
83-
8464
// GET /recs/:id
8565
func (recController recController) getRec(w http.ResponseWriter, r *http.Request) {
8666
idString := r.PathValue("id")

server.go

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -40,33 +40,9 @@ func NewServer(serverConfig ServerConfig) (http.Handler, error) {
4040
mux.Handle(pattern, handler)
4141
}
4242

43-
// All are deprecated. Instead use /api/*
44-
handleFunc(server, "GET /auth/token", authController.getAuthToken)
45-
handleFunc(tokenAuth, "GET /his/{pointId}", hisController.getHis) // Deprecated
46-
handleFunc(tokenAuth, "POST /his/{pointId}", hisController.postHis) // Deprecated
47-
handleFunc(tokenAuth, "DELETE /his/{pointId}", hisController.deleteHis) // Deprecated
48-
handleFunc(tokenAuth, "GET /recs", recController.getRecs)
49-
handleFunc(tokenAuth, "POST /recs", recController.postRecs)
50-
handleFunc(tokenAuth, "GET /recs/tag/siteMeter", recController.getRecsByTag) // Deprecated. Use /recs?tag=""
51-
handleFunc(tokenAuth, "GET /recs/{id}", recController.getRec)
52-
handleFunc(tokenAuth, "PUT /recs/{id}", recController.putRec)
53-
handleFunc(tokenAuth, "DELETE /recs/{id}", recController.deleteRec)
54-
handleFunc(tokenAuth, "GET /recs/{pointId}/history", hisController.getHis)
55-
handleFunc(tokenAuth, "POST /recs/{pointId}/history", hisController.postHis)
56-
handleFunc(tokenAuth, "DELETE /recs/{pointId}/history", hisController.deleteHis)
57-
handleFunc(tokenAuth, "GET /recs/{pointId}/current", currentController.getCurrent)
58-
handleFunc(tokenAuth, "POST /recs/{pointId}/current", currentController.postCurrent)
59-
server.Handle("/his/", tokenAuthMiddleware(serverConfig.jwtSecret, tokenAuth))
60-
server.Handle("/recs", tokenAuthMiddleware(serverConfig.jwtSecret, tokenAuth))
61-
server.Handle("/recs/", tokenAuthMiddleware(serverConfig.jwtSecret, tokenAuth))
62-
6343
handleFunc(server, "GET /api/auth/token", authController.getAuthToken)
64-
handleFunc(tokenAuth, "GET /api/his/{pointId}", hisController.getHis) // Deprecated
65-
handleFunc(tokenAuth, "POST /api/his/{pointId}", hisController.postHis) // Deprecated
66-
handleFunc(tokenAuth, "DELETE /api/his/{pointId}", hisController.deleteHis) // Deprecated
6744
handleFunc(tokenAuth, "GET /api/recs", recController.getRecs)
6845
handleFunc(tokenAuth, "POST /api/recs", recController.postRecs)
69-
handleFunc(tokenAuth, "GET /api/recs/tag/siteMeter", recController.getRecsByTag) // Deprecated. Use /recs?tag=""
7046
handleFunc(tokenAuth, "GET /api/recs/{id}", recController.getRec)
7147
handleFunc(tokenAuth, "PUT /api/recs/{id}", recController.putRec)
7248
handleFunc(tokenAuth, "DELETE /api/recs/{id}", recController.deleteRec)

0 commit comments

Comments
 (0)