-
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.
* [Server] 개발환경 세팅 (#4) * build: open-list-server init * chore: @nestjs/config class-validator class-transformer 설치 * chore: 루트 레벨에서 설치한 패키지 삭제 * chore: NestJs 개발 환경 세팅 * chore: @nestjs/config class-validator class-transformer 설치 * Server/feature/#13 (#25) * chore: postgresql, nestjs docker 세팅 * chore: @nestjs/typeorm, typeorm, pg 설치 * chore: Typeorm 세팅 및 TestModel 테이블 생성 * 테스트용 유저 API 구현 (#30) * chore: common resource 추가 * chore: users resource 추가 * feature: base entity 구현 * feature: usersEntity 구현 * feature: 모듈에 usersModel 추가 * style: entity,dto의 users -> user로 변경 * feature: CreateUserDto 구현 * feature: userEntity 이메일 필드 추가 * feature: createUserDto 이메일 필드 추가 * feature: user patch->put으로 변경 * feature: updateUserDto 구현 * feature : create user 구현 * feature: 모든 유저의 정보를 가져오는 API 구현 * feature: 특정 유저의 정보를 가져오는 API 구현 * feature: user 정보 수정 API 구현 * feature: user 삭제 API 구현 * feature: ValidationPipe 적용 * refactor: usersService 리팩토링 * [Server] 유닛 테스트 환경 세팅 (#32) * chore: test 경로 설정 * feature: TestCommonModule 구현 * feature: users.service.spec.ts 의존성 주입 * feature: users.controller.spec.ts 의존성 주입 * [Server] Users resource 이름 변경 (#34) * style: usersController 네이밍에 컨벤션 맞게 변경 * style: usersService 컨벤션에 따른 네이밍 변경 * style: UsersModel -> UserModel 컨벤션에 따른 네이밍 변경 * feature: usersService 테스트 코드 작성 (#39) * [Server] Folder entity 생성 및 crud 구현 (#42) * feat: folders crud 구현 * chore: TestModel 삭제 및 관련된 종속성 제거 * feat: folders.controller.spec.ts 삭제, folders.service.spec.ts 구현 * feature: docker파일 수정 (#57) --------- Co-authored-by: Minseong Park <[email protected]>
- Loading branch information
1 parent
231374f
commit 578bf8a
Showing
42 changed files
with
6,577 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# 디폴트 무시된 파일 | ||
/.idea/shelf/ | ||
/.idea/workspace.xml | ||
# 에디터 기반 HTTP 클라이언트 요청 | ||
/httpRequests/ | ||
# Datasource local storage ignored files | ||
/dataSources/ | ||
/dataSources.local.xml | ||
|
||
/.idea |
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,4 @@ | ||
.gitignore | ||
Dockerfile | ||
node_modules | ||
dist |
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,25 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
tsconfigRootDir: __dirname, | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin'], | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
root: true, | ||
env: { | ||
node: true, | ||
jest: true, | ||
}, | ||
ignorePatterns: ['.eslintrc.js'], | ||
rules: { | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
}, | ||
}; |
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,38 @@ | ||
# compiled output | ||
/dist | ||
/node_modules | ||
|
||
# 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 | ||
|
||
.env | ||
postgres-data |
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,4 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all" | ||
} |
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,14 @@ | ||
FROM node:18 | ||
RUN mkdir -p /app | ||
WORKDIR /app | ||
ADD . /app/ | ||
|
||
RUN rm yarn.lock || true | ||
RUN rm package-lock.json || true | ||
RUN yarn | ||
RUN yarn build | ||
|
||
ENV HOST 0.0.0.0 | ||
EXPOSE 3000 | ||
|
||
CMD [ "yarn", "start"] |
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,73 @@ | ||
<p align="center"> | ||
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" 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://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></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"/></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"></a> | ||
</p> | ||
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer) | ||
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)--> | ||
|
||
## Description | ||
|
||
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. | ||
|
||
## Installation | ||
|
||
```bash | ||
$ yarn install | ||
``` | ||
|
||
## Running the app | ||
|
||
```bash | ||
# development | ||
$ yarn run start | ||
|
||
# watch mode | ||
$ yarn run start:dev | ||
|
||
# production mode | ||
$ yarn run start:prod | ||
``` | ||
|
||
## Test | ||
|
||
```bash | ||
# unit tests | ||
$ yarn run test | ||
|
||
# e2e tests | ||
$ yarn run test:e2e | ||
|
||
# test coverage | ||
$ yarn run test:cov | ||
``` | ||
|
||
## 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://kamilmysliwiec.com) | ||
- Website - [https://nestjs.com](https://nestjs.com/) | ||
- Twitter - [@nestframework](https://twitter.com/nestframework) | ||
|
||
## License | ||
|
||
Nest is [MIT licensed](LICENSE). |
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,30 @@ | ||
version: '3.8' | ||
services: | ||
postgresql_db: | ||
image: postgres:15 | ||
restart: always | ||
volumes: | ||
- ./postgres-data:/var/lib/postgresql/data | ||
ports: | ||
- '5432:5432' | ||
environment: | ||
POSTGRES_USER: ${DB_USERNAME} | ||
POSTGRES_PASSWORD: ${DB_PASSWORD} | ||
POSTGRES_DB: ${DB_DATABASE} | ||
|
||
nestjs_server: | ||
build: . | ||
ports: | ||
- '3000:3000' | ||
depends_on: | ||
- postgresql_db | ||
environment: | ||
JWT_SECRET: ${JWT_SECRET} | ||
HASH_ROUNDS: ${HASH_ROUNDS} | ||
PROTOCOL: ${PROTOCOL} | ||
HOST: ${HOST} | ||
DB_HOST: ${DB_HOST} | ||
DB_PORT: ${DB_PORT} | ||
DB_USERNAME: ${DB_USERNAME} | ||
DB_PASSWORD: ${DB_PASSWORD} | ||
DB_DATABASE: ${DB_DATABASE} |
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,8 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/nest-cli", | ||
"collection": "@nestjs/schematics", | ||
"sourceRoot": "src", | ||
"compilerOptions": { | ||
"deleteOutDir": 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,80 @@ | ||
{ | ||
"name": "server", | ||
"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": "jest", | ||
"test:watch": "jest --watch", | ||
"test:cov": "jest --coverage", | ||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", | ||
"test:e2e": "jest --config ./test/jest-e2e.json" | ||
}, | ||
"dependencies": { | ||
"@nestjs/common": "^10.0.0", | ||
"@nestjs/config": "^3.1.1", | ||
"@nestjs/core": "^10.0.0", | ||
"@nestjs/mapped-types": "*", | ||
"@nestjs/platform-express": "^10.0.0", | ||
"@nestjs/typeorm": "^10.0.0", | ||
"class-transformer": "^0.5.1", | ||
"class-validator": "^0.14.0", | ||
"pg": "^8.11.3", | ||
"reflect-metadata": "^0.1.13", | ||
"rxjs": "^7.8.1", | ||
"typeorm": "^0.3.17" | ||
}, | ||
"devDependencies": { | ||
"@nestjs/cli": "^10.0.0", | ||
"@nestjs/schematics": "^10.0.0", | ||
"@nestjs/testing": "^10.0.0", | ||
"@types/express": "^4.17.17", | ||
"@types/jest": "^29.5.2", | ||
"@types/node": "^20.3.1", | ||
"@types/supertest": "^2.0.12", | ||
"@typescript-eslint/eslint-plugin": "^6.0.0", | ||
"@typescript-eslint/parser": "^6.0.0", | ||
"eslint": "^8.42.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"jest": "^29.5.0", | ||
"prettier": "^3.0.0", | ||
"source-map-support": "^0.5.21", | ||
"supertest": "^6.3.3", | ||
"ts-jest": "^29.1.0", | ||
"ts-loader": "^9.4.3", | ||
"ts-node": "^10.9.1", | ||
"tsconfig-paths": "^4.2.0", | ||
"typescript": "^5.1.3" | ||
}, | ||
"jest": { | ||
"moduleFileExtensions": [ | ||
"js", | ||
"json", | ||
"ts" | ||
], | ||
"rootDir": "src", | ||
"moduleNameMapper": { | ||
"^src/(.*)$": "<rootDir>/$1", | ||
"^test/(.*)$": "<rootDir>/../test/$1" | ||
}, | ||
"testRegex": ".*\\.spec\\.ts$", | ||
"transform": { | ||
"^.+\\.(t|j)s$": "ts-jest" | ||
}, | ||
"collectCoverageFrom": [ | ||
"**/*.(t|j)s" | ||
], | ||
"coverageDirectory": "../coverage", | ||
"testEnvironment": "node" | ||
} | ||
} |
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,22 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { AppController } from './app.controller'; | ||
import { AppService } from './app.service'; | ||
|
||
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!'); | ||
}); | ||
}); | ||
}); |
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,12 @@ | ||
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(); | ||
} | ||
} |
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,35 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { AppController } from './app.controller'; | ||
import { AppService } from './app.service'; | ||
import { TypeOrmModule } from '@nestjs/typeorm'; | ||
import { ConfigModule } from '@nestjs/config'; | ||
import { CommonModule } from './common/common.module'; | ||
import { UsersModule } from './users/users.module'; | ||
import { UserModel } from './users/entities/user.entity'; | ||
import { FoldersModule } from './folders/folders.module'; | ||
import { FolderModel } from './folders/entities/folder.entity'; | ||
|
||
@Module({ | ||
imports: [ | ||
ConfigModule.forRoot({ | ||
envFilePath: '.env', | ||
isGlobal: true, | ||
}), | ||
TypeOrmModule.forRoot({ | ||
type: 'postgres', | ||
host: process.env['DB_HOST'], | ||
port: parseInt(process.env['DB_PORT']), | ||
username: process.env['DB_USERNAME'], | ||
password: process.env['DB_PASSWORD'], | ||
database: process.env['DB_DATABASE'], | ||
entities: [UserModel, FolderModel], | ||
synchronize: true, // DO NOT USE IN PRODUCTION | ||
}), | ||
CommonModule, | ||
UsersModule, | ||
FoldersModule, | ||
], | ||
controllers: [AppController], | ||
providers: [AppService], | ||
}) | ||
export class AppModule {} |
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,8 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
|
||
@Injectable() | ||
export class AppService { | ||
getHello(): string { | ||
return 'Hello World!'; | ||
} | ||
} |
Oops, something went wrong.