윤영준 윤영준 04-24
now the server accepts more forms of data, like accelometer, gyroscope, orientation, and azimuth
@b36a3c42004293b2456ed7a1bff8506c767ca7cc
 
app.py (added)
+++ app.py
@@ -0,0 +1,31 @@
+from flask import Flask, request, abort, jsonify
+from flask_restx import Api
+from flask_cors import CORS 
+from auth import Auth
+from action import Action
+from flask_caching import Cache
+import json
+
+app = Flask(__name__)
+CORS(app)
+cache = Cache(app, config={'CACHE_TYPE': 'simple'})
+
+print("Api Start")
+api = Api(app,
+          version='0.1',
+          title="PM_logger",
+          description="API Server",
+          terms_url="/",
+          contact="yjyoon@takensoft.co.kr",
+          license="")
+
+print("Api Started")
+
+api.add_namespace(Auth, '/auth')
+print("Api Add Auth")
+
+api.add_namespace(Action, '/action')
+
+if __name__ == "__main__":
+    app.run(debug=True, host='0.0.0.0', port=27461)
+    print("Flask Start")
 
unit_test_insert_gps_command.sh (added)
+++ unit_test_insert_gps_command.sh
@@ -0,0 +1,75 @@
+curl -d '{
+   "user_id":"testaccountsingle",
+   "trip_id":"1a3db65c589afaffd8cb7f7eae6ab53ffecde6f3d96bd8a0d8686070f44dfac3",
+   "trip_log": {
+      "latitude":[37.778282],
+      "longitude":[128.129373],
+      "timestamp":["2024-07-11 16:23:19.667"]
+   }
+}' -H "Content-Type: application/json" -X POST http://192.168.0.195:15857/action/gps_update
+
+
+
+curl -d '{
+   "user_id":"testaccountdouble",
+   "trip_id":"7e46b2c35651611a5269f0f9190b02b80866a76bc7e457fab32ef5ff65b492bc",
+   "trip_log": {
+      "latitude":[37.778282, 37.778300],
+      "longitude":[128.129373, 128.129400],
+      "timestamp":["2024-07-11 16:23:19.667", "2024-07-11 16:30:43.175"]
+   }
+}' -H "Content-Type: application/json" -X POST http://192.168.0.195:15857/action/gps_update
+
+curl -d '{
+   "user_id":"testaccountinvaliduserid",
+   "trip_id":"edgecase_test",
+   "trip_log": {
+      "latitude":[37.778282, 37.778300],
+      "longitude":[128.129373, 128.129400],
+      "timestamp":["2024-07-11 16:23:19.667", "2024-07-11 16:30:43.175"]
+   }
+}' -H "Content-Type: application/json" -X POST http://192.168.0.195:15857/action/gps_update
+
+
+curl -d '{
+   "user_id":"testaccount-fifteen",
+   "trip_id":"9911c80c165b85c7cfbaedd89cb0e0d39bea6d7eb93cadab9b264abc350bb888",
+   "trip_log": {
+      "latitude":[37.778282, 37.778283, 37.778284, 37.778285, 37.778286, 37.778287, 37.778288, 37.778289, 37.778290, 37.778291, 37.778292, 37.778293, 37.778294, 37.778295, 37.778296],
+      "longitude":[128.129373, 128.129374, 128.129375, 128.129376, 128.129377, 128.129378, 128.129379, 128.129380, 128.129381, 128.129382, 128.129383, 128.129384, 128.129385, 128.129386, 128.129387],
+      "timestamp":["2024-07-11 16:23:19.667", "2024-07-11 16:24:19.667", "2024-07-11 16:25:19.667", "2024-07-11 16:26:19.667", "2024-07-11 16:27:19.667", "2024-07-11 16:28:19.667", "2024-07-11 16:29:19.667", "2024-07-11 16:30:19.667", "2024-07-11 16:31:19.667", "2024-07-11 16:32:19.667", "2024-07-11 16:33:19.667", "2024-07-11 16:34:19.667", "2024-07-11 16:35:19.667", "2024-07-11 16:36:19.667", "2024-07-11 16:37:19.667"]
+   }
+}' -H "Content-Type: application/json" -X POST http://192.168.0.195:15857/action/gps_update
+
+
+curl -d '{
+   "user_id":"testaccount-mismatchlen-long",
+   "trip_id":"9911c80c165b85c7cfbaedd89cb0e0d39bea6d7eb93cadab9b264abc350bb888",
+   "trip_log": {
+      "latitude":[37.778282, 37.778283, 37.778284, 37.778285, 37.778286, 37.778287, 37.778288, 37.778289, 37.778290, 37.778291, 37.778292, 37.778293, 37.778294, 37.778295, 37.778296],
+      "longitude":[128.129373, 128.129374, 128.129375, 128.129376, 128.129377, 128.129378, 128.129379, 128.129380, 128.129381, 128.129382, 128.129383, 128.129384, 128.129385, 128.129386],
+      "timestamp":["2024-07-11 16:23:19.667", "2024-07-11 16:24:19.667", "2024-07-11 16:25:19.667", "2024-07-11 16:26:19.667", "2024-07-11 16:27:19.667", "2024-07-11 16:28:19.667", "2024-07-11 16:29:19.667", "2024-07-11 16:30:19.667", "2024-07-11 16:31:19.667", "2024-07-11 16:32:19.667", "2024-07-11 16:33:19.667", "2024-07-11 16:34:19.667", "2024-07-11 16:35:19.667", "2024-07-11 16:36:19.667", "2024-07-11 16:37:19.667"]
+   }
+}' -H "Content-Type: application/json" -X POST http://192.168.0.195:15857/action/gps_update
+
+curl -d '{
+   "user_id":"testaccount-mismatchlen-lat",
+   "trip_id":"9911c80c165b85c7cfbaedd89cb0e0d39bea6d7eb93cadab9b264abc350bb888",
+   "trip_log": {
+      "latitude":[37.778282, 37.778283, 37.778284, 37.778285, 37.778286, 37.778287, 37.778288, 37.778289, 37.778290, 37.778291, 37.778292, 37.778293, 37.778294, 37.778295],
+      "longitude":[128.129373, 128.129374, 128.129375, 128.129376, 128.129377, 128.129378, 128.129379, 128.129380, 128.129381, 128.129382, 128.129383, 128.129384, 128.129385, 128.129386, 128.129387],
+      "timestamp":["2024-07-11 16:23:19.667", "2024-07-11 16:24:19.667", "2024-07-11 16:25:19.667", "2024-07-11 16:26:19.667", "2024-07-11 16:27:19.667", "2024-07-11 16:28:19.667", "2024-07-11 16:29:19.667", "2024-07-11 16:30:19.667", "2024-07-11 16:31:19.667", "2024-07-11 16:32:19.667", "2024-07-11 16:33:19.667", "2024-07-11 16:34:19.667", "2024-07-11 16:35:19.667", "2024-07-11 16:36:19.667", "2024-07-11 16:37:19.667"]
+   }
+}' -H "Content-Type: application/json" -X POST http://192.168.0.195:15857/action/gps_update
+
+
+curl -d '{
+   "user_id":"testaccount-fifteen-timestamp",
+   "trip_id":"9911c80c165b85c7cfbaedd89cb0e0d39bea6d7eb93cadab9b264abc350bb888",
+   "trip_log": {
+      "latitude":[37.778282, 37.778283, 37.778284, 37.778285, 37.778286, 37.778287, 37.778288, 37.778289, 37.778290, 37.778291, 37.778292, 37.778293, 37.778294, 37.778295, 37.778296],
+      "longitude":[128.129373, 128.129374, 128.129375, 128.129376, 128.129377, 128.129378, 128.129379, 128.129380, 128.129381, 128.129382, 128.129383, 128.129384, 128.129385, 128.129386, 128.129387],
+      "timestamp":["2024-07-11 16:23:19.667", "2024-07-11 16:24:19.667", "2024-07-11 16:25:19.667", "2024-07-11 16:26:19.667", "2024-07-11 16:27:19.667", "2024-07-11 16:28:19.667", "2024-07-11 16:29:19.667", "2024-07-11 16:30:19.667", "2024-07-11 16:32:19.667", "2024-07-11 16:33:19.667", "2024-07-11 16:34:19.667", "2024-07-11 16:35:19.667", "2024-07-11 16:36:19.667", "2024-07-11 16:37:19.667"]
+   }
+}' -H "Content-Type: application/json" -X POST http://192.168.0.195:15857/action/gps_update
+
Add a comment
List