This file contains hidden or 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 { Document, Schema, Model, model, Types } from "mongoose" | |
// We are definining typescript basic typescript interface first, properties only | |
export interface IHouse { | |
id?: any | |
name: string | |
rooms: Types.DocumentArray<IRoomDocument> | |
owners: Types.DocumentArray<IOwnerDocument> | |
} |
This file contains hidden or 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 pLimit from "p-limit" | |
import PromiseBar from "promise.bar" | |
PromiseBar.enable() | |
// set concurrency | |
const limit = pLimit(5) | |
// create array which we will use to throttle requests | |
const requests = [] |
This file contains hidden or 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
Promise.all(my_array.map(async (myObject) => { | |
await myObject.httpPost() | |
} |
This file contains hidden or 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 {Cluster} from './cluster.js' | |
const graphqlFields = require('graphql-fields'); | |
import * as _ from 'lodash' | |
const resolvers = { | |
Query: { | |
customer(root, args, context,info) { | |
var requested_fields = Object.keys(graphqlFields(info)) | |
var c = Cluster.findForUser(context,args.id) |
This file contains hidden or 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
const resolvers = { | |
Query: { | |
customer(root, args, context,info) { | |
var c = Customer.findForUser(context,args.id).populate('contacts') | |
} | |
} | |
} |