Compare commits
No commits in common. "e98758efe2b55f4686dcd2987bd7c1af2b64b338" and "e2114f5b7f9b0ddd4341061cbd7eee4e7838676e" have entirely different histories.
e98758efe2
...
e2114f5b7f
149
.codacy/cli.sh
149
.codacy/cli.sh
|
|
@ -1,149 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
|
|
||||||
set -e +o pipefail
|
|
||||||
|
|
||||||
# Set up paths first
|
|
||||||
bin_name="codacy-cli-v2"
|
|
||||||
|
|
||||||
# Determine OS-specific paths
|
|
||||||
os_name=$(uname)
|
|
||||||
arch=$(uname -m)
|
|
||||||
|
|
||||||
case "$arch" in
|
|
||||||
"x86_64")
|
|
||||||
arch="amd64"
|
|
||||||
;;
|
|
||||||
"x86")
|
|
||||||
arch="386"
|
|
||||||
;;
|
|
||||||
"aarch64"|"arm64")
|
|
||||||
arch="arm64"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -z "$CODACY_CLI_V2_TMP_FOLDER" ]; then
|
|
||||||
if [ "$(uname)" = "Linux" ]; then
|
|
||||||
CODACY_CLI_V2_TMP_FOLDER="$HOME/.cache/codacy/codacy-cli-v2"
|
|
||||||
elif [ "$(uname)" = "Darwin" ]; then
|
|
||||||
CODACY_CLI_V2_TMP_FOLDER="$HOME/Library/Caches/Codacy/codacy-cli-v2"
|
|
||||||
else
|
|
||||||
CODACY_CLI_V2_TMP_FOLDER=".codacy-cli-v2"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
version_file="$CODACY_CLI_V2_TMP_FOLDER/version.yaml"
|
|
||||||
|
|
||||||
|
|
||||||
get_version_from_yaml() {
|
|
||||||
if [ -f "$version_file" ]; then
|
|
||||||
local version=$(grep -o 'version: *"[^"]*"' "$version_file" | cut -d'"' -f2)
|
|
||||||
if [ -n "$version" ]; then
|
|
||||||
echo "$version"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
get_latest_version() {
|
|
||||||
local response
|
|
||||||
if [ -n "$GH_TOKEN" ]; then
|
|
||||||
response=$(curl -Lq --header "Authorization: Bearer $GH_TOKEN" "https://api.github.com/repos/codacy/codacy-cli-v2/releases/latest" 2>/dev/null)
|
|
||||||
else
|
|
||||||
response=$(curl -Lq "https://api.github.com/repos/codacy/codacy-cli-v2/releases/latest" 2>/dev/null)
|
|
||||||
fi
|
|
||||||
|
|
||||||
handle_rate_limit "$response"
|
|
||||||
local version=$(echo "$response" | grep -m 1 tag_name | cut -d'"' -f4)
|
|
||||||
echo "$version"
|
|
||||||
}
|
|
||||||
|
|
||||||
handle_rate_limit() {
|
|
||||||
local response="$1"
|
|
||||||
if echo "$response" | grep -q "API rate limit exceeded"; then
|
|
||||||
fatal "Error: GitHub API rate limit exceeded. Please try again later"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
download_file() {
|
|
||||||
local url="$1"
|
|
||||||
|
|
||||||
echo "Downloading from URL: ${url}"
|
|
||||||
if command -v curl > /dev/null 2>&1; then
|
|
||||||
curl -# -LS "$url" -O
|
|
||||||
elif command -v wget > /dev/null 2>&1; then
|
|
||||||
wget "$url"
|
|
||||||
else
|
|
||||||
fatal "Error: Could not find curl or wget, please install one."
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
download() {
|
|
||||||
local url="$1"
|
|
||||||
local output_folder="$2"
|
|
||||||
|
|
||||||
( cd "$output_folder" && download_file "$url" )
|
|
||||||
}
|
|
||||||
|
|
||||||
download_cli() {
|
|
||||||
# OS name lower case
|
|
||||||
suffix=$(echo "$os_name" | tr '[:upper:]' '[:lower:]')
|
|
||||||
|
|
||||||
local bin_folder="$1"
|
|
||||||
local bin_path="$2"
|
|
||||||
local version="$3"
|
|
||||||
|
|
||||||
if [ ! -f "$bin_path" ]; then
|
|
||||||
echo "📥 Downloading CLI version $version..."
|
|
||||||
|
|
||||||
remote_file="codacy-cli-v2_${version}_${suffix}_${arch}.tar.gz"
|
|
||||||
url="https://github.com/codacy/codacy-cli-v2/releases/download/${version}/${remote_file}"
|
|
||||||
|
|
||||||
download "$url" "$bin_folder"
|
|
||||||
tar xzfv "${bin_folder}/${remote_file}" -C "${bin_folder}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Warn if CODACY_CLI_V2_VERSION is set and update is requested
|
|
||||||
if [ -n "$CODACY_CLI_V2_VERSION" ] && [ "$1" = "update" ]; then
|
|
||||||
echo "⚠️ Warning: Performing update with forced version $CODACY_CLI_V2_VERSION"
|
|
||||||
echo " Unset CODACY_CLI_V2_VERSION to use the latest version"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Ensure version.yaml exists and is up to date
|
|
||||||
if [ ! -f "$version_file" ] || [ "$1" = "update" ]; then
|
|
||||||
echo "ℹ️ Fetching latest version..."
|
|
||||||
version=$(get_latest_version)
|
|
||||||
mkdir -p "$CODACY_CLI_V2_TMP_FOLDER"
|
|
||||||
echo "version: \"$version\"" > "$version_file"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Set the version to use
|
|
||||||
if [ -n "$CODACY_CLI_V2_VERSION" ]; then
|
|
||||||
version="$CODACY_CLI_V2_VERSION"
|
|
||||||
else
|
|
||||||
version=$(get_version_from_yaml)
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Set up version-specific paths
|
|
||||||
bin_folder="${CODACY_CLI_V2_TMP_FOLDER}/${version}"
|
|
||||||
|
|
||||||
mkdir -p "$bin_folder"
|
|
||||||
bin_path="$bin_folder"/"$bin_name"
|
|
||||||
|
|
||||||
# Download the tool if not already installed
|
|
||||||
download_cli "$bin_folder" "$bin_path" "$version"
|
|
||||||
chmod +x "$bin_path"
|
|
||||||
|
|
||||||
run_command="$bin_path"
|
|
||||||
if [ -z "$run_command" ]; then
|
|
||||||
fatal "Codacy cli v2 binary could not be found."
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$#" -eq 1 ] && [ "$1" = "download" ]; then
|
|
||||||
echo "Codacy cli v2 download succeeded"
|
|
||||||
else
|
|
||||||
eval "$run_command $*"
|
|
||||||
fi
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
runtimes:
|
|
||||||
- dart@3.7.2
|
|
||||||
- go@1.22.3
|
|
||||||
- java@17.0.10
|
|
||||||
- node@22.2.0
|
|
||||||
- python@3.11.11
|
|
||||||
tools:
|
|
||||||
- dartanalyzer@3.7.2
|
|
||||||
- eslint@8.57.0
|
|
||||||
- lizard@1.17.31
|
|
||||||
- pmd@7.11.0
|
|
||||||
- pylint@3.3.6
|
|
||||||
- revive@1.7.0
|
|
||||||
- semgrep@1.78.0
|
|
||||||
- trivy@0.66.0
|
|
||||||
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -1,5 +1 @@
|
||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
|
|
||||||
#Ignore vscode AI rules
|
|
||||||
.github/instructions/codacy.instructions.md
|
|
||||||
|
|
|
||||||
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"cSpell.words": ["nestjs", "nodenext", "nuxt", "postgres", "tailwindcss"]
|
"cSpell.words": ["nuxt", "tailwindcss"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
56
apps/api/.gitignore
vendored
56
apps/api/.gitignore
vendored
|
|
@ -1,56 +0,0 @@
|
||||||
# compiled output
|
|
||||||
/dist
|
|
||||||
/node_modules
|
|
||||||
/build
|
|
||||||
|
|
||||||
# Logs
|
|
||||||
logs
|
|
||||||
*.log
|
|
||||||
npm-debug.log*
|
|
||||||
pnpm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
lerna-debug.log*
|
|
||||||
|
|
||||||
# OS
|
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
# Tests
|
|
||||||
/coverage
|
|
||||||
/.nyc_output
|
|
||||||
|
|
||||||
# IDEs and editors
|
|
||||||
/.idea
|
|
||||||
.project
|
|
||||||
.classpath
|
|
||||||
.c9/
|
|
||||||
*.launch
|
|
||||||
.settings/
|
|
||||||
*.sublime-workspace
|
|
||||||
|
|
||||||
# IDE - VSCode
|
|
||||||
.vscode/*
|
|
||||||
!.vscode/settings.json
|
|
||||||
!.vscode/tasks.json
|
|
||||||
!.vscode/launch.json
|
|
||||||
!.vscode/extensions.json
|
|
||||||
|
|
||||||
# dotenv environment variable files
|
|
||||||
.env
|
|
||||||
.env.development.local
|
|
||||||
.env.test.local
|
|
||||||
.env.production.local
|
|
||||||
.env.local
|
|
||||||
|
|
||||||
# temp directory
|
|
||||||
.temp
|
|
||||||
.tmp
|
|
||||||
|
|
||||||
# Runtime data
|
|
||||||
pids
|
|
||||||
*.pid
|
|
||||||
*.seed
|
|
||||||
*.pid.lock
|
|
||||||
|
|
||||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
||||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"singleQuote": true,
|
|
||||||
"trailingComma": "all"
|
|
||||||
}
|
|
||||||
|
|
@ -1,98 +0,0 @@
|
||||||
<p align="center">
|
|
||||||
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
|
||||||
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
|
||||||
|
|
||||||
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
|
||||||
<p align="center">
|
|
||||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
|
||||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
|
||||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
|
|
||||||
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
|
||||||
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
|
||||||
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
|
||||||
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
|
||||||
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a>
|
|
||||||
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
|
||||||
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a>
|
|
||||||
</p>
|
|
||||||
<!--[](https://opencollective.com/nest#backer)
|
|
||||||
[](https://opencollective.com/nest#sponsor)-->
|
|
||||||
|
|
||||||
## Description
|
|
||||||
|
|
||||||
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
|
|
||||||
|
|
||||||
## Project setup
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ pnpm install
|
|
||||||
```
|
|
||||||
|
|
||||||
## Compile and run the project
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# development
|
|
||||||
$ pnpm run start
|
|
||||||
|
|
||||||
# watch mode
|
|
||||||
$ pnpm run start:dev
|
|
||||||
|
|
||||||
# production mode
|
|
||||||
$ pnpm run start:prod
|
|
||||||
```
|
|
||||||
|
|
||||||
## Run tests
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# unit tests
|
|
||||||
$ pnpm run test
|
|
||||||
|
|
||||||
# e2e tests
|
|
||||||
$ pnpm run test:e2e
|
|
||||||
|
|
||||||
# test coverage
|
|
||||||
$ pnpm run test:cov
|
|
||||||
```
|
|
||||||
|
|
||||||
## Deployment
|
|
||||||
|
|
||||||
When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information.
|
|
||||||
|
|
||||||
If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ pnpm install -g @nestjs/mau
|
|
||||||
$ mau deploy
|
|
||||||
```
|
|
||||||
|
|
||||||
With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.
|
|
||||||
|
|
||||||
## Resources
|
|
||||||
|
|
||||||
Check out a few resources that may come in handy when working with NestJS:
|
|
||||||
|
|
||||||
- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
|
|
||||||
- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
|
|
||||||
- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
|
|
||||||
- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
|
|
||||||
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
|
|
||||||
- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
|
|
||||||
- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
|
|
||||||
- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).
|
|
||||||
|
|
||||||
## Support
|
|
||||||
|
|
||||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
|
||||||
|
|
||||||
## Stay in touch
|
|
||||||
|
|
||||||
- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
|
|
||||||
- Website - [https://nestjs.com](https://nestjs.com/)
|
|
||||||
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
// @ts-check
|
|
||||||
import eslint from '@eslint/js';
|
|
||||||
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
||||||
import globals from 'globals';
|
|
||||||
import tseslint from 'typescript-eslint';
|
|
||||||
|
|
||||||
export default tseslint.config(
|
|
||||||
{
|
|
||||||
ignores: ['eslint.config.mjs'],
|
|
||||||
},
|
|
||||||
eslint.configs.recommended,
|
|
||||||
...tseslint.configs.recommendedTypeChecked,
|
|
||||||
eslintPluginPrettierRecommended,
|
|
||||||
{
|
|
||||||
languageOptions: {
|
|
||||||
globals: {
|
|
||||||
...globals.node,
|
|
||||||
...globals.jest,
|
|
||||||
},
|
|
||||||
sourceType: 'commonjs',
|
|
||||||
parserOptions: {
|
|
||||||
projectService: true,
|
|
||||||
tsconfigRootDir: import.meta.dirname,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
rules: {
|
|
||||||
'@typescript-eslint/no-explicit-any': 'off',
|
|
||||||
'@typescript-eslint/no-floating-promises': 'warn',
|
|
||||||
'@typescript-eslint/no-unsafe-argument': 'warn',
|
|
||||||
"prettier/prettier": ["error", { endOfLine: "auto" }],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/nest-cli",
|
|
||||||
"collection": "@nestjs/schematics",
|
|
||||||
"sourceRoot": "src",
|
|
||||||
"compilerOptions": {
|
|
||||||
"deleteOutDir": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@proj/api",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"description": "",
|
|
||||||
"author": "",
|
|
||||||
"private": true,
|
|
||||||
"license": "UNLICENSED",
|
|
||||||
"scripts": {
|
|
||||||
"build": "nest build",
|
|
||||||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
||||||
"start": "nest start",
|
|
||||||
"start:dev": "nest start --watch",
|
|
||||||
"start:debug": "nest start --debug --watch",
|
|
||||||
"start:prod": "node dist/main",
|
|
||||||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
|
||||||
"test": "vitest run",
|
|
||||||
"test:watch": "vitest",
|
|
||||||
"test:cov": "vitest run --coverage",
|
|
||||||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
|
||||||
"test:e2e": "vitest run --config ./vitest.config.e2e.ts"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@nestjs/common": "^11.0.1",
|
|
||||||
"@nestjs/core": "^11.0.1",
|
|
||||||
"@nestjs/platform-express": "^11.0.1",
|
|
||||||
"drizzle-orm": "^0.45.1",
|
|
||||||
"postgres": "^3.4.8",
|
|
||||||
"reflect-metadata": "^0.2.2",
|
|
||||||
"rxjs": "^7.8.1"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@eslint/eslintrc": "^3.2.0",
|
|
||||||
"@eslint/js": "^9.18.0",
|
|
||||||
"@nestjs/cli": "^11.0.0",
|
|
||||||
"@nestjs/schematics": "^11.0.0",
|
|
||||||
"@nestjs/testing": "^11.0.1",
|
|
||||||
"@types/express": "^5.0.0",
|
|
||||||
"@types/jest": "^30.0.0",
|
|
||||||
"@types/node": "^22.10.7",
|
|
||||||
"@types/supertest": "^6.0.2",
|
|
||||||
"@vitest/coverage-v8": "^4.0.18",
|
|
||||||
"eslint": "^9.18.0",
|
|
||||||
"eslint-config-prettier": "^10.0.1",
|
|
||||||
"eslint-plugin-prettier": "^5.2.2",
|
|
||||||
"globals": "^16.0.0",
|
|
||||||
"prettier": "^3.4.2",
|
|
||||||
"source-map-support": "^0.5.21",
|
|
||||||
"supertest": "^7.0.0",
|
|
||||||
"ts-jest": "^29.2.5",
|
|
||||||
"ts-loader": "^9.5.2",
|
|
||||||
"ts-node": "^10.9.2",
|
|
||||||
"tsconfig-paths": "^4.2.0",
|
|
||||||
"typescript": "^5.7.3",
|
|
||||||
"typescript-eslint": "^8.20.0",
|
|
||||||
"unplugin-swc": "^1.5.9",
|
|
||||||
"vitest": "^4.0.18"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
import { Test, TestingModule } from '@nestjs/testing';
|
|
||||||
import { AppController } from './app.controller';
|
|
||||||
import { AppService } from './app.service';
|
|
||||||
import { describe, beforeEach, it, expect } from 'vitest';
|
|
||||||
|
|
||||||
describe('AppController', () => {
|
|
||||||
let appController: AppController;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
const app: TestingModule = await Test.createTestingModule({
|
|
||||||
controllers: [AppController],
|
|
||||||
providers: [AppService],
|
|
||||||
}).compile();
|
|
||||||
|
|
||||||
appController = app.get<AppController>(AppController);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('root', () => {
|
|
||||||
it('should return "Hello World!"', () => {
|
|
||||||
expect(appController.getHello()).toBe('Hello World!');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
import { Controller, Get } from '@nestjs/common';
|
|
||||||
import { AppService } from './app.service';
|
|
||||||
|
|
||||||
@Controller()
|
|
||||||
export class AppController {
|
|
||||||
constructor(private readonly appService: AppService) {}
|
|
||||||
|
|
||||||
@Get()
|
|
||||||
getHello(): string {
|
|
||||||
return this.appService.getHello();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
import { Module } from '@nestjs/common';
|
|
||||||
import { AppController } from './app.controller';
|
|
||||||
import { AppService } from './app.service';
|
|
||||||
import { DatabaseModule } from './database/database.module';
|
|
||||||
|
|
||||||
@Module({
|
|
||||||
imports: [DatabaseModule],
|
|
||||||
controllers: [AppController],
|
|
||||||
providers: [AppService],
|
|
||||||
})
|
|
||||||
export class AppModule {}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
import { Injectable } from '@nestjs/common';
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class AppService {
|
|
||||||
getHello(): string {
|
|
||||||
return 'Hello World!';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
import { Global, Module } from '@nestjs/common';
|
|
||||||
import { DatabaseProvider, DRIZZLE_CLIENT } from './database.provider';
|
|
||||||
|
|
||||||
@Global()
|
|
||||||
@Module({
|
|
||||||
providers: [DatabaseProvider],
|
|
||||||
exports: [DRIZZLE_CLIENT],
|
|
||||||
})
|
|
||||||
export class DatabaseModule {}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
import { drizzle, PostgresJsDatabase } from 'drizzle-orm/postgres-js';
|
|
||||||
import postgres from 'postgres';
|
|
||||||
import * as schema from '@proj/db';
|
|
||||||
import { Provider } from '@nestjs/common';
|
|
||||||
|
|
||||||
export const DRIZZLE_CLIENT = 'DRIZZLE_CLIENT';
|
|
||||||
|
|
||||||
export type DrizzleDB = PostgresJsDatabase<typeof schema>;
|
|
||||||
|
|
||||||
export const DatabaseProvider: Provider = {
|
|
||||||
provide: DRIZZLE_CLIENT,
|
|
||||||
useFactory: (): DrizzleDB => {
|
|
||||||
const connectionString =
|
|
||||||
process.env.DATABASE_URL || 'postgres://user:pass@localhost:5432/db';
|
|
||||||
const client = postgres(connectionString);
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment
|
|
||||||
return drizzle(client, { schema }) as DrizzleDB;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
import { NestFactory } from '@nestjs/core';
|
|
||||||
import { AppModule } from './app.module';
|
|
||||||
|
|
||||||
async function bootstrap() {
|
|
||||||
const app = await NestFactory.create(AppModule);
|
|
||||||
await app.listen(process.env.PORT ?? 3000);
|
|
||||||
}
|
|
||||||
void bootstrap();
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
import { Test, TestingModule } from '@nestjs/testing';
|
|
||||||
import { INestApplication } from '@nestjs/common';
|
|
||||||
import request from 'supertest';
|
|
||||||
import { App } from 'supertest/types';
|
|
||||||
import { AppModule } from './../src/app.module';
|
|
||||||
|
|
||||||
describe('AppController (e2e)', () => {
|
|
||||||
let app: INestApplication<App>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
const moduleFixture: TestingModule = await Test.createTestingModule({
|
|
||||||
imports: [AppModule],
|
|
||||||
}).compile();
|
|
||||||
|
|
||||||
app = moduleFixture.createNestApplication();
|
|
||||||
await app.init();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('/ (GET)', () => {
|
|
||||||
return request(app.getHttpServer())
|
|
||||||
.get('/')
|
|
||||||
.expect(200)
|
|
||||||
.expect('Hello World!');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "./tsconfig.json",
|
|
||||||
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
|
|
||||||
}
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"module": "nodenext",
|
|
||||||
"moduleResolution": "nodenext",
|
|
||||||
"resolvePackageJsonExports": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"isolatedModules": true,
|
|
||||||
"declaration": true,
|
|
||||||
"removeComments": true,
|
|
||||||
"emitDecoratorMetadata": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"target": "ES2023",
|
|
||||||
"sourceMap": true,
|
|
||||||
"rootDir": "../..",
|
|
||||||
"outDir": "./dist",
|
|
||||||
"incremental": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"strictNullChecks": true,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"noImplicitAny": false,
|
|
||||||
"strictBindCallApply": false,
|
|
||||||
"noFallthroughCasesInSwitch": false,
|
|
||||||
"paths": {
|
|
||||||
"@proj/db": ["../../packages/db/index.ts"],
|
|
||||||
"@proj/db/*": ["../../packages/db/*"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
import { defineConfig, mergeConfig } from 'vitest/config';
|
|
||||||
import baseConfig from './vitest.config'; // On récupère ta config avec SWC
|
|
||||||
|
|
||||||
export default mergeConfig(
|
|
||||||
baseConfig,
|
|
||||||
defineConfig({
|
|
||||||
test: {
|
|
||||||
include: ['test/**/*.e2e-spec.ts'], // On cible tes tests E2E
|
|
||||||
environment: 'node',
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
import { defineConfig } from 'vitest/config';
|
|
||||||
import swc from 'unplugin-swc';
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
test: {
|
|
||||||
globals: true, // Permet d'utiliser 'describe', 'it', 'expect' sans les importer
|
|
||||||
root: './',
|
|
||||||
include: ['src/**/*.spec.ts'], // On cible les tests unitaires dans src/
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
// Ce plugin permet à Vitest de compiler les décorateurs NestJS (@Module, @Injectable...)
|
|
||||||
swc.vite({
|
|
||||||
module: { type: 'es6' },
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
@ -1,9 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "@proj/web",
|
"name": "super_todo_app_server",
|
||||||
"version": "0.0.0",
|
|
||||||
"description": "",
|
|
||||||
"author": "",
|
|
||||||
"license": "MIT",
|
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export * from './schema';
|
|
||||||
|
|
@ -1,56 +1,8 @@
|
||||||
import {
|
import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';
|
||||||
pgTable,
|
|
||||||
serial,
|
|
||||||
text,
|
|
||||||
timestamp,
|
|
||||||
pgEnum,
|
|
||||||
uuid,
|
|
||||||
} from 'drizzle-orm/pg-core';
|
|
||||||
import { relations } from 'drizzle-orm';
|
|
||||||
|
|
||||||
export const statusEnum = pgEnum('status', [
|
|
||||||
'backlog',
|
|
||||||
'todo',
|
|
||||||
'in_progress',
|
|
||||||
'done',
|
|
||||||
'archived',
|
|
||||||
]);
|
|
||||||
export const priorityEnum = pgEnum('priority', [
|
|
||||||
'low',
|
|
||||||
'medium',
|
|
||||||
'high',
|
|
||||||
'urgent',
|
|
||||||
]);
|
|
||||||
|
|
||||||
export const projects = pgTable('projects', {
|
export const projects = pgTable('projects', {
|
||||||
id: uuid('id').defaultRandom().primaryKey(),
|
id: serial('id').primaryKey(),
|
||||||
name: text('name').notNull(),
|
name: text('name').notNull(),
|
||||||
description: text('description'),
|
description: text('description'),
|
||||||
slug: text('slug').unique().notNull(),
|
createdAt: timestamp('created_at').defaultNow(),
|
||||||
createdAt: timestamp('created_at').defaultNow().notNull(),
|
|
||||||
updatedAt: timestamp('updated_at').defaultNow().notNull(),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const tasks = pgTable('tasks', {
|
|
||||||
id: serial('id').primaryKey(),
|
|
||||||
projectId: uuid('project_id')
|
|
||||||
.references(() => projects.id, { onDelete: 'cascade' })
|
|
||||||
.notNull(),
|
|
||||||
title: text('title').notNull(),
|
|
||||||
content: text('content'),
|
|
||||||
status: statusEnum('status').default('todo').notNull(),
|
|
||||||
priority: priorityEnum('priority').default('medium').notNull(),
|
|
||||||
dueDate: timestamp('due_date'),
|
|
||||||
createdAt: timestamp('created_at').defaultNow().notNull(),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const projectsRelations = relations(projects, ({ many }) => ({
|
|
||||||
tasks: many(tasks),
|
|
||||||
}));
|
|
||||||
|
|
||||||
export const tasksRelations = relations(tasks, ({ one }) => ({
|
|
||||||
project: one(projects, {
|
|
||||||
fields: [tasks.projectId],
|
|
||||||
references: [projects.id],
|
|
||||||
}),
|
|
||||||
}));
|
|
||||||
|
|
|
||||||
4128
pnpm-lock.yaml
4128
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue