This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AUCTIONATOR_CONFIG = { | |
["show_selling_bag_2"] = true, | |
["no_price_database"] = false, | |
["search_no_filters_matched_entry"] = true, | |
["selling_groups_settings"] = { | |
}, | |
["enchant_tooltips"] = false, | |
["selling_grey_post_button"] = true, | |
["columns_buying_auctions_2"] = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ApolloServer } from "apollo-server-express"; | |
import { importSchema } from "graphql-import"; | |
import { makeExecutableSchema } from "graphql-tools"; | |
import { applyMiddleware } from "graphql-middleware"; | |
import * as path from "path"; | |
import { Prisma } from "./generated/prisma"; | |
import resolvers from "./resolvers"; | |
import permisions from "./resolvers/permisions"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": { | |
"updateFoodTruck": { | |
"logo": "changed.png", | |
"name": "FoodTruck Updated 2", | |
"location": [ | |
33.4424, | |
-21.222 | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`mutation UpdateTruck($update: FoodTruckUpdateInput!) { | |
updateFoodTruck(input: $update){ | |
logo | |
name | |
location | |
} | |
} | |
# Query Variables | |
{ | |
"update": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.model('FoodTrucks') | |
.findOneAndUpdate( | |
{ | |
_id: foodTruckId, | |
owner: currentUser._id | |
}, // The food truck to update | |
{ $set: updatedProperties}, // The update | |
{ new: true } // Return the modified version | |
).exec((err, data) => { | |
if (err) reject(err); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert Array into Object | |
let updatedProperties = Object.assign({}, …notNullArray); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.assign(target, ...sources) | |
// Example | |
var obj = { a: 1 }; | |
var copy = Object.assign({}, obj); | |
console.log(copy); // { a: 1 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example | |
var parts = ['shoulders', 'knees']; | |
var lyrics = ['head', ...parts, 'and', 'toes']; // ["head", "shoulders", "knees", "and", "toes"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Filter function to check what property was left null. | |
// notNullArray is now a an array with key whose values are not null | |
let notNullArray = arrayWithNulls.filter((prop) => { | |
// prop is an an element of the array (eg. {image: null}) | |
for (var key in prop) { | |
// if the value of prop[key] is not null return it. | |
// eg. (key = image, and prop = { image:null } Won't return. | |
if(prop[key]){ | |
return prop; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log(arrayWithNulls); // [ | |
// { image: null }, | |
// { logo: null }, | |
// { name: 'Updated FoodTruck Name'}, | |
// { takingOrders: null }, | |
// { available: null }, | |
// { location: null }, | |
// ]; |
NewerOlder