Giter Club home page Giter Club logo

backend's Introduction

impactMarket leverages Web3 to provide accessible financial solutions, including Unconditional Basic Income, the crypto wallet Libera, Microcredit, and Learn and Earn, empowering financially unserved and underserved people around the world.

Getting started

Use the package manager yarn to install dependencies.

Run API

  1. Config .env
  2. Install dependencies (yarn at root folder)
  3. From packages/api run docker compose up (you will need docker)
  4. From the root folder, run sequelize migrations with NODE_ENV=test API_ENVIRONMENT=development ./release-tasks.sh (Using NODE_ENV=test avoid running updates the first time, potentially causing breaks)
  5. yarn dev

Run Test

  1. Config .env.test in each folder
  2. Run steps 2. and 3. from "Run API" if you haven't yet
  3. From root run yarn test

See PERFORMANCE.md to learn more about load tests.

Sponsors

A really big thank you to AppSignal for sponsoring us. AppSignal is "No-brainer monitoring for smart developers."

Troubleshooting

lipq node-gyp issue - ValueError: invalid mode: 'rU' while trying to load binding.gyp

See nodejs/node-gyp#2219 (comment)

License

Apache-2.0

backend's People

Contributors

dependabot[bot] avatar dev-jotape avatar jonathansoufer avatar obernardovieira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

backend's Issues

register wallet notifications

Wallet notifications should be separated from webapp notifications. Although, they might be sent to both sometimes.

Suggestion:
The notifications table with isWallet and isWebApp (booleans) columns so that we can show the user the correct notifications depending where the user is.

create endpoint to send push notifications

The endpoint should allow submitting only to wallet or webapp. Or both. Should also allow sending different messages to different languages. Should also allow sending to a list of countries.

This endpoint should send the push notification and register the notification on the registry, so the user can see it later.

Something like

{
  to: "wallet",
  data: {
    "en": {
      title: "Hello"
    },
    "pt": {
      title: "Ola"
    }
  }
}

Error: Cannot set headers after they are sent to the client

Sentry Issue: API-1J

Error: Cannot set headers after they are sent to the client
  File "/app/packages/api/dist/utils/api.js", line 11, in standardResponse
    res.status(status).send({
  File "/app/packages/api/dist/controllers/user.js", line 108, in null.<anonymous>
    .catch((e) => (0, api_1.standardResponse)(res, 400, false, '', { error: e }));
...
(3 additional frame(s) were not displayed)

community page (to be fixed)

  • promoter logo not loading on community page

I tried to get the URL and open it, and seems like, something is wrong.
IDK if this is be or fe.

Image

  • managers on pending communities aren't loading

  • ambassadors profile picture not loading

  • zero beneficiaries result in infinite icon, should be -- and goal should also be --

Image

L&E - lessons management (webhook prismic)

Create a webhook to know when a document is published on prismic (Quiz).

draft a plan for messages (structure, etc)

Requirements:

  • country group (every user on a given country, once added as beneficiary, manager or ambassador, should be on that group) - no need to list members
  • community group (every user that belongs to a community should be on that group) - no need to list members
  • country management group (managers and ambassadors on a given country should be on that group) - should list members
  • community management group (only ambassador and managers of that community) - should list members

Users on this groups should be automatically members of it, no need to do any action to join. They should not be able to leave.

refactor get community state

add a query param to ask for a "base" or "ubi" state.
?state=base&state=ubi

base = subgraph info
ubi = ubiRate e estimatedDuration

refactor pending community details

I suggest replacing the UbiCommunityContract with a new table. (cloning existing values, so we don't break the app)
Reason: We don't use the contract details anymore once the community is accepted. Also we want to save ambassador registry while community is pending (but not after that) only. And allow to change decreaseStep, minTranche, maxTranche as well as currency (not yet available on contracts, but will be soon)

Also, another good point would be to use float values, human readable, and not those big ones with 18 decimals anymore.

Also set the "review" of all valid communities to "accepted" (or whatever is the value, can't remember exactly now), so the existing ones don't show the "claim" option.

fix dependencies warnings

After installing with nodejs 18.x

warning lerna > @lerna/bootstrap > [email protected]: The functionality that this package provided is now in @npmcli/arborist
warning lerna > @lerna/bootstrap > read-package-tree > [email protected]: This functionality has been moved to @npmcli/fs
warning lerna > @lerna/version > temp-write > [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
warning lerna > @lerna/add > pacote > cacache > @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
warning lerna > @lerna/add > pacote > @npmcli/run-script > node-gyp > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning lerna > @lerna/publish > @lerna/run-lifecycle > npm-lifecycle > node-gyp > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning lerna > @lerna/add > pacote > @npmcli/run-script > node-gyp > request > [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
warning lerna > @lerna/add > pacote > @npmcli/run-script > node-gyp > request > [email protected]: this library is no longer supported
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/core > @hubspot/api-client > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/core > aws-sdk > [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket-lambda/media > aws-sdk > [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/core > coveralls > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/core > @types/[email protected]: This is a stub types definition. redis provides its own type definitions, so you do not need this installed.
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/worker > [email protected]: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws    For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/worker > [email protected]: ganache-cli is now ganache; visit https://trfl.io/g7 for details
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/core > aws-sdk > [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket-lambda/media > aws-sdk > [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/orchestrator > aws-sdk > [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/community-metrics-lambda > serverless > aws-sdk > [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/core > aws-sdk > url > [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/api > @types/rate-limit-redis > @types/[email protected]: This is a stub types definition. ioredis provides its own type definitions, so you do not need this installed.
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/core > chai-http > [email protected]: Please upgrade to v7.0.2+ of superagent.  We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing.  See the releases tab for more information at <https://github.com/visionmedia/superagent/releases>.
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/core > eslint-config-universe > [email protected]: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/community-metrics-lambda > serverless > @serverless/platform-client > [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/core > chai-http > superagent > [email protected]: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/community-metrics-lambda > serverless > json-refs > path-loader > [email protected]: Please downgrade to v7.1.5 if you need IE/ActiveXObject support OR upgrade to v8.0.0 as we no longer support IE and published an incorrect patch version (see https://github.com/visionmedia/superagent/issues/1731)
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket-lambda/media > serverless-bundle > [email protected]: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/orchestrator > serverless-bundle > [email protected]: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/proposals-lambda > serverless-bundle > [email protected]: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket-lambda/media > serverless-bundle > babel-jest > @jest/transform > jest-haste-map > [email protected]: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket-lambda/media > serverless-bundle > babel-jest > @jest/transform > jest-haste-map > sane > micromatch > snapdragon > [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket-lambda/media > serverless-bundle > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > [email protected]: Use your platform's native performance.now() and performance.timeOrigin.
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket-lambda/media > serverless-bundle > babel-jest > @jest/transform > jest-haste-map > sane > micromatch > snapdragon > source-map-resolve > [email protected]: https://github.com/lydell/resolve-url#deprecated
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket-lambda/media > serverless-bundle > babel-jest > @jest/transform > jest-haste-map > sane > micromatch > snapdragon > source-map-resolve > [email protected]: Please see https://github.com/lydell/urix#deprecated
warning workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket-lambda/media > serverless-bundle > babel-jest > @jest/transform > jest-haste-map > sane > micromatch > snapdragon > source-map-resolve > [email protected]: See https://github.com/lydell/source-map-url#deprecated
[3/5] ๐Ÿšš  Fetching packages...
[4/5] ๐Ÿ”—  Linking dependencies...
warning "workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/api > [email protected]" has unmet peer dependency "@types/node@*".
warning "workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/worker > [email protected]" has incorrect peer dependency "subscriptions-transport-ws@^0.9.0".
warning "workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/worker > [email protected]" has unmet peer dependency "graphql@^15.7.2 || ^16.0.0".
warning "workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/community-metrics-lambda > [email protected]" has unmet peer dependency "typescript@*".
warning "workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/community-metrics-lambda > serverless-webpack > [email protected]" has unmet peer dependency "@types/node@*".
warning "workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/community-metrics-lambda > serverless-webpack > [email protected]" has unmet peer dependency "typescript@>=2.7".
warning "workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket-lambda/media > [email protected]" has incorrect peer dependency "serverless@2".
warning "workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/api > swagger-jsdoc > swagger-parser > @apidevtools/[email protected]" has unmet peer dependency "openapi-types@>=7".
warning "workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket/proposals-lambda > [email protected]" has unmet peer dependency "serverless@1 || 2 || 3".
warning "workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket-lambda/media > serverless-bundle > [email protected]" has unmet peer dependency "react@^16.8.0 || ^17.0.0".
warning "workspace-aggregator-7a62986e-11fa-46d5-84d9-0994f7d6aea2 > @impactmarket-lambda/media > serverless-bundle > [email protected]" has unmet peer dependency "react-dom@^16.8.0 || ^17.0.0".
warning Workspaces can only be enabled in private projects.

run our own TheGraph indexer

Dependant on #349 and #355

TheGraph on Celo is only available thought the hosted service, a centralized service hosted by Edge&Node. Tough, those responses are too slow. Should we consider running our own until Celo is available on decentralized network of TheGraph?

https://github.com/graphprotocol/graph-node
https://thegraph.com/docs/en/indexing/#what-are-the-hardware-requirements

Image

It happens when loading a single community too. Half of this requests take less than 200ms (which is already a lot) but it's just half, the other half takes longer than that, with some of then taking like 5 seconds

Image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.