(w http.ResponseWriter, r *http.Request)
| 8 | ) |
| 9 | |
| 10 | func (s *Service) GetStats(w http.ResponseWriter, r *http.Request) { |
| 11 | var request common.StatRequest |
| 12 | if err := common.ReadProtoBody(r.Body, &request); err != nil { |
| 13 | http.Error(w, err.Error(), http.StatusBadRequest) |
| 14 | return |
| 15 | } |
| 16 | |
| 17 | stats, err := s.Backend().GetStats(r.Context(), &request) |
| 18 | if err != nil { |
| 19 | err = common.InterceptNotFound(err) |
| 20 | st, _ := status.FromError(err) |
| 21 | httpCode := common.GrpcCodeToHTTP(st.Code()) |
| 22 | http.Error(w, err.Error(), httpCode) |
| 23 | return |
| 24 | } |
| 25 | |
| 26 | common.SendProtoResponse(w, stats) |
| 27 | } |
| 28 | |
| 29 | func (s *Service) GetUserOnlineStat(w http.ResponseWriter, r *http.Request) { |
| 30 | var request common.StatRequest |
nothing calls this directly
no test coverage detected