Skip to content

Commit

Permalink
Merge pull request #104 from decentraland/feat/add-favorites
Browse files Browse the repository at this point in the history
feat: introduce favorites logic
  • Loading branch information
juanmahidalgo authored May 8, 2024
2 parents 39d9f12 + e9e6cf2 commit f77b69b
Show file tree
Hide file tree
Showing 107 changed files with 21,275 additions and 7,800 deletions.
23 changes: 18 additions & 5 deletions .env.default
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ CORS_METHODS=*

HTTP_SERVER_PORT=3000
HTTP_SERVER_HOST=0.0.0.0
MARKETPLACE_FAVORITES_SERVER_URL=https://marketplace-favorites-api.decentraland.org

# reset metrics at 00:00UTC
WKC_METRICS_RESET_AT_NIGHT=false
Expand All @@ -21,7 +20,21 @@ WERT_PUBLICATION_FEES_PRIVATE_KEY='dummyKey2'
SEGMENT_WRITE_KEY='dummyKey3'
BUILDER_SERVER_DB_USER='dummyUser'
BUILDER_SERVER_DB_PASSWORD='dummyPassword'
PG_COMPONENT_PSQL_USER='dummyUser'
PG_COMPONENT_PSQL_SCHEMA='public'
PG_COMPONENT_PSQL_HOST='dummyHost'
PG_COMPONENT_PSQL_PORT=5432

SUBSTREAMS_PG_COMPONENT_PSQL_USER=
SUBSTREAMS_PG_COMPONENT_PSQL_PASSWORD='password'
SUBSTREAMS_PG_COMPONENT_PSQL_SCHEMA='public'
SUBSTREAMS_PG_COMPONENT_PSQL_HOST='localhost'
SUBSTREAMS_PG_COMPONENT_PSQL_PORT=5432
SUBSTREAMS_PG_COMPONENT_PSQL_DATABASE='substreams'

# favorites related secrets
FAVORITES_PG_COMPONENT_PSQL_USER=
FAVORITES_PG_COMPONENT_PSQL_PASSWORD='password'
FAVORITES_PG_COMPONENT_PSQL_SCHEMA='public'
FAVORITES_PG_COMPONENT_PSQL_HOST='localhost'
FAVORITES_PG_COMPONENT_PSQL_PORT=5432
FAVORITES_PG_COMPONENT_PSQL_DATABASE='favorites'
SNAPSHOT_URL=https://score.snapshot.org/
SNAPSHOT_NETWORK=1
SNAPSHOT_SPACE=snapshot.dcl.eth
8 changes: 8 additions & 0 deletions .env.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
HTTP_SERVER_HOST=localhost

FAVORITES_PG_COMPONENT_PSQL_CONNECTION_STRING=postgres://testuser:testpassword@localhost:5432/marketplace
FAVORITES_PG_COMPONENT_PSQL_SCHEMA=favorites

SNAPSHOT_URL=https://score.snapshot.org/
SNAPSHOT_NETWORK=11155111
SNAPSHOT_SPACE=daotest.dcl.eth
4 changes: 4 additions & 0 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Start postgres
run: docker compose up -d --renew-anon-volumes
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
Expand All @@ -21,6 +23,8 @@ jobs:
if: ${{ always() }}
- name: test
run: npm run test
- name: integration test
run: npm run test:integration
- name: Report coverage
uses: coverallsapp/github-action@master
with:
Expand Down
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Utilitarian compose file to locally run postgres service
# for integration testing purposes.

version: '3.8'

services:
postgres:
image: postgres
restart: always
environment:
- POSTGRES_USER=admin
- POSTGRES_PASSWORD=password
- POSTGRES_DB=marketplace
ports:
- 5432:5432
volumes:
- postgres_data:/var/lib/postgresql/data
- ./test/db/init-schema.sh:/docker-entrypoint-initdb.d/init-schema.sh

volumes:
postgres_data:
12 changes: 12 additions & 0 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"moduleFileExtensions": ["ts", "js"],
"transform": {
"^.+\\.(ts|tsx)$": "ts-jest"
},
"coverageDirectory": "coverage",
"collectCoverageFrom": ["src/**/*.ts", "src/**/*.js"],
"coveragePathIgnorePatterns": ["/node_modules/", "index.ts", "src/migrations"],
"testMatch": ["**/test/unit/*.spec.(ts)"],
"testEnvironment": "node",
"resetMocks": true
}
10 changes: 10 additions & 0 deletions jest.integration.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"moduleFileExtensions": ["ts", "js"],
"transform": {
"^.+\\.(ts|tsx)$": "ts-jest"
},
"testMatch": ["**/test/integration/*.spec.(ts)"],
"testEnvironment": "node",
"resetMocks": true,
"setupFilesAfterEnv": ["./jest.setup.ts"]
}
6 changes: 6 additions & 0 deletions jest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import nock from 'nock'

nock.disableNetConnect()

// Allow localhost connections so we can test local routes and mock servers.
nock.enableNetConnect('0.0.0.0|127.0.0.1|localhost')
Loading

0 comments on commit f77b69b

Please sign in to comment.