Skip to content
This repository was archived by the owner on Mar 22, 2025. It is now read-only.

Commit e68e039

Browse files
committed
Resolved all the comments in the review part
1 parent aed44a4 commit e68e039

File tree

4 files changed

+374
-373
lines changed

4 files changed

+374
-373
lines changed

Comfortstat/Comfortstat.go

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -72,29 +72,29 @@ func main() {
7272
// Serving handles the resources services. NOTE: it exepcts those names from the request URL path
7373
func (t *UnitAsset) Serving(w http.ResponseWriter, r *http.Request, servicePath string) {
7474
switch servicePath {
75-
case "min_temperature":
76-
t.set_minTemp(w, r)
77-
case "max_temperature":
78-
t.set_maxTemp(w, r)
79-
case "max_price":
80-
t.set_maxPrice(w, r)
81-
case "min_price":
82-
t.set_minPrice(w, r)
83-
case "SEK_price":
84-
t.set_SEKprice(w, r)
85-
case "desired_temp":
86-
t.set_desiredTemp(w, r)
75+
case "MinTemperature":
76+
t.httpSetMinTemp(w, r)
77+
case "MaxTemperature":
78+
t.httpSetMaxTemp(w, r)
79+
case "MaxPrice":
80+
t.httpSetMaxPrice(w, r)
81+
case "MinPrice":
82+
t.httpSetMinPrice(w, r)
83+
case "SEKPrice":
84+
t.httpSetSEKPrice(w, r)
85+
case "DesiredTemp":
86+
t.httpSetDesiredTemp(w, r)
8787
case "userTemp":
88-
t.set_userTemp(w, r)
88+
t.httpSetUserTemp(w, r)
8989
default:
9090
http.Error(w, "Invalid service request [Do not modify the services subpath in the configurration file]", http.StatusBadRequest)
9191
}
9292
}
9393

94-
func (rsc *UnitAsset) set_SEKprice(w http.ResponseWriter, r *http.Request) {
94+
func (rsc *UnitAsset) httpSetSEKPrice(w http.ResponseWriter, r *http.Request) {
9595
switch r.Method {
9696
case "GET":
97-
signalErr := rsc.getSEK_price()
97+
signalErr := rsc.getSEKPrice()
9898
usecases.HTTPProcessGetRequest(w, r, &signalErr)
9999
default:
100100
http.Error(w, "Method is not supported.", http.StatusNotFound)
@@ -104,7 +104,7 @@ func (rsc *UnitAsset) set_SEKprice(w http.ResponseWriter, r *http.Request) {
104104
// All these functions below handles HTTP "PUT" or "GET" requests to modefy or retrieve the MAX/MIN temprature/price and desierd temprature
105105
// For the PUT case - the "HTTPProcessSetRequest(w, r)" is called to prosses the data given from the user and if no error,
106106
// call the set functions in things.go with the value witch updates the value in the struct
107-
func (rsc *UnitAsset) set_minTemp(w http.ResponseWriter, r *http.Request) {
107+
func (rsc *UnitAsset) httpSetMinTemp(w http.ResponseWriter, r *http.Request) {
108108
switch r.Method {
109109
case "PUT":
110110
sig, err := usecases.HTTPProcessSetRequest(w, r)
@@ -114,15 +114,15 @@ func (rsc *UnitAsset) set_minTemp(w http.ResponseWriter, r *http.Request) {
114114
return
115115

116116
}
117-
rsc.setMin_temp(sig)
117+
rsc.setMinTemp(sig)
118118
case "GET":
119-
signalErr := rsc.getMin_temp()
119+
signalErr := rsc.getMinTemp()
120120
usecases.HTTPProcessGetRequest(w, r, &signalErr)
121121
default:
122122
http.Error(w, "Method is not supported.", http.StatusNotFound)
123123
}
124124
}
125-
func (rsc *UnitAsset) set_maxTemp(w http.ResponseWriter, r *http.Request) {
125+
func (rsc *UnitAsset) httpSetMaxTemp(w http.ResponseWriter, r *http.Request) {
126126
switch r.Method {
127127
case "PUT":
128128
sig, err := usecases.HTTPProcessSetRequest(w, r)
@@ -131,16 +131,16 @@ func (rsc *UnitAsset) set_maxTemp(w http.ResponseWriter, r *http.Request) {
131131
http.Error(w, "request incorreclty formated", http.StatusBadRequest)
132132
return
133133
}
134-
rsc.setMax_temp(sig)
134+
rsc.setMaxTemp(sig)
135135
case "GET":
136-
signalErr := rsc.getMax_temp()
136+
signalErr := rsc.getMaxTemp()
137137
usecases.HTTPProcessGetRequest(w, r, &signalErr)
138138
default:
139139
http.Error(w, "Method is not supported.", http.StatusNotFound)
140140
}
141141
}
142142

143-
func (rsc *UnitAsset) set_minPrice(w http.ResponseWriter, r *http.Request) {
143+
func (rsc *UnitAsset) httpSetMinPrice(w http.ResponseWriter, r *http.Request) {
144144
switch r.Method {
145145
case "PUT":
146146
sig, err := usecases.HTTPProcessSetRequest(w, r)
@@ -149,17 +149,17 @@ func (rsc *UnitAsset) set_minPrice(w http.ResponseWriter, r *http.Request) {
149149
http.Error(w, "request incorreclty formated", http.StatusBadRequest)
150150
return
151151
}
152-
rsc.setMin_price(sig)
152+
rsc.setMinPrice(sig)
153153
case "GET":
154-
signalErr := rsc.getMin_price()
154+
signalErr := rsc.getMinPrice()
155155
usecases.HTTPProcessGetRequest(w, r, &signalErr)
156156
default:
157157
http.Error(w, "Method is not supported.", http.StatusNotFound)
158158

159159
}
160160
}
161161

162-
func (rsc *UnitAsset) set_maxPrice(w http.ResponseWriter, r *http.Request) {
162+
func (rsc *UnitAsset) httpSetMaxPrice(w http.ResponseWriter, r *http.Request) {
163163
switch r.Method {
164164
case "PUT":
165165
sig, err := usecases.HTTPProcessSetRequest(w, r)
@@ -168,17 +168,17 @@ func (rsc *UnitAsset) set_maxPrice(w http.ResponseWriter, r *http.Request) {
168168
http.Error(w, "request incorreclty formated", http.StatusBadRequest)
169169
return
170170
}
171-
rsc.setMax_price(sig)
171+
rsc.setMaxPrice(sig)
172172
case "GET":
173-
signalErr := rsc.getMax_price()
173+
signalErr := rsc.getMaxPrice()
174174
usecases.HTTPProcessGetRequest(w, r, &signalErr)
175175
default:
176176
http.Error(w, "Method is not supported.", http.StatusNotFound)
177177

178178
}
179179
}
180180

181-
func (rsc *UnitAsset) set_desiredTemp(w http.ResponseWriter, r *http.Request) {
181+
func (rsc *UnitAsset) httpSetDesiredTemp(w http.ResponseWriter, r *http.Request) {
182182
switch r.Method {
183183
case "PUT":
184184
sig, err := usecases.HTTPProcessSetRequest(w, r)
@@ -187,27 +187,27 @@ func (rsc *UnitAsset) set_desiredTemp(w http.ResponseWriter, r *http.Request) {
187187
http.Error(w, "request incorreclty formated", http.StatusBadRequest)
188188
return
189189
}
190-
rsc.setDesired_temp(sig)
190+
rsc.setDesiredTemp(sig)
191191
case "GET":
192-
signalErr := rsc.getDesired_temp()
192+
signalErr := rsc.getDesiredTemp()
193193
usecases.HTTPProcessGetRequest(w, r, &signalErr)
194194
default:
195195
http.Error(w, "Method is not supported.", http.StatusNotFound)
196196
}
197197

198198
}
199199

200-
func (rsc *UnitAsset) set_userTemp(w http.ResponseWriter, r *http.Request) {
200+
func (rsc *UnitAsset) httpSetUserTemp(w http.ResponseWriter, r *http.Request) {
201201
switch r.Method {
202202
case "PUT":
203203
sig, err := usecases.HTTPProcessSetRequest(w, r)
204204
if err != nil {
205205
http.Error(w, "request incorrectly formated", http.StatusBadRequest)
206206
return
207207
}
208-
rsc.setUser_Temp(sig)
208+
rsc.setUserTemp(sig)
209209
case "GET":
210-
signalErr := rsc.getUser_Temp()
210+
signalErr := rsc.getUserTemp()
211211
usecases.HTTPProcessGetRequest(w, r, &signalErr)
212212
default:
213213
http.Error(w, "Method is not supported.", http.StatusNotFound)

0 commit comments

Comments
 (0)