Skip to content

Commit e73b469

Browse files
committed
Initial commit
0 parents  commit e73b469

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+9697
-0
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/*
2+
/node_modules
3+
test

.eslintrc.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
parserOptions: {
4+
project: 'tsconfig.json',
5+
tsconfigRootDir: __dirname,
6+
sourceType: 'module',
7+
},
8+
plugins: ['@typescript-eslint/eslint-plugin'],
9+
extends: ['plugin:@typescript-eslint/recommended'],
10+
root: true,
11+
env: {
12+
node: true,
13+
jest: true,
14+
},
15+
ignorePatterns: ['.eslintrc.js'],
16+
rules: {
17+
'@typescript-eslint/interface-name-prefix': 'off',
18+
'@typescript-eslint/explicit-function-return-type': 'off',
19+
'@typescript-eslint/explicit-module-boundary-types': 'off',
20+
'@typescript-eslint/no-explicit-any': 'off',
21+
'@typescript-eslint/no-var-requires': 'warn',
22+
},
23+
};

.github/workflows/pr-check.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#? 해당 워크플로우는 develop에 PR 요청시
2+
#? dependencies 설치 및 lint 작업을 수행합니다.
3+
#? 과정에서 에러 발생 시 PR이 closed 됩니다.
4+
#? 수정 이후 다시 PR 요청바랍니다.
5+
6+
name: PR Check
7+
8+
on:
9+
pull_request:
10+
branches:
11+
- develop
12+
- main
13+
jobs:
14+
code_check:
15+
if: "${{ github.event.pull_request.head.repo.full_name == github.repository }}"
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: ✅ 체크아웃
20+
uses: actions/checkout@v2
21+
22+
- name: ⚙️ 환경변수를 설정합니다.
23+
run: |
24+
25+
#TODO 실제 릴리즈 이후 환경 변수 변경
26+
touch .env.development
27+
echo "${{ secrets.MOMOF_KEYS }}" >> .env.development
28+
29+
- name: 🐕 dependencies 설치, eslint를 통해 코드에 문제가 없는지 확인합니다.
30+
run: |
31+
yarn
32+
yarn lint
33+
34+
- name: 🚨 eslint/jest 검증 실패
35+
uses: actions/[email protected]
36+
with:
37+
github-token: ${{github.token}}
38+
script: |
39+
const ref = "${{github.ref}}"
40+
const pull_number = Number(ref.split("/")[2])
41+
await github.pulls.createReview({
42+
...context.repo,
43+
pull_number,
44+
body:"👉 서버 코드를 다시 확인해주세요.",
45+
event: "REQUEST_CHANGES"
46+
})
47+
await github.pulls.update({
48+
...context.repo,
49+
pull_number,
50+
state: "closed"
51+
})
52+
if: failure()

.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# env
2+
.env.development
3+
.env.production
4+
5+
# compiled output
6+
/dist
7+
/node_modules
8+
9+
# Logs
10+
logs
11+
*.log
12+
npm-debug.log*
13+
pnpm-debug.log*
14+
yarn-debug.log*
15+
yarn-error.log*
16+
lerna-debug.log*
17+
18+
# OS
19+
.DS_Store
20+
21+
# Tests
22+
/coverage
23+
/.nyc_output
24+
25+
# IDEs and editors
26+
/.idea
27+
.project
28+
.classpath
29+
.c9/
30+
*.launch
31+
.settings/
32+
*.sublime-workspace
33+
34+
# IDE - VSCode
35+
.vscode/*
36+
!.vscode/settings.json
37+
!.vscode/tasks.json
38+
!.vscode/launch.json
39+
!.vscode/extensions.json

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
yarn lint-staged

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"singleQuote": true,
3+
"parser": "typescript",
4+
"semi": true,
5+
"trailingComma": "all",
6+
"tabWidth": 2,
7+
"endOfLine": "auto",
8+
"printWidth": 120
9+
}

README.md

Whitespace-only changes.

nest-cli.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$schema": "https://json.schemastore.org/nest-cli",
3+
"collection": "@nestjs/schematics",
4+
"sourceRoot": "src"
5+
}

package.json

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"name": "catchme_server",
3+
"version": "0.0.1",
4+
"description": "",
5+
"author": "",
6+
"private": true,
7+
"license": "UNLICENSED",
8+
"scripts": {
9+
"prebuild": "rimraf dist",
10+
"build": "nest build",
11+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
12+
"start": "nest start",
13+
"start:dev": "nest start --watch",
14+
"start:debug": "nest start --debug --watch",
15+
"start:prod": "node dist/main",
16+
"db-pull": "dotenv -e .env.development -- prisma db pull && prisma generate --schema ./prisma/schema.prisma",
17+
"db-push": "dotenv -e .env.development -- prisma db push && prisma generate --schema ./prisma/schema.prisma",
18+
"db-pull:prod": "cross-env NODE_ENV=production npx prisma db pull && prisma generate --schema ./prisma/schema.prisma",
19+
"db-push:prod": "cross-env NODE_ENV=production npx prisma db push && prisma generate --schema ./prisma/schema.prisma",
20+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
21+
"test": "jest",
22+
"test:watch": "jest --watch",
23+
"test:cov": "jest --coverage",
24+
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
25+
"test:e2e": "jest --config ./test/jest-e2e.json",
26+
"lint-staged": "lint-staged"
27+
},
28+
"lint-staged": {
29+
"**/*.ts": [
30+
"eslint --fix"
31+
]
32+
},
33+
"dependencies": {
34+
"@nestjs/axios": "^0.1.0",
35+
"@nestjs/common": "^8.0.0",
36+
"@nestjs/config": "^2.1.0",
37+
"@nestjs/core": "^8.0.0",
38+
"@nestjs/jwt": "^9.0.0",
39+
"@nestjs/passport": "^8.2.2",
40+
"@nestjs/terminus": "^9.0.0",
41+
"@prisma/client": "^4.0.0",
42+
"@slack/client": "^5.0.2",
43+
"aws-sdk": "^2.1167.0",
44+
"browserless": "^9.5.4",
45+
"class-transformer": "^0.5.1",
46+
"class-validator": "^0.13.2",
47+
"compression": "^1.7.4",
48+
"cross-env": "^7.0.3",
49+
"dayjs": "^1.11.4",
50+
"dotenv": "^16.0.3",
51+
"express-basic-auth": "^1.2.1",
52+
"express-rate-limit": "^6.4.0",
53+
"global": "^4.4.0",
54+
"helmet": "^5.1.0",
55+
"lodash": "^4.17.21",
56+
"multer-s3": "^2.10.0",
57+
"multer-s3-transform": "^2.10.3",
58+
"nanoid": "^3.3.4",
59+
"nest-raven": "^8.2.0",
60+
"nest-winston": "^1.6.2",
61+
"passport": "^0.6.0",
62+
"passport-jwt": "^4.0.0",
63+
"prisma": "^4.1.0",
64+
"random": "^3.0.6",
65+
"reflect-metadata": "^0.1.13",
66+
"rimraf": "^3.0.2",
67+
"rxjs": "^7.2.0",
68+
"sharp": "^0.30.7",
69+
"swagger-ui-express": "^4.4.0",
70+
"user-agents": "^1.0.1131",
71+
"uuid": "^8.3.2",
72+
"winston": "^3.8.1"
73+
},
74+
"devDependencies": {
75+
"@nestjs/cli": "^8.0.0",
76+
"@nestjs/platform-express": "^8.4.7",
77+
"@nestjs/schedule": "^2.1.0",
78+
"@nestjs/schematics": "^8.0.0",
79+
"@nestjs/swagger": "^5.2.1",
80+
"@nestjs/testing": "^8.0.0",
81+
"@types/cache-manager": "^4.0.1",
82+
"@types/cache-manager-redis-store": "^2.0.1",
83+
"@types/compression": "^1.7.2",
84+
"@types/express": "^4.17.13",
85+
"@types/jest": "27.5.0",
86+
"@types/lodash": "^4.14.182",
87+
"@types/multer": "^1.4.7",
88+
"@types/multer-s3": "^2.7.12",
89+
"@types/node": "^16.0.0",
90+
"@types/passport-jwt": "^3.0.6",
91+
"@types/sharp": "^0.30.4",
92+
"@types/supertest": "^2.0.11",
93+
"@typescript-eslint/eslint-plugin": "^5.0.0",
94+
"@typescript-eslint/parser": "^5.0.0",
95+
"eslint": "^8.0.1",
96+
"eslint-config-prettier": "^8.3.0",
97+
"eslint-plugin-prettier": "^4.0.0",
98+
"fast-shuffle": "^5.0.1",
99+
"husky": "^8.0.0",
100+
"jest": "28.0.3",
101+
"lint-staged": "^13.0.3",
102+
"prettier": "^2.3.2",
103+
"source-map-support": "^0.5.20",
104+
"supertest": "^6.1.3",
105+
"ts-jest": "28.0.1",
106+
"ts-loader": "^9.2.3",
107+
"ts-node": "^10.0.0",
108+
"tsconfig-paths": "4.0.0",
109+
"typescript": "^4.3.5"
110+
},
111+
"jest": {
112+
"moduleFileExtensions": [
113+
"js",
114+
"json",
115+
"ts"
116+
],
117+
"rootDir": "src",
118+
"testRegex": ".*\\.spec\\.ts$",
119+
"transform": {
120+
"^.+\\.(t|j)s$": "ts-jest"
121+
},
122+
"collectCoverageFrom": [
123+
"**/*.(t|j)s"
124+
],
125+
"coverageDirectory": "../coverage",
126+
"testEnvironment": "node"
127+
}
128+
}

prisma/schema.prisma

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
generator client {
2+
provider = "prisma-client-js"
3+
}
4+
5+
datasource db {
6+
provider = "postgresql"
7+
url = env("DATABASE_URL")
8+
}
9+
10+
model Activity {
11+
id Int @id(map: "activity_pk") @unique(map: "activity_id_uindex") @default(autoincrement())
12+
character_id Int
13+
content String
14+
image String?
15+
date DateTime? @db.Timestamp(6)
16+
created_at DateTime @default(now())
17+
updated_at DateTime @default(now()) @updatedAt
18+
is_delete Boolean @default(false)
19+
Character Character @relation(fields: [character_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "activity_character_id_fk")
20+
}
21+
22+
model Block {
23+
id Int @id(map: "block_pk") @unique(map: "block_id_uindex") @default(autoincrement())
24+
user_id Int
25+
target_id Int
26+
created_at DateTime @default(now())
27+
updated_at DateTime @default(now()) @updatedAt
28+
is_delete Boolean @default(false)
29+
User_Block_user_idToUser User @relation("Block_user_idToUser", fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "block_user_id_fk")
30+
User_Block_target_idToUser User @relation("Block_target_idToUser", fields: [target_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "block_user_id_fk_2")
31+
}
32+
33+
model Character {
34+
id Int @id(map: "character_pk") @unique(map: "character_id_uindex") @default(autoincrement())
35+
name String @db.VarChar(100)
36+
type Int
37+
level Int @default(1)
38+
is_public Boolean @default(false)
39+
created_at DateTime @default(now())
40+
updated_at DateTime @default(now()) @updatedAt
41+
is_delete Boolean @default(false)
42+
Activity Activity[]
43+
Report Report[]
44+
}
45+
46+
model Report {
47+
id Int @id(map: "report_pk") @unique(map: "report_id_uindex") @default(autoincrement())
48+
user_id Int
49+
character_id Int
50+
created_at DateTime @default(now())
51+
updated_at DateTime @default(now()) @updatedAt
52+
is_delete Boolean @default(false)
53+
Character Character @relation(fields: [character_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "report_character_id_fk")
54+
User User @relation(fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "report_user_id_fk")
55+
}
56+
57+
model User {
58+
id Int @id(map: "user_pk") @unique(map: "user_id_uindex") @default(autoincrement())
59+
uuid String @unique(map: "user_uuid_uindex") @db.VarChar(255)
60+
provider String @db.VarChar(20)
61+
nickname String @db.VarChar(20)
62+
created_at DateTime @default(now())
63+
updated_at DateTime @default(now()) @updatedAt
64+
is_delete Boolean @default(false)
65+
Block_Block_user_idToUser Block[] @relation("Block_user_idToUser")
66+
Block_Block_target_idToUser Block[] @relation("Block_target_idToUser")
67+
Report Report[]
68+
}

0 commit comments

Comments
 (0)