Firebase Cloud function-Get document snapshot field which is the URL of a file in firebase storage and delete the file from firebase storage – js

I want to retrieve the field value from a document snapshot which is the URL of a file in firebase storage and delete the file from firebase storage also the firestore document if the time of creation of the doc is before 24 hrs.

I am able to delete expired firestore documents successfully with the code below:

const functions = require("firebase-functions");
const admin = require("firebase-admin");
const { firestore } = require("firebase-admin");
admin.initializeApp();

exports.removeExpiredDocuments = functions.pubsub.schedule("every 1 hours").onRun(async (context) => {
  const db = admin.firestore();
  const now = firestore.Timestamp.now();
  const ts = firestore.Timestamp.fromMillis(now.toMillis() - 86400000); // 24 hours in milliseconds = 86400000

  const snap = await db.collection("photos").where("timestamp", "<", ts).get();
  let promises = [];
  snap.forEach((snap) => {
    promises.push(snap.ref.delete());
  });
  return Promise.all(promises);
});

but I don’t know how to retrieve the field value(URL of file) from the document snapshot within the forEach block and delete the file from firebase storage.

Here’s the firestore database:

enter image description here

The field value of photourl is to be retreived.