Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getPreviousHomes(request, response) {
var queryDog = new Parse.Query('Dog'),
queryOwnerHistory = new Parse.Query('DogOwnerHistory'),
currentOwner;
// Get the requested dog
queryDog.include('currentOwner');
queryDog.get(request.params.dogId, {
success: function (dog) {
currentOwner = dog.get('currentOwner');
if (currentOwner) {
queryOwnerHistory.notEqualTo('objectId', currentOwner.id);
}
// Get the owner history tied to this dog
queryOwnerHistory.equalTo('dog', dog);
queryOwnerHistory.descending('fromDate');
async function getCount(limit: number) {
const Meta = Parse.Object.extend('Meta');
const query = new Parse.Query(Meta);
query.descending('createdAt');
query.limit(limit);
const results: any[] = await query.find();
const result: CountResult[] = [];
for (let i = 0; i < results.length; i++) {
const pojo_result: PojoResult = results[i].toJSON();
const each_result: CountResult = {
user: pojo_result.user,
model: pojo_result.model,
registry: pojo_result.registry,
updatedAt: pojo_result.updatedAt,
};
result.push(each_result);
}
return result;
}
.then(() => {
const query = new Parse.Query('AClass');
return query.find();
})
.then(results => {
.then(() => {
const query = new Parse.Query('AnObject');
return query.find();
})
.then(results => {
function getNotes(request, response) {
var queryDog = new Parse.Query('Dog'),
queryNotes = new Parse.Query('DogNotes');
queryDog.get(request.params.dogId, {
success: function (dog) {
queryNotes.equalTo('dog', dog);
queryNotes.find({
success: function (notes) {
response.json({
data: notes
});
},
error: function (notes, error) {
onParseError(response, error);
}
});
},
function getNotes(request, response) {
var queryDog = new Parse.Query('Dog'),
queryNotes = new Parse.Query('DogNotes');
queryDog.get(request.params.dogId, {
success: function (dog) {
queryNotes.equalTo('dog', dog);
queryNotes.find({
success: function (notes) {
response.json({
data: notes
});
},
error: function (notes, error) {
onParseError(response, error);
}
});
},
error: function (dog, error) {
.then(user => {
expect(user.sessionToken).toBeUndefined();
const query = new Parse.Query('_Session');
return query.find({ useMasterKey: true });
})
.then(sessions => {
await RESTController.request('POST', 'batch', {
requests: [
{
method: 'POST',
path: '/1/classes/MyObject3',
body: { key: 'value1' },
},
{
method: 'POST',
path: '/1/classes/MyObject3',
body: { key: 'value2' },
},
],
});
const query = new Parse.Query('MyObject');
const results = await query.find();
expect(results.map(result => result.get('key')).sort()).toEqual([
'value1',
'value2',
]);
const query2 = new Parse.Query('MyObject2');
const results2 = await query2.find();
expect(results2.length).toEqual(0);
const query3 = new Parse.Query('MyObject3');
const results3 = await query3.find();
expect(results3.map(result => result.get('key')).sort()).toEqual([
'value1',
'value2',
]);
.then(() => {
const query = new Parse.Query('AnObject');
query.include('anotherObject');
return query.find();
})
.then(res => {
},
],
});
const query = new Parse.Query('MyObject');
const results = await query.find();
expect(results.map(result => result.get('key')).sort()).toEqual([
'value1',
'value2',
]);
const query2 = new Parse.Query('MyObject2');
const results2 = await query2.find();
expect(results2.length).toEqual(0);
const query3 = new Parse.Query('MyObject3');
const results3 = await query3.find();
expect(results3.map(result => result.get('key')).sort()).toEqual([
'value1',
'value2',
]);
expect(databaseAdapter.createObject.calls.count()).toBe(13);
let transactionalSession;
let transactionalSession2;
let myObjectDBCalls = 0;
let myObject2DBCalls = 0;
let myObject3DBCalls = 0;
for (let i = 0; i < 13; i++) {
const args = databaseAdapter.createObject.calls.argsFor(i);
switch (args[0]) {
case 'MyObject':