Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@
"plugins": ["@trivago/prettier-plugin-sort-imports"],
"singleQuote": true,
"trailingComma": "all",
"importOrder": ["^@nestjs/(.*)$", "<THIRD_PARTY_MODULES>", "^src/(.*)$", "^[./]"],
"importOrder": [
"^@nestjs/(.*)$",
"<THIRD_PARTY_MODULES>",
"^src/(.*)$",
"^[./]"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"importOrderParserPlugins" : ["typescript", "[\"decorators-legacy\", {\"decoratorsBeforeExport\": true}]"]
}
"importOrderParserPlugins": [
"typescript",
"[\"decorators-legacy\", {\"decoratorsBeforeExport\": true}]"
]
}
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ NestJS boilerplate with TypeORM, GraphQL and PostgreSQL
- [1. Open for Contribution](#1-open-for-contribution)

- [2. Getting Started](#2-getting-started)

- [2.1. Installation](#21-installation)
- [2.2. Run](#22-run)

- [3. Docker](#3-docker)

- [3.1. Docker Compose Installation](#31-docker-compose-installation)
- [3.2. Before Getting Started](#32-before-getting-started)
- [3.3. Run](#33-run)
Expand All @@ -24,11 +22,9 @@ NestJS boilerplate with TypeORM, GraphQL and PostgreSQL
- [5. PostgreSQL Database](#5-postgresql-database)

- [6. TypeORM](#6-typeorm)

- [6.1. Migration Setup and Usage](#61-migration-setup-and-usage)

- [7. GraphQL](#7-graphql)

- [7.1. Protected Queries/Mutation By Role](#71-protected-queriesmutation-by-role)
- [7.2. GraphQL Query To Select and Relations](#72-graphql-query-to-select-and-relations)
- [7.3. Field-Level Permission](#73-field-level-permission)
Expand All @@ -39,24 +35,20 @@ NestJS boilerplate with TypeORM, GraphQL and PostgreSQL
- [9. Code generator](#9-code-generator)

- [10. Caching](#10-caching)

- [10.1. How To Use](#101-how-to-use)

- [11. TDD](#11-tdd)

- [11.1. Introduction](#111-introduction)
- [11.2. Before Getting Started](#112-before-getting-started)
- [11.3. Unit Test (with mock)](#113-unit-test-with-mock)
- [11.4. Integration Test (with in-memory DB)](#114-integration-test-with-in-memory-db)
- [11.5. End To End Test (with docker)](#115-end-to-end-test-with-docker)

- [12. CI](#12-ci)

- [12.1. Github Actions](#121-github-actions)
- [12.2. Husky v9](#122-husky-v9)

- [13. SWC Compiler](#13-swc-compiler)

- [13.1. SWC + Jest error resolution](#131-swc--jest-error-resolution)

- [14. Todo](#14-todo)
Expand Down Expand Up @@ -494,13 +486,11 @@ db.public.registerFunction({
## 14. Todo

- [x] TDD

- [x] Unit Test (Use mock)
- [x] Integration Test (Use in-memory DB)
- [x] End To End Test (Use docker)

- [x] CI

- [x] Github actions
- [x] husky

Expand Down
96 changes: 50 additions & 46 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,80 +37,81 @@
"migration:revert": "yarn typeorm migration:revert"
},
"dependencies": {
"@apollo/server": "^4.12.2",
"@aws-sdk/client-s3": "^3.842.0",
"@aws-sdk/lib-storage": "^3.842.0",
"@aws-sdk/types": "^3.840.0",
"@nestjs/apollo": "^13.1.0",
"@nestjs/axios": "^4.0.0",
"@apollo/server": "^5.2.0",
"@as-integrations/express5": "^1.1.2",
"@aws-sdk/client-s3": "^3.943.0",
"@aws-sdk/lib-storage": "^3.943.0",
"@aws-sdk/types": "^3.936.0",
"@nestjs/apollo": "^13.2.1",
"@nestjs/axios": "^4.0.1",
"@nestjs/cache-manager": "^3.0.1",
"@nestjs/common": "^11.1.3",
"@nestjs/common": "^11.1.9",
"@nestjs/config": "^4.0.2",
"@nestjs/core": "^11.1.3",
"@nestjs/graphql": "^13.1.0",
"@nestjs/jwt": "^11.0.0",
"@nestjs/core": "^11.1.9",
"@nestjs/graphql": "^13.2.0",
"@nestjs/jwt": "^11.0.1",
"@nestjs/passport": "^11.0.5",
"@nestjs/platform-express": "^11.1.3",
"@nestjs/platform-express": "^11.1.9",
"@nestjs/terminus": "^11.0.0",
"@nestjs/typeorm": "^11.0.0",
"apollo-server-core": "^3.13.0",
"apollo-server-express": "^3.13.0",
"axios": "^1.10.0",
"axios": "^1.13.2",
"bcrypt": "^6.0.0",
"cache-manager": "^7.0.1",
"cache-manager": "^7.2.5",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.2",
"graphql": "^16.11.0",
"class-validator": "^0.14.3",
"graphql": "^16.12.0",
"graphql-type-json": "^0.3.2",
"graphql-upload": "^13.0.0",
"ora": "^8.2.0",
"ora": "^9.0.0",
"passport": "^0.7.0",
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
"pg": "^8.16.3",
"reflect-metadata": "^0.2.2",
"rimraf": "^6.0.1",
"rimraf": "^6.1.2",
"rxjs": "^7.8.2",
"typeorm": "^0.3.25",
"uuid": "^11.1.0"
"typeorm": "^0.3.27",
"uuid": "^13.0.0"
},
"devDependencies": {
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.30.1",
"@nestjs/cli": "^11.0.7",
"@nestjs/schematics": "^11.0.5",
"@nestjs/testing": "^11.1.3",
"@swc/cli": "^0.7.7",
"@swc/core": "^1.12.11",
"@swc/jest": "^0.2.38",
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
"@types/bcrypt": "^5.0.2",
"@types/express": "^5.0.3",
"@eslint/eslintrc": "^3.3.3",
"@eslint/js": "^9.39.1",
"@nestjs/cli": "^11.0.14",
"@nestjs/schematics": "^11.0.9",
"@nestjs/testing": "^11.1.9",
"@swc/cli": "^0.7.9",
"@swc/core": "^1.15.3",
"@swc/jest": "^0.2.39",
"@trivago/prettier-plugin-sort-imports": "^6.0.0",
"@types/bcrypt": "^6.0.0",
"@types/express": "^5.0.6",
"@types/graphql-upload": "^8.0.12",
"@types/jest": "30.0.0",
"@types/node": "^22.15.31",
"@types/node": "^24.10.1",
"@types/passport-jwt": "^4.0.1",
"@types/passport-local": "^1.0.38",
"@types/supertest": "^6.0.3",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^8.36.0",
"@typescript-eslint/parser": "^8.36.0",
"eslint": "^9.30.1",
"eslint-config-prettier": "^10.1.5",
"eslint-plugin-prettier": "^5.5.1",
"globals": "^16.3.0",
"@types/uuid": "^11.0.0",
"@typescript-eslint/eslint-plugin": "^8.48.1",
"@typescript-eslint/parser": "^8.48.1",
"eslint": "^9.39.1",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.4",
"globals": "^16.5.0",
"husky": "^9.1.7",
"jest": "^30.0.4",
"jest": "^30.2.0",
"pg-mem": "^3.0.5",
"plop": "^4.0.1",
"prettier": "^3.6.2",
"plop": "^4.0.4",
"prettier": "^3.7.3",
"source-map-support": "^0.5.21",
"supertest": "^7.1.3",
"ts-jest": "^29.4.0",
"ts-loader": "^9.5.2",
"supertest": "^7.1.4",
"ts-jest": "^29.4.6",
"ts-loader": "^9.5.4",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "5.8.3"
"typescript": "5.9.3"
},
"jest": {
"moduleFileExtensions": [
Expand Down Expand Up @@ -138,6 +139,9 @@
"**/*.(t|j)s"
],
"coverageDirectory": "coverage",
"testEnvironment": "node"
"testEnvironment": "node",
"transformIgnorePatterns": [
"node_modules/(?!(uuid)/)"
]
}
}
4 changes: 1 addition & 3 deletions src/common/config/graphql-config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ import { httpStatusPlugin } from '../exceptions/exception.plugin';
import { EnvironmentVariables } from '../helper/env.validation';

@Injectable()
export class GraphqlConfigService
implements GqlOptionsFactory<ApolloDriverConfig>
{
export class GraphqlConfigService implements GqlOptionsFactory<ApolloDriverConfig> {
constructor(
private readonly configService: ConfigService<EnvironmentVariables>,
) {}
Expand Down
5 changes: 3 additions & 2 deletions src/common/graphql/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ export interface GetInfoFromQueryProps<Entity> {
select: FindOptionsSelect<Entity>;
}

export interface AddKeyValueInObjectProps<Entity>
extends GetInfoFromQueryProps<Entity> {
export interface AddKeyValueInObjectProps<
Entity,
> extends GetInfoFromQueryProps<Entity> {
stack: string[];
expandRelation?: boolean;
}
6 changes: 3 additions & 3 deletions src/common/interceptors/repository.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import { DataSource, EntityTarget, ObjectLiteral } from 'typeorm';
import { REPOSITORY_INTERCEPTOR } from '../decorators/repository-interceptor.decorator';

@Injectable()
export class QueryIntercepter<T extends ObjectLiteral>
implements NestInterceptor
{
export class QueryIntercepter<
T extends ObjectLiteral,
> implements NestInterceptor {
constructor(private readonly dataSource: DataSource) {}

intercept(context: ExecutionContext, next: CallHandler): Observable<unknown> {
Expand Down
13 changes: 3 additions & 10 deletions test/jest-e2e.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
{
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": ".",
"testEnvironment": "node",
"testRegex": ".e2e-spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"moduleDirectories": [
"<rootDir>/../",
"node_modules"
]
}
"moduleDirectories": ["<rootDir>/../", "node_modules"]
}
Loading