Skip to content

Instantly share code, notes, and snippets.

View robertoandres24's full-sized avatar
🏠
Working from home

Roberto Obando robertoandres24

🏠
Working from home
View GitHub Profile
@robertoandres24
robertoandres24 / schema.ts
Created December 7, 2020 04:15 — forked from mattmazzola/schema.ts
GraphQL Paginated Query Implementation
units: {
type: pagination.Page(Unit),
description: "Return the 'first' X number of items 'after' the specified cursor'",
args: {
first: {
type: graphql.GraphQLInt,
description: "Limits the number of results returned in the page. Defaults to 10."
},
after: {
type: graphql.GraphQLString,
@robertoandres24
robertoandres24 / for-of-loop.js
Last active October 17, 2021 21:34 — forked from anvk/promises_reduce.js
Sequential execution of Promises using reduce()
//recibe un array y una callback asyncrona
// y cada promesa se va ejecutando secuencialmente
// seria lo contrario a un Promise.all()
// me fue util para manejar los insert en la bd con typeorm y evitar conflictos de ids, duplicacion y fallos en las queries
export const runPromisesSequentally = async (
arr: any,
asyncFn: (item: any) => Promise<any>
): Promise<any[]> => {
const allContents = [];