auto timestamp lyricks when song selected

This commit is contained in:
Thomas Demirdjian
2025-09-09 13:51:20 +02:00
parent 9a9de33ef2
commit ea9bfb0f05
7 changed files with 158 additions and 181 deletions
+20
View File
@@ -0,0 +1,20 @@
const { onDocumentWritten } = require("firebase-functions/firestore");
const { getSunoTimestamps } = require("./lyrics");
exports.onProjectUpdate = onDocumentWritten(
"projects/{projectId}",
async (projectSnap) => {
try {
const { projectId } = projectSnap.params;
const currentData = projectSnap?.data?.after?.data() || null;
const previousData = projectSnap?.data?.before?.data() || null;
if (!previousData?.songUrl && currentData?.songUrl) {
await getSunoTimestamps(projectId);
}
} catch (e) {
console.log(e);
}
},
);