Hi, i’d like to set up a Cron job every night to update my databases depending on whether or not my members are up to date with their pricing plans.
Here is the chunk of code that I created already, however I don’t see any possible way to retrieve if the specific member has a plan or not :
import wixData from 'wix-data';
import { members } from 'wix-members-backend';
export function checkPlansForEveryUser() {
wixData.query("Members/PrivateMembersData")
.limit(1000)
.find()
.then((results) => {
let allMembers = results.items
for (let i = 0; i < allMembers.length; i++) {
members.getMember(allMembers[i]._id, { fieldsets: ['FULL'] })
.then((member) => {
console.log(member) // provides all member's data except pricing plan
})
}
});
}
Thank you !