Im using the JS SDK and Cloud Code, I have setup a LiveQuery server, everything works fine but I am really not happy having the main ParseQuery code client side in the app, Ideally this would be done behind the scenes where I could filter some user sensitive fields out before it hits the client side. I know there is protectedFields but is this kind of code below really. supposed to sit client side ? am i doing it right ?
chatSync = async () => {
const currentUID = this._api.current().id
const currentSession = this._api.current().getSessionToken()
const query = new Parse.Query('SpecialObject').contains('users', currentUID );
const subscription = await query.subscribe(currentSession);
let data: Array<any> = [];
subscription.on('open', async () => {
let results = await query.find()
let threadsParse = JSON.parse(JSON.stringify(results))
for (let index = 0; index < threadsParse.length; index++) {
const thread = threadsParse[index];
data.push({...thread})
console.log(`data ${JSON.stringify(data)}`)
}
});
}