Thay đổi ARCHITEC.md cập nhật các thông tin để chuẩn bị refactor lại dự án

This commit is contained in:
2026-06-10 17:13:56 +07:00
parent ec7a9186b6
commit 3f1b31b233
17 changed files with 326 additions and 139 deletions
+10 -2
View File
@@ -51,11 +51,18 @@ router.post('/create', protect, async (req, res) => {
});
await hotspot.save();
// Logic tạo liên kết quay lại tự động nếu có scene đích
// [BẢO MẬT] Logic tạo liên kết quay lại tự động nếu có scene đích
if (target_scene_id) {
const targetScene = await Scene.findById(target_scene_id);
if (targetScene) {
const reverseYaw = calculateReverseYaw(coordinates.yaw);
// [TASK 3] BẢO VỆ tourId & CHẶN VANDALISM:
// Chỉ tự động tạo link quay lại (tức là ghi dữ liệu vào cảnh đích)
// nếu người dùng hiện tại cũng là chủ sở hữu của cảnh đích đó.
// Điều này đảm bảo:
// 1. Không thay đổi cấu trúc tour của người khác khi tạo liên kết chéo (Cross-link).
// 2. Tuyệt đối không can thiệp vào trường 'tourId' của targetScene.
if (targetScene.createdBy.toString() === req.user._id.toString()) {
const reverseYaw = calculateReverseYaw(coordinates.yaw);
const reverseHotspot = new Hotspot({
parent_scene_id: target_scene_id,
target_scene_id: parent_scene_id,
@@ -64,6 +71,7 @@ router.post('/create', protect, async (req, res) => {
is_auto_return: true
});
await reverseHotspot.save();
}
}
}