Unified the journeys and blogpost datastructure in the backend

This commit is contained in:
Josh-Dev-Quest committed 2026-03-28 16:40:16 +01:00
1 parent 241c962faf
commit 0de91bf814
8 files changed
+423 -362

No files matched your search

+28 -1
View File
@@ -630,6 +630,14 @@
required
/>
</div>
<div class="form-group">
<label for="journey-visibility"><i class="fas fa-lock"></i> Visibility</label>
<select id="journey-visibility">
<option value="private">Private (only you)</option>
<option value="public">Public (anyone can view)</option>
<option value="shared">Shared (with specific users)</option>
</select>
</div>
<div class="form-group">
<label for="journey-description"
><i class="fas fa-align-left"></i>
@@ -1149,8 +1157,10 @@
videoUrl: content.videoUrl || "",
};
});
const visibility = document.getElementById('journey-visibility').value;
const payload = { title, description, markers };
const payload = { title, description, markers, visibility };
try {
let res;
@@ -1213,6 +1223,7 @@
function loadJourneyMarkers(journey) {
currentJourney.markers.forEach((m) => map.removeLayer(m));
currentJourney.markers = [];
document.getElementById('journey-visibility').value = journey.visibility || 'private';
document.getElementById(
"current-markers-container",
).innerHTML =
@@ -1400,6 +1411,22 @@
// This function is called after auth check
function startMap() {
initMap();
// Check for journey parameter
const urlParams = new URLSearchParams(window.location.search);
const journeyToLoad = urlParams.get('journey');
if (journeyToLoad) {
// Fetch the journey and load its markers
fetch(`${API_BASE}/journeys/${journeyToLoad}`, { credentials: 'include' })
.then(res => res.json())
.then(journey => {
if (journey.can_edit) {
loadJourneyMarkers(journey);
} else {
showToast('You cannot edit this journey', true);
}
})
.catch(err => console.error(err));
}
bindEventListeners();
}
window.startMap = startMap;