Skip to content

Commit 197669a

Browse files
committed
refactored code, added explicit comments
1 parent 575e788 commit 197669a

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

booking.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type Booking struct {
1717

1818
var bookings = []Booking{}
1919

20-
// Function to add a new Booking
20+
// Function to make a new Booking to the studio
2121
func addNewBooking(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
2222

2323
body, err := ioutil.ReadAll(r.Body)
@@ -73,7 +73,7 @@ func addNewBooking(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
7373

7474
}
7575

76-
// Function to get all bookings
76+
// Function to get all bookings by clients
7777
func allBookings(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
7878
bookings, err := json.Marshal(bookings)
7979

class.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type Class struct {
1919

2020
var classes = []Class{}
2121

22-
// Function to add a new class
22+
// Function to add a new class to the studio
2323
func addClass(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
2424

2525
body, err := ioutil.ReadAll(r.Body)
@@ -84,7 +84,7 @@ func addClass(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
8484

8585
}
8686

87-
// Function to get all classes
87+
// Function to get all classes in the studio
8888
func listClass(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
8989
classes, err := json.Marshal(classes)
9090

endpoints_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ type TestStruct struct {
2020
observedStatusCode int
2121
}
2222

23-
//Inside user_test.go
2423
func TestAddClass(t *testing.T) {
2524

2625
url := "http://localhost:8080/api/classes_list"

glofox_task

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)