-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from wri/release/utltimate-ulmus
[RELEASE] Utltimate Ulmus
- Loading branch information
Showing
105 changed files
with
6,188 additions
and
1,942 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
USER_SERVICE_PORT=4010 | ||
JOB_SERVICE_PORT=4020 | ||
RESEARCH_SERVICE_PORT=4030 | ||
UNIFIED_DATABASE_SERVICE_PORT=4040 | ||
ENTITY_SERVICE_PORT=4050 | ||
|
||
DB_HOST=localhost | ||
DB_PORT=3360 | ||
DB_DATABASE=wri_restoration_marketplace_api | ||
DB_USERNAME=wri | ||
DB_PASSWORD=wri | ||
|
||
REDIS_HOST=localhost | ||
REDIS_PORT=6379 | ||
|
||
JWT_SECRET=qu3sep4GKdbg6PiVPCKLKljHukXALorq6nLHDBOCSwvs6BrgE6zb8gPmZfrNspKt | ||
|
||
# Only needed for the unified database service. Most developers should not have this defined. | ||
AIRTABLE_API_KEY |
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 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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"extends": ["../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* eslint-disable */ | ||
export default { | ||
displayName: "entity-service-e2e", | ||
preset: "../../jest.preset.js", | ||
globalSetup: "<rootDir>/src/support/global-setup.ts", | ||
globalTeardown: "<rootDir>/src/support/global-teardown.ts", | ||
setupFiles: ["<rootDir>/src/support/test-setup.ts"], | ||
testEnvironment: "node", | ||
transform: { | ||
"^.+\\.[tj]s$": [ | ||
"ts-jest", | ||
{ | ||
tsconfig: "<rootDir>/tsconfig.spec.json" | ||
} | ||
] | ||
}, | ||
moduleFileExtensions: ["ts", "js", "html"], | ||
coverageDirectory: "../../coverage/entity-service-e2e" | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "entity-service-e2e", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"projectType": "application", | ||
"implicitDependencies": ["entity-service"], | ||
"targets": { | ||
"e2e": { | ||
"executor": "@nx/jest:jest", | ||
"outputs": ["{workspaceRoot}/coverage/{e2eProjectRoot}"], | ||
"options": { | ||
"jestConfig": "apps/entity-service-e2e/jest.config.ts", | ||
"passWithNoTests": true | ||
}, | ||
"dependsOn": ["entity-service:build"] | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
apps/entity-service-e2e/src/entity-service/entity-service.spec.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import axios from "axios"; | ||
|
||
describe("GET /api", () => { | ||
it("should return a message", async () => { | ||
const res = await axios.get(`/api`); | ||
|
||
expect(res.status).toBe(200); | ||
expect(res.data).toEqual({ message: "Hello API" }); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* eslint-disable */ | ||
var __TEARDOWN_MESSAGE__: string; | ||
|
||
module.exports = async function () { | ||
// Start services that that the app needs to run (e.g. database, docker-compose, etc.). | ||
console.log("\nSetting up...\n"); | ||
|
||
// Hint: Use `globalThis` to pass variables to global teardown. | ||
globalThis.__TEARDOWN_MESSAGE__ = "\nTearing down...\n"; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* eslint-disable */ | ||
|
||
module.exports = async function () { | ||
// Put clean up logic here (e.g. stopping services, docker-compose, etc.). | ||
// Hint: `globalThis` is shared between setup and teardown. | ||
console.log(globalThis.__TEARDOWN_MESSAGE__); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* eslint-disable */ | ||
|
||
import axios from "axios"; | ||
|
||
module.exports = async function () { | ||
// Configure axios for tests to use. | ||
const host = process.env.HOST ?? "localhost"; | ||
const port = process.env.PORT ?? "3000"; | ||
axios.defaults.baseURL = `http://${host}:${port}`; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"files": [], | ||
"include": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.spec.json" | ||
} | ||
], | ||
"compilerOptions": { | ||
"esModuleInterop": true | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"module": "commonjs", | ||
"types": ["jest", "node"] | ||
}, | ||
"include": ["jest.config.ts", "src/**/*.ts"] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"extends": ["../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM terramatch-microservices-base:nx-base AS builder | ||
|
||
ARG BUILD_FLAG | ||
WORKDIR /app/builder | ||
COPY . . | ||
RUN npx nx build entity-service ${BUILD_FLAG} | ||
|
||
FROM terramatch-microservices-base:nx-base | ||
|
||
ARG NODE_ENV | ||
WORKDIR /app | ||
COPY --from=builder /app/builder ./ | ||
ENV NODE_ENV=${NODE_ENV} | ||
|
||
CMD ["node", "./dist/apps/entity-service/main.js"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* eslint-disable */ | ||
export default { | ||
displayName: "entity-service", | ||
preset: "../../jest.preset.js", | ||
testEnvironment: "node", | ||
transform: { | ||
"^.+\\.[tj]s$": ["ts-jest", { tsconfig: "<rootDir>/tsconfig.spec.json" }] | ||
}, | ||
moduleFileExtensions: ["ts", "js", "html"], | ||
coverageDirectory: "../../coverage/apps/entity-service" | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "entity-service", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "apps/entity-service/src", | ||
"projectType": "application", | ||
"tags": [], | ||
"targets": { | ||
"serve": { | ||
"executor": "@nx/js:node", | ||
"defaultConfiguration": "development", | ||
"dependsOn": ["build"], | ||
"options": { | ||
"buildTarget": "entity-service:build", | ||
"runBuildTargetDependencies": false | ||
}, | ||
"configurations": { | ||
"development": { | ||
"buildTarget": "entity-service:build:development" | ||
}, | ||
"production": { | ||
"buildTarget": "entity-service:build:production" | ||
} | ||
} | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Module } from "@nestjs/common"; | ||
import { DatabaseModule } from "@terramatch-microservices/database"; | ||
import { CommonModule } from "@terramatch-microservices/common"; | ||
import { HealthModule } from "./health/health.module"; | ||
import { TreesController } from "./trees/trees.controller"; | ||
import { TreeService } from "./trees/tree.service"; | ||
import { SentryGlobalFilter, SentryModule } from "@sentry/nestjs/setup"; | ||
import { APP_FILTER } from "@nestjs/core"; | ||
|
||
@Module({ | ||
imports: [SentryModule.forRoot(), DatabaseModule, CommonModule, HealthModule], | ||
controllers: [TreesController], | ||
providers: [ | ||
{ | ||
provide: APP_FILTER, | ||
useClass: SentryGlobalFilter | ||
}, | ||
TreeService | ||
] | ||
}) | ||
export class AppModule {} |
Empty 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Controller, Get } from '@nestjs/common'; | ||
import { HealthCheck, HealthCheckService, SequelizeHealthIndicator } from '@nestjs/terminus'; | ||
import { NoBearerAuth } from '@terramatch-microservices/common/guards'; | ||
import { ApiExcludeController } from '@nestjs/swagger'; | ||
import { User } from '@terramatch-microservices/database/entities'; | ||
|
||
@Controller('health') | ||
@ApiExcludeController() | ||
export class HealthController { | ||
constructor( | ||
private readonly health: HealthCheckService, | ||
private readonly db: SequelizeHealthIndicator | ||
) {} | ||
|
||
@Get() | ||
@HealthCheck() | ||
@NoBearerAuth | ||
async check() { | ||
const connection = await User.sequelize.connectionManager.getConnection({ type: 'read' }); | ||
try { | ||
return this.health.check([ | ||
() => this.db.pingCheck('database', { connection }) | ||
]); | ||
} finally { | ||
User.sequelize.connectionManager.releaseConnection(connection); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { TerminusModule } from '@nestjs/terminus'; | ||
import { HealthController } from './health.controller'; | ||
|
||
@Module({ | ||
imports: [TerminusModule], | ||
controllers: [HealthController], | ||
}) | ||
export class HealthModule {} |
Oops, something went wrong.