diff --git a/cognito-s3-control/lambda/lambda_csv_to_json/index.js b/cognito-s3-control/lambda/lambda_csv_to_json/index.js index d734d81..53e68be 100644 --- a/cognito-s3-control/lambda/lambda_csv_to_json/index.js +++ b/cognito-s3-control/lambda/lambda_csv_to_json/index.js @@ -55,7 +55,7 @@ let user_password; function post_to_api (endpoint_path, json, post_callback) { let post_options = { - host: "api.camera-trap.tw", + host: "api-dev.camera-trap.tw", port: '443', path: endpoint_path, method: 'POST', @@ -159,7 +159,7 @@ exports.handler = (event, context, callback) => { ]; // 讀取 project-metadata 與欄位設定相關的資訊, 包括物種清單、其他啟用欄位與定時測試照片的時間設定測試 - post_to_api("/api/project/aggregate", post_aggregate, validate_and_create_json); + post_to_api("/project/aggregate", post_aggregate, validate_and_create_json); let fullCameraLocation = tag_data.projectTitle + "/" + tag_data.site + "/" + tag_data.subSite + "/" + tag_data.cameraLocation; let fullCameraLocationMd5 = md5(fullCameraLocation); @@ -270,12 +270,12 @@ exports.handler = (event, context, callback) => { let baseFileNameParts; let timestamp, corrected_timestamp; - let date_time_obj = new Date(record[field_map.date_time]); + let date_time_obj = new Date(record[field_map.date_time] + '+8'); timestamp = date_time_obj.getTime() / 1000; //console.log([record[field_map.date_time], timestamp]); let corrected_date_time = record[field_map.corrected_date_time] ? record[field_map.corrected_date_time] : record[field_map.date_time]; - let corrected_date_time_obj = new Date(corrected_date_time); + let corrected_date_time_obj = new Date(corrected_date_time + '+8'); corrected_timestamp = corrected_date_time_obj.getTime() / 1000; @@ -494,7 +494,7 @@ exports.handler = (event, context, callback) => { } let data_overlap = false; - post_to_api("/api/media/annotation/exists", overlap_range, function(res) { + post_to_api("/media/annotation/exists", overlap_range, function(res) { console.log(JSON.stringify(overlap_range, null, 2)); if (res.results !== null) { @@ -503,7 +503,7 @@ exports.handler = (event, context, callback) => { } if (data_errors.length > 0) { - post_to_api("/api/upload-session/bulk-update", [{ + post_to_api("/upload-session/bulk-update", [{ _id: upload_session_id, projectTitle: tag_data.projectTitle, $set: { @@ -532,7 +532,7 @@ exports.handler = (event, context, callback) => { }); } else { - post_to_api("/api/upload-session/bulk-update", [{ + post_to_api("/upload-session/bulk-update", [{ _id: upload_session_id, projectTitle: tag_data.projectTitle, $set: { diff --git a/cognito-s3-control/lambda/lambda_post_json_to_mongodb/index.js b/cognito-s3-control/lambda/lambda_post_json_to_mongodb/index.js index d701cc0..d5f7152 100644 --- a/cognito-s3-control/lambda/lambda_post_json_to_mongodb/index.js +++ b/cognito-s3-control/lambda/lambda_post_json_to_mongodb/index.js @@ -43,9 +43,9 @@ exports.handler = (event, context, callback) => { // data lock api let lock_post_options = { - host: "api.camera-trap.tw", + host: "api-dev.camera-trap.tw", port: '443', - path: "/api/camera-location/data-lock/bulk-replace", + path: "/camera-location/data-lock/bulk-replace", method: 'POST', headers: { 'Content-Type': 'application/json', @@ -96,9 +96,9 @@ exports.handler = (event, context, callback) => { // An object of options to indicate where to post to let post_options = { - host: "api.camera-trap.tw", + host: "api-dev.camera-trap.tw", port: '443', - path: "/api" + json.endpoint, + path: json.endpoint, method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/cognito-s3-control/lambda/lambda_unzip_on_uploaded/index.js b/cognito-s3-control/lambda/lambda_unzip_on_uploaded/index.js index 48b6029..0d30d86 100644 --- a/cognito-s3-control/lambda/lambda_unzip_on_uploaded/index.js +++ b/cognito-s3-control/lambda/lambda_unzip_on_uploaded/index.js @@ -159,7 +159,7 @@ exports.handler = (event, context, callback) => { let dateTimeComponents = exifData.exif.DateTimeOriginal.match(/\d+/g); let dateTimeString = dateTimeComponents[0] + "/" + dateTimeComponents[1] + "/" + dateTimeComponents[2] + " " + dateTimeComponents[3] + ":" + dateTimeComponents[4] + ":" + dateTimeComponents[5]; - let date_time_obj = new Date(dateTimeString); + let date_time_obj = new Date(dateTimeString + '+8'); let timestamp = date_time_obj.getTime() / 1000; let year = date_time_obj.getFullYear();