This commit is contained in:
Thomas Demirdjian
2025-10-03 14:09:47 +02:00
parent 1907449dee
commit bfca92f9e0
10 changed files with 265 additions and 305 deletions
+14
View File
@@ -33,6 +33,20 @@ exports.onProjectUpdate = onDocumentWritten(
batch.delete(doc.ref);
});
await batch.commit();
} else {
if (previousData) {
// edit
if (!previousData?.songUrl && currentData?.songUrl) {
await refList.projects.doc(projectId).update({
hasSong: true,
});
}
if (!previousData?.playbackUrl && currentData?.playbackUrl) {
await refList.projects.doc(projectId).update({
hasPlayback: true,
});
}
}
}
} catch (e) {
console.log(e);