-
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.
* Feat: ์๋ฌผ ์นด๋ ์์ธ ์กฐํ API (#33) * Docs: update PR template (add swagger) * Refactor: file name kebab-case ์ ์ฉ * Feat: plant util ํจ์ * Feat: plant ์์ธ ์กฐํ API * Docs: update PR template (add checklist) * Feat: plant ์์ธ ์กฐํ service ๋ก์ง unit test * Feat: plant ์์ธ ์กฐํ controller unit test * Fix: plants service ๋ก์ง time mocking * Feat: env test ํ๊ฒฝ ์ค์ * Feat: e2e test ๊ฒฉ๋ฆฌ๋ docker ํ๊ฒฝ ๊ตฌ์ถ * Feat: plants e2e test * Feat: ์๋ฌผ ์นด๋ ์์ api (#39) * Feat: ์๋ฌผ ์นด๋ ์์ api * Feat: ์๋ฌผ ์นด๋ ์์ api ์์ ํ์ผ * Feat: global exception ์ prisma ์๋ฌ ์ฒ๋ฆฌ ์ถ๊ฐ * Feat: ์๋ฌผ ์นด๋ ์์ ํ ์คํธ ์ฝ๋ * Feat: ๋ฉ์ธ ์๋ฌผ ๋ฆฌ์คํธ ์กฐํ API (#40) * Feat: ๋ฉ์ธ ์๋ฌผ ๋ฆฌ์คํธ ์กฐํ ์๋ถ๊ฐ ์ธํ * Update issue templates * Feat: ๋ฉ์ธ ํ๋ฉด ๋๋ค description ํจ์ ์ถ๊ฐ * Chore: Gauge๋ก ํต์ผ * Feat: ๋ฉ์ธ ์๋ฌผ ๋ฆฌ์คํธ ์ ์ฒด ์กฐํ API * Chore: getUserPlants๋ก ํจ์ ์ด๋ฆ ๋ณ๊ฒฝ * Chore: class ๋๋ฌธ์๋ก ๋ณ๊ฒฝ * Chore: ํ๋ฆฌํฐ์ด ์ ์ฉ --------- Co-authored-by: ์ฅ์ํ <jangseohyun@jangseohyeon-ui-MacBookAir.local> --------- Co-authored-by: Chae Jeong Ah <jokj624@gmail.com> Co-authored-by: ์ฅ์ํ <jangseohyun@jangseohyeon-ui-MacBookAir.local>
- Loading branch information
1 parent
98856f9
commit 480c4ff
Showing
27 changed files
with
1,252 additions
and
96 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,13 +1,21 @@ | ||
## ๐ PR ์์ฝ / Linked Issue | ||
ํด๋น PR์์ ์์ ํ ๋ด์ฉ์ ํ ์ค๋ก ์์ฝํด์ฃผ์ธ์. | ||
|
||
ํด๋น PR์์ ์์ ํ ๋ด์ฉ์ ํ ์ค๋ก ์์ฝํด์ฃผ์ธ์. | ||
close #{no} | ||
|
||
## ๐ก ๋ณ๊ฒฝ ์ฌํญ | ||
|
||
๋ํ ์ผํ ์์ ๋ด์ญ์ ์ ์ด์ฃผ์ธ์. | ||
์ฃผ์ํ ์ฌํญ์ด ์๋ค๋ฉด ์ ์ด์ฃผ์ธ์. | ||
๋ณ๊ฒฝ์ฌํญ (๋ชจ๋ ์ค์น ๋ฑ)์ด ์๋ค๋ฉด ์ ์ด์ฃผ์ธ์. | ||
|
||
## โ PR check list | ||
- [ ] ์ปค๋ฐ ์ปจ๋ฒค์ , ์ ๋ชฉ ๋ฑ์ ํ์ธํ๋์? | ||
- [ ] ์๋ง์ ๋ผ๋ฒจ์ ๋ฌ์๋์? | ||
- [ ] ์ ํ ์ฝ๋๋ฆฌ๋ทฐ๋ฅผ ์์ฑํ๋์? | ||
## ๐ Swagger | ||
|
||
API Swagger ๋ฅผ ์ถ๊ฐํ๋ค๋ฉด ์บก์ณํด์ฃผ์ธ์. | ||
|
||
## โ PR check list | ||
|
||
- [ ] ํ ์คํธ ์ฝ๋๋ฅผ ์์ฑํ๋์? (unit/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 |
---|---|---|
|
@@ -13,6 +13,7 @@ lerna-debug.log* | |
|
||
# env | ||
.env | ||
.env.test | ||
|
||
# OS | ||
.DS_Store | ||
|
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,20 @@ | ||
# Set the version of docker compose to use | ||
version: '3.9' | ||
|
||
# The containers that compose the project | ||
services: | ||
db: | ||
image: mysql:8.0 | ||
restart: always | ||
container_name: e2e-test-prisma | ||
ports: | ||
- '3306:3306' | ||
environment: | ||
MYSQL_ROOT_PASSWORD: root | ||
MYSQL_DATABASE: test | ||
volumes: | ||
- /var/lib/mysql | ||
command: | ||
- --character-set-server=utf8mb4 | ||
- --collation-server=utf8mb4_unicode_ci | ||
- --skip-character-set-client-handshake |
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,274 @@ | ||
import { PrismaClient } from '@prisma/client'; | ||
import * as dayjs from 'dayjs'; | ||
import * as utc from 'dayjs/plugin/utc'; | ||
import * as timezone from 'dayjs/plugin/timezone'; | ||
|
||
dayjs.extend(utc); | ||
dayjs.extend(timezone); | ||
|
||
const prisma = new PrismaClient(); | ||
|
||
async function main() { | ||
const user = await prisma.user.create({ | ||
data: { | ||
id: 1, | ||
email: 'ddd', | ||
createdAt: dayjs('2023-07-22 08:15:37.225Z').toDate(), | ||
fcmToken: 'dd', | ||
nickname: 'ddd', | ||
password: 'dd', | ||
phone: 'ddd', | ||
profileImageURL: 'dd', | ||
refreshToken: 'dd', | ||
socialType: 'kakao', | ||
title: 'dd', | ||
updatedAt: dayjs('2023-07-22 08:15:37.225Z').toDate(), | ||
uuid: 'dd', | ||
appleId: null, | ||
appleRefreshToken: null, | ||
kakaoId: 1, | ||
}, | ||
}); | ||
|
||
const plants = await prisma.plant.createMany({ | ||
data: [ | ||
{ | ||
id: 1, | ||
name: '์ค๋ ์ง ์์ค๋ฏผ', | ||
cycle: 2, | ||
introduction: '๋ถ์์ฑ์ด ์ข์\n์์ฆ๋ง์ ์ค๋ ์ง ์์ค๋ฏผ', | ||
meaning: '๋น์ ์ ํฅํด', | ||
explanation: | ||
'1~2์ผ์ ํ ๋ฒ ๋ฌผ์ ์ฃผ๋ ๊ฒ์ ์ถ์ฒํด์\n๋ฌผ์ ์ข์ํ๋ ์์ค๋ฏผ์ด ๊ณง ๊ท์ฌ์ด ์ด๋งค๋ฅผ ์ ๋ฌผํ ๊ฑฐ์์!', | ||
circleImageURL: | ||
'https://cherish-static-dev.s3.ap-northeast-2.amazonaws.com/circleImages/mindlere-circle.png', | ||
gifURL: 'aaa', | ||
}, | ||
{ | ||
id: 2, | ||
name: '๋ก์ฆ๋ง๋ฆฌ', | ||
cycle: 4, | ||
introduction: '๋น์ ์ ํ๋ฃจ๋ฅผ ์น์ ํ๋\nํฅ๊ธฐ๋ก์ด ๋ก์ฆ๋ง๋ฆฌ', | ||
meaning: '๊ธฐ์ตํด ์ฃผ์ธ์', | ||
explanation: | ||
'3~4์ผ์ ํ ๋ฒ ๋ฌผ์ ์ฃผ๋ ๊ฒ์ ์ถ์ฒํด์\n์์ฃผ ์ฐ๋ฝํ๊ณ ๋ง์ ์๊ฐ์ ํจ๊ปํ๋ฉฐ ์ถ์ต์ ์์๊ฐ์!', | ||
circleImageURL: | ||
'https://cherish-static-dev.s3.ap-northeast-2.amazonaws.com/circleImages/rosemari-circle.png', | ||
gifURL: 'aaa', | ||
}, | ||
{ | ||
id: 3, | ||
name: '์๋ฉ๋ฆฌ์นธ ๋ธ๋ฃจ', | ||
cycle: 6, | ||
introduction: '๋งค์ผ๋งค์ผ ๊ฝ์ด ํผ๋\nํธ๋ฅธ ๋น์ ์๋ฉ๋ฆฌ์นธ ๋ธ๋ฃจ', | ||
meaning: '๋ ์ฌ๋์ ์ธ์ฐ', | ||
explanation: | ||
'์ผ์ฃผ์ผ์ ํ ๋ฒ ๋ฌผ์ ์ฃผ๋ ๊ฒ์ ์ถ์ฒํด์\n์ข ์ข ์๋ถ๋ฅผ ๋ฌผ์ผ๋ฉด์ ์ค์๋์ ์ด์ผ๊ธฐ๋ฅผ ๋๋์ด์!', | ||
circleImageURL: | ||
'https://cherish-static-dev.s3.ap-northeast-2.amazonaws.com/circleImages/americanblue-circle.png', | ||
gifURL: 'aaa', | ||
}, | ||
{ | ||
id: 4, | ||
name: '๋ฏผ๋ค๋ ', | ||
cycle: 13, | ||
introduction: '๊ฐ์ฌํ๋ ๋ง์์ ๊ฐ์ง\n๋ฐ๋ปํ ๋ฏผ๋ค๋ ', | ||
meaning: '์ธ์ฐ์์์ ํ๋ณต', | ||
explanation: | ||
'๋ณด๋ฆ์ ํ ๋ฒ ๋ฌผ์ ์ฃผ๋ ๊ฒ์ ์ถ์ฒํด์\n๋น์ ์ ์ฐ๋ฝ์ด ํ์จ๊ฐ ๋์ด ๋ ์๊ฐ ํ๋ณต์ผ๋ก ํผ์ด๋ ๊ฑฐ์์!', | ||
circleImageURL: | ||
'https://cherish-static-dev.s3.ap-northeast-2.amazonaws.com/circleImages/mindlere-circle.png', | ||
gifURL: 'ใ ใ ', | ||
}, | ||
{ | ||
id: 5, | ||
name: '์คํฌํค', | ||
cycle: 29, | ||
introduction: '์ธ์ ๋ ๋น์ ์ ์ง์ผ์ฃผ๋\n๋ ๋ ํ ์คํฌํค', | ||
meaning: '๋๊ทธ๋ฌ์', | ||
explanation: | ||
'ํ๋ฌ์ ํ ๋ฒ ๋ฌผ์ ์ฃผ๋ ๊ฒ์ ์ถ์ฒํด์\n๊ฐ๋์ฉ ์ฐ๋ฝํ๋๋ผ๋ ์ค๋ ๋ง๋ ์ ์๊ธธ ๋ฐ๋ผ์!', | ||
circleImageURL: | ||
'https://cherish-static-dev.s3.ap-northeast-2.amazonaws.com/circleImages/stuki-circle.png', | ||
gifURL: 'ใ ใ ', | ||
}, | ||
{ | ||
id: 6, | ||
name: '๋จ๋ชจํ', | ||
cycle: 90, | ||
introduction: '๋น์ ์ ๋ฐค์ ์ง์ผ์ฃผ๋\n์ฉ์ฉํ ๋จ๋ชจํ', | ||
meaning: '์ฌ๋๊ณผ ์ด์ ', | ||
explanation: | ||
'์ธ ๋ฌ์ ํ ๋ฒ ๋ฌผ์ ์ฃผ๋ ๊ฒ์ ์ถ์ฒํด์\n์์ฃผ ๋ณด์ง ๋ชปํด๋ ๋ถ๋ช ๋น์ ์ ์ฐ๋ฝ์ ๊ธฐ๋ค๋ฆด๊ฑฐ์์!', | ||
circleImageURL: | ||
'https://cherish-static-dev.s3.ap-northeast-2.amazonaws.com/circleImages/danmohwan-circle.png', | ||
gifURL: 'ใ ใ ใ ', | ||
}, | ||
], | ||
skipDuplicates: true, | ||
}); | ||
|
||
const plantLevels = await prisma.plantLevel.createMany({ | ||
data: [ | ||
{ | ||
id: 1, | ||
plantId: 1, | ||
level: 0, | ||
levelName: '์ด๋ฆฐ ๋๋ฌด', | ||
description: '๋ฌด๋ญ๋ฌด๋ญ ์๋ ์ค๋น๋ฅผ ํ๊ณ ์์ด์!', | ||
imageURL: | ||
'https://cherish-static-dev.s3.ap-northeast-2.amazonaws.com/plantLevel/mindlere-1.png', | ||
}, | ||
{ | ||
id: 2, | ||
plantId: 1, | ||
level: 1, | ||
levelName: '๊ฐํ', | ||
description: 'ํ์ ๊ฝ์ด ํ์ง ํผ์ด๋ฌ์ด์!', | ||
imageURL: | ||
'https://cherish-static-dev.s3.ap-northeast-2.amazonaws.com/plantLevel/mindlere-2.png', | ||
}, | ||
{ | ||
id: 3, | ||
plantId: 1, | ||
level: 2, | ||
levelName: '์ด๋งค', | ||
description: '๊ฝ์ด ๋จธ๋ฌผ๋ค๊ฐ ์๋ฆฌ์ ์์ฆ๋ง์ ์ด๋งค๊ฐ ์ด๋ ธ๋ค์!', | ||
imageURL: | ||
'https://cherish-static-dev.s3.ap-northeast-2.amazonaws.com/plantLevel/mindlere-complete.png', | ||
}, | ||
{ | ||
id: 4, | ||
plantId: 2, | ||
level: 0, | ||
levelName: '์์น', | ||
description: '์์น์ด ์์ฅ ์ผ๊ตด์ ๋ด๋ฐ์์ด์!', | ||
imageURL: | ||
'https://cherish-static-dev.s3.ap-northeast-2.amazonaws.com/plantLevel/rosemari-1.png', | ||
}, | ||
{ | ||
id: 5, | ||
plantId: 2, | ||
level: 1, | ||
levelName: '๊ฝ๋ง์ธ', | ||
description: '๊ฝ๋ง์ธ์ด ๋ฐฉ์ธ๋ฐฉ์ธ ๋งบํ์ด์!', | ||
imageURL: | ||
'https://cherish-static-dev.s3.ap-northeast-2.amazonaws.com/plantLevel/rosemari-2.png', | ||
}, | ||
{ | ||
id: 6, | ||
plantId: 2, | ||
level: 2, | ||
levelName: '๊ฐํ', | ||
description: '์์ ๊ฝ์ด ํ์ง ํผ์ด๋ฌ์ด์!', | ||
imageURL: | ||
'https://cherish-static-dev.s3.ap-northeast-2.amazonaws.com/plantLevel/rosemari-complete.png', | ||
}, | ||
{ | ||
id: 7, | ||
plantId: 3, | ||
level: 0, | ||
levelName: '์์น', | ||
description: '์์น์ด ์์ฅ ์ผ๊ตด์ ๋ด๋ฐ์์ด์!', | ||
imageURL: | ||
'https://cherish-static-dev.s3.ap-northeast-2.amazonaws.com/plantLevel/americanblue-1.png', | ||
}, | ||
{ | ||
id: 8, | ||
plantId: 3, | ||
level: 1, | ||
levelName: '๊ฝ๋ง์ธ', | ||
description: '๊ฝ๋ง์ธ์ด ๋ฐฉ์ธ๋ฐฉ์ธ ๋งบํ์ด์!', | ||
imageURL: | ||
'https://cherish-static-dev.s3.ap-northeast-2.amazonaws.com/plantLevel/americanblue-2.png', | ||
}, | ||
{ | ||
id: 9, | ||
plantId: 3, | ||
level: 2, | ||
levelName: '๊ฐํ', | ||
description: '์์ ๊ฝ์ด ํ์ง ํผ์ด๋ฌ์ด์!', | ||
imageURL: | ||
'https://cherish-static-dev.s3.ap-northeast-2.amazonaws.com/plantLevel/americanblue-complete.png', | ||
}, | ||
{ | ||
id: 10, | ||
plantId: 4, | ||
level: 0, | ||
levelName: '์์น', | ||
description: '์์น์ด ์์ฅ ์ผ๊ตด์ ๋ด๋ฐ์์ด์!', | ||
imageURL: | ||
'https://cherish-static-dev.s3.ap-northeast-2.amazonaws.com/plantLevel/mindlere-1.png', | ||
}, | ||
], | ||
skipDuplicates: true, | ||
}); | ||
|
||
const userPlant = await prisma.userPlant.create({ | ||
data: { | ||
id: 1, | ||
userId: 1, | ||
nickname: 'test', | ||
instagram: null, | ||
phone: null, | ||
waterCycle: 14, | ||
waterCount: 0, | ||
isNotified: true, | ||
loveGauge: 0, | ||
createdAt: dayjs('2023-07-22 08:16:52.538Z').toDate(), | ||
updatedAt: dayjs('2023-07-22 08:16:52.538Z').toDate(), | ||
waterTime: null, | ||
plantId: 4, | ||
}, | ||
}); | ||
|
||
const water = await prisma.water.createMany({ | ||
data: [ | ||
{ | ||
id: 1, | ||
userPlantId: 1, | ||
review: '๋ฆฌ๋ทฐ1', | ||
wateringDate: dayjs('2023-07-22 08:55:31.799Z').toDate(), | ||
updatedAt: dayjs('2023-07-22 08:55:31.799Z').toDate(), | ||
}, | ||
{ | ||
id: 3, | ||
userPlantId: 1, | ||
review: '๋ฆฌ๋ทฐ2', | ||
wateringDate: dayjs('2023-07-22 18:16:53Z').toDate(), | ||
updatedAt: dayjs('2023-07-22 09:16:54.635Z').toDate(), | ||
}, | ||
], | ||
skipDuplicates: true, | ||
}); | ||
|
||
const waterKeword = await prisma.waterKeyword.createMany({ | ||
data: [ | ||
{ | ||
id: 1, | ||
waterId: 4, | ||
keyword: 'keyword1', | ||
createdAt: dayjs('2023-07-22 12:20:11.257Z').toDate(), | ||
updatedAt: dayjs('2023-07-22 12:20:11.257Z').toDate(), | ||
}, | ||
{ | ||
id: 2, | ||
waterId: 4, | ||
keyword: 'keyword2', | ||
createdAt: dayjs('2023-07-22 12:20:11.257Z').toDate(), | ||
updatedAt: dayjs('2023-07-22 12:20:11.257Z').toDate(), | ||
}, | ||
], | ||
skipDuplicates: true, | ||
}); | ||
} | ||
|
||
main() | ||
.then(async () => { | ||
await prisma.$disconnect(); | ||
}) | ||
.catch(async (e) => { | ||
console.error(e); | ||
await prisma.$disconnect(); | ||
process.exit(1); | ||
}); |
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
Oops, something went wrong.