@@ -36,6 +36,8 @@ func main() {
3636 }))
3737
3838 authHandler := handlers .NewAuthHandler (db )
39+ mobileHandler := handlers .NewMobileHandler (db )
40+ iotHandler := handlers .NewIoTHandler (db )
3941
4042 api := r .Group ("/api/v1" )
4143 {
@@ -58,6 +60,31 @@ func main() {
5860 protectedAuth .GET ("/profile" , authHandler .GetProfile )
5961 protectedAuth .PUT ("/profile" , authHandler .UpdateProfile )
6062 }
63+
64+ mobile := api .Group ("/mobile" )
65+ mobile .Use (middleware .AuthMiddleware ())
66+ {
67+ mobile .POST ("/pairing/request" , mobileHandler .RequestPairingCode )
68+ mobile .GET ("/pairing/:session_id/status" , mobileHandler .CheckPairingStatus )
69+
70+ mobile .GET ("/devices" , mobileHandler .GetDevices )
71+ mobile .DELETE ("/devices/:device_id" , mobileHandler .RemoveDevice )
72+ }
73+
74+ iot := api .Group ("/iot" )
75+ {
76+ iot .POST ("/pairing/verify" , iotHandler .VerifyPairingCode )
77+
78+ iotProtected := iot .Group ("" )
79+ iotProtected .Use (middleware .DeviceAuthMiddleware (db ))
80+ {
81+ iotProtected .POST ("/runs/upload" , iotHandler .UploadRun )
82+ iotProtected .POST ("/runs/batch" , iotHandler .BatchUploadRuns )
83+
84+ iotProtected .POST ("/devices/status" , iotHandler .UpdateDeviceStatus )
85+ iotProtected .GET ("/devices/config" , iotHandler .GetDeviceConfig )
86+ }
87+ }
6188 }
6289
6390
0 commit comments