@@ -15,17 +15,17 @@ import (
15
15
16
16
func HandleRequest (db * storage.RoomMappings , logger * models.Logger ) (gin.HandlerFunc ){
17
17
return func (ctx * gin.Context ) {
18
- userId := ctx .Param ("userId " )
18
+ matchHash := ctx .Param ("matchHash " )
19
19
20
- result , err := db .Conn .HGetAll (context .Background (), userId ).Result ()
20
+ result , err := db .Conn .HGetAll (context .Background (), matchHash ).Result ()
21
21
22
22
if err == redis .Nil {
23
- logger .Log .Warn (fmt .Sprintf ("userId %s expired: " , userId ))
24
- ctx .JSON (http .StatusGone , "userId has expired" )
23
+ logger .Log .Warn (fmt .Sprintf ("matchHash %s expired: " , matchHash ))
24
+ ctx .JSON (http .StatusGone , "matchHash has expired" )
25
25
return
26
26
} else if err != nil {
27
- logger .Log .Error (fmt .Errorf ("error retrieving userId from database: %s" , err .Error ()))
28
- ctx .JSON (http .StatusBadGateway , "error retriving userId from database" )
27
+ logger .Log .Error (fmt .Errorf ("error retrieving matchHash from database: %s" , err .Error ()))
28
+ ctx .JSON (http .StatusBadGateway , "error retriving matchHash from database" )
29
29
return
30
30
}
31
31
@@ -49,10 +49,12 @@ func HandleRequest(db *storage.RoomMappings, logger *models.Logger) (gin.Handler
49
49
return
50
50
}
51
51
52
- roomId , user2 , requestTime , title , titleSlug , difficulty , content , questionId_string :=
53
- result ["roomId" ], result ["otherUser" ], result ["requestTime" ],
54
- result ["title" ], result ["titleSlug" ], result ["difficulty" ], result ["content" ], result ["id" ]
55
-
52
+ roomId , user1 , user2 , requestTime :=
53
+ result ["roomId" ], result ["thisUser" ], result ["otherUser" ], result ["requestTime" ]
54
+
55
+
56
+ title , titleSlug , difficulty , content , questionId_string :=
57
+ result ["title" ], result ["titleSlug" ], result ["difficulty" ], result ["content" ], result ["id" ]
56
58
questionId , err := strconv .Atoi (questionId_string )
57
59
58
60
if err != nil {
@@ -63,7 +65,7 @@ func HandleRequest(db *storage.RoomMappings, logger *models.Logger) (gin.Handler
63
65
64
66
room := models.Room {
65
67
RoomId : roomId ,
66
- User1 : userId ,
68
+ User1 : user1 ,
67
69
User2 : user2 ,
68
70
RequestTime : requestTime ,
69
71
0 commit comments