jandy-seoultech / jandy_web_back Goto Github PK
View Code? Open in Web Editor NEW๐ Talent Sharing Platform 'Upgle' Back-End Repo
License: GNU General Public License v3.0
๐ Talent Sharing Platform 'Upgle' Back-End Repo
License: GNU General Public License v3.0
๋ฒ๊ทธ๋ฅผ ์ค๋ช
ํด์ฃผ์ธ์
GET /api/Search?keyword=&skip=0&take=10&type=user
์์ keyword๊ฐ null ์ด๋ฉด ์ ์ฒด ์ ์ ๋ฅผ ๊ฐ์ ธ์ค์ง ์์ต๋๋ค.
๋ง๋ ๋์
keyword๊ฐ null ์ผ๋ ์ ์ฒด ์ ์ ๋ฅผ ๊ฐ์ ธ์์ผ ํฉ๋๋ค.
์ถ๊ฐ์ ์ธ ์ํฉ
where ์ฟผ๋ฆฌ๋ฅผ ์ฐ๋๋ฐ ์์ด์ keyword๊ฐ null ์ด๋ฉด where ์ฟผ๋ฆฌ๋ฅผ ๊ฒ์ฌํ์ง์๊ณ ๋ชจ๋ ๊ฒ์ ๊ฐ์ ธ์ค๊ฒ๋ ํด์ผํจ.
@InHyeok-J
โข A unique constraint covering the columns [followerId,followingId]
on the table follow
will be added. If there are existing duplicate values, this will fail.
โ Do you want to ignore the warning(s)? ... yes
Error: Database error
Error querying the database: Server error: `ERROR HY000 (1553): Cannot drop index 'PRIMARY': needed in a foreign key constraint'
0: sql_migration_connector::sql_database_step_applier::apply_migration
at migration-engine\connectors\sql-migration-connector\src\sql_database_step_applier.rs:11
1: migration_core::api::SchemaPush
at migration-engine\core\src\api.rs:161
unique๋ก ์ค์ ํ์ฌ id ์ธ๋ํค๊ฐ ์๋๊ฒ ๋ฌธ์ ์ธ๊ฑธ๋ก ๋ณด์ ๋๋ค. ์๋ฌด๋๋ @id ๋ก id๊ฐ์ ํ๋ ์์ฑํด์ค์ผ ํ๊ฑฐ๋ unique์์ @@id๋ก ์์ ํด์ผํ ๊ฒ ๊ฐ์ต๋๋ค.
๋ฒ๊ทธ๋ฅผ ์ค๋ช
ํด์ฃผ์ธ์
์ง๋ฌธ ๋ต์ฅ์์ด ์์๋ ๋ฐ์ดํฐ๋ฅผ ์ฃผ์ง ์์ต๋๋ค.
๋ง๋ ๋์
์ง๋ฌธ ๋ต์ฅ์์ด ์์๋๋ ๋น ๋ฐฐ์ด์ ์ฃผ์ด์ผ ํฉ๋๋ค.
์ถ๊ฐ์ ์ธ ์ํฉ
๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋๋ฐ ๋์๋๋ ๋น์์ ์ํฉ์ ์ ์ด์ฃผ์ธ์.
mbind: Operation not permitted
๋ผ๋ ์๋ฌ๋ฉ์์ง๊ฐ ๋จ๋ค๊ฐ ๋ก๊ทธ๊ฐ ๋๊ฒผ์ต๋๋ค. ์ด๋ฐ ์ํ๋ผ๋ฉด ํด๋น ์๋ฌ๋ฅผ ์์ฌํด๋ณผ๋ง ํฉ๋๋ค. ์๋๋ ๊ด๋ จ๋ ์๋ฌ์ ๋ํ ๊ฒ์ ๊ฒฐ๊ณผ์
๋๋ค.@InHyeok-J @iqeq1945
์๊ฒฌ ๋ถํ๋๋ฆฝ๋๋ค.
๋ฒ๊ทธ๋ฅผ ์ค๋ช
ํด์ฃผ์ธ์
POST /api/Archive/like ์๋ํฌ์ธํธ ํธ์ถ ์ ์๋ฌ
{
"name": "TypeError",
"message": "UserRepository.LikeOnArchive is not a function"
}
๋ง๋ ๋์
๋์ ํธ์ถ ์ ์ ์์ ์ผ๋ก like๊ฐ ๋์ด์ผํฉ๋๋ค.
์ถ๊ฐ์ ์ธ ์ํฉ
UserRepository.LikeOnArchive ํจ์๊ฐ ์์ต๋๋ค. ํด๋น ์ปค๋ฐ๋ด์ญ์ ๋ฌ์ ์ฝ๋ฉํธ ๋งํฌ์
๋๋ค.
https://github.com/Jandy-SeoulTech/Jandy_Web_Back/pull/82/files#r725908318
๋ฒ๊ทธ๋ฅผ ์ค๋ช
ํด์ฃผ์ธ์
GET /api/Post/:postId ์์ ์์นด์ด๋ธ๊ฐ ์๋ ๊ฒฝ์ฐ ์์นด์ด๋ธ ์ ๋ณด๋ฅผ ๋ณด๋ด์ฃผ์ง ์์ต๋๋ค.
๋ง๋ ๋์
์์นด์ด๋ธ ์ ๋ณด๋ฅผ ๋ณด๋ด์ฃผ์ด์ผ ํฉ๋๋ค.
์ถ๊ฐ์ ์ธ ์ํฉ
๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋๋ฐ ๋์๋๋ ๋น์์ ์ํฉ์ ์ ์ด์ฃผ์ธ์.
๋ฒ๊ทธ๋ฅผ ์ค๋ช
ํด์ฃผ์ธ์
ํ์ด์ง๋ค์ด์
api ์ ๋ฐ์์ ์ฌ๋ฆผ ๊ตฌํ์ด ์ ๋๋ก ๋์ง ์์ ํ์ด์ง ๊ฐฏ์๊ฐ ๋ฑ ๋ง์๋จ์ด์ง ๋ ์ ์ฒด ํ์ด์ง ๊ฐฏ์๊ฐ +1๋์ด ์๋ต๋๋ ๋ฒ๊ทธ
๋ง๋ ๋์
Math.ceil()
์ ์ฌ์ฉํ์ฌ ์ฌ๋ฆผ์ฒ๋ฆฌ๋ฅผ ํฉ๋๋ค.
์ถ๊ฐ์ ์ธ ์ํฉ
๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋๋ฐ ๋์๋๋ ๋น์์ ์ํฉ์ ์ ์ด์ฃผ์ธ์.
eslint ํ์ฌ import, export๋ก ์ฝ๋ฉ์ด ๋์ด์๊ธฐ ๋๋ฌธ์ ๊ด๋ จํ ์ค์ ์ผ๋ก ์ถ๊ฐ ํด์ผ ํ ๋ฏ.
์๋ก ํ๋ฆฌํฐ์ด์ eslint๊ฐ ์ค์ ๋์ง ์์์ ์ฝ๋ ์ ์ฅ ํน์ ์์ ์ ํ์์๋ ์ฝ๋๊น์ง ์ ์ฅ๋์ด git commit ๊ธฐ๋ก์ด ๋ง์ณ์ง.-> ๋ฆฌ๋ทฐ ํ๊ธฐ ํ๋ค์ด์ง
๋ฒ๊ทธ๋ฅผ ์ค๋ช
ํด์ฃผ์ธ์
GET /api/Search/?code=PROGRAMMING!COOK&keyword=&skip=3&take=6&type=channel
ํด๋น ์์์์ channel์ participants ์ ๋ณด๊ฐ ์๋ต๋ฐ๋์ ์์.
๋ง๋ ๋์
participants ์ ๋ณด๊ฐ ์๋ต ๋ฐ๋์ ์์ด์ผํฉ๋๋ค.
์ถ๊ฐ์ ์ธ ์ํฉ
๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋๋ฐ ๋์๋๋ ๋น์์ ์ํฉ์ ์ ์ด์ฃผ์ธ์.
๋ก๊ทธ์ธ ํ ์ ์ ์ ์ฑํ
๋ฐฉ ๋ฆฌ์คํธ ๋ฅผ ๋ถ๋ฌ์ค๋ API
๋ฅผ ํตํด ๋ฆฌ์คํธ๋ฅผ ์ค๋๋ค. ์ดํ ๋ฆฌ์คํธ๋ฅผ ์ ํ ํ๋ฉด ๊ทธ ๋ฐฉ์ ๋ต์ฅ ์ ๋ฆฌ์คํธ ๋ถ๋ฌ์ค๊ธฐ API
๋ฅผ ํตํด ๋ต์ฅ์ ํ๋ก ํธ๊ฐ ๋ ๋๋ง ํด์ค๋๋ค.์ด๋ฒ ์ด์์์ ์ฌ๊ธฐ๊น์ง ์์ ๋ฐ๋๋๋ค
๋ฒ๊ทธ๋ฅผ ์ค๋ช
ํด์ฃผ์ธ์
์คํค๋ง์ String์ผ๋ก ์ฒ๋ฆฌ๋ ๋ฐ์ดํฐ์ ๊ธธ์ด์ ํ์ด ์ค์ ๊ธฐํ์์ ์๋์ ๋ง์ง ์๋ ๊ฒฝ์ฐ๊ฐ ์์ด ์คํค๋ง๋ฅผ ์ ๋ถ ์ ๊ฒํ๊ณ ๊ธธ์ด์ ํ์ ์ฃผ์ด์ผ ํฉ๋๋ค.
๋ง๋ ๋์
Post์ Archive์ content ๋ฑ์ ๊ธธ์ด ์ ํ์ด ๋์์ผ ํฉ๋๋ค.
Babel ๊ด๋ จ ์ค๋ฅ ๋ฐ์, ์ด๋๊ฐ ๋ฌธ์ ์ธ์ง ํ์ธ ๋ถ๊ฐ๋ฅ
'babel-node'์(๋) ๋ด๋ถ ๋๋ ์ธ๋ถ ๋ช ๋ น, ์คํํ ์ ์๋ ํ๋ก๊ทธ๋จ, ๋๋๋ฐฐ์น ํ์ผ์ด ์๋๋๋ค
ํ๋กํ ์กฐํ API์ ์ถ๊ฐํด์ฃผ์ admin, participants ํ๋๋ฅผ ํ์ธํด๋ดค์ต๋๋ค.
API ๋ช ์ธ์์ ์์๋ก ์ ์ด์ฃผ์ ์๋ต์
"admin": [],
"participants": [
{
"channel": {
"id": 1,
"name": "์ถ.์.๋ชจ",
"introduce": "์ถ๊ตฌ๋ฅผ ์ํ๋ ์๋ชปํ๋ ์ฌ๋๋ค์ ๋ชจ์์
๋๋ค.",
"adminId": 3,
"createdAt": "2021-09-08T14:51:13.044Z",
"updatedAt": null,
"channelImage": {
"id": 4,
"src": "...",
"createdAt": "2021-09-08T14:51:13.044Z",
"updatedAt": null,
"profileId": null,
"channelId": 1,
"postId": null
}
}
}
]
์ด๋ ๊ฒ ๋์์์ต๋๋ค. ์ค์ ๋ก ์๋ต์ ๋ฐ์ผ๋ฉด ์์ฒ๋ผ ๋์ต๋๋ค.
๊ทธ๋ฐ๋ฐ admin ํ๋ ๊ฐ์ ๋ฐ์๋ณด๋ฉด
"admin": [
{
"id": 1,
"name": "์ถ.์.๋ชจ",
"introduce": "์ถ๊ตฌ๋ฅผ ์ํ๋ ์๋ชปํ๋ ์ฌ๋๋ค์ ๋ชจ์์
๋๋ค.",
"adminId": 3,
"createdAt": "2021-09-08T14:51:13.044Z",
"updatedAt": null,
"channelImage": {
"id": 4,
"src": "...",
"createdAt": "2021-09-08T14:51:13.044Z",
"updatedAt": null,
"profileId": null,
"channelId": 1,
"postId": null
}
}
]
์ด๋ ๊ฒ channel ์์ ์์ง ์์ ํํ๋ก ๋ฐ์ต๋๋ค.
์ ๋ admin ํ๋ ๊ฐ์ฒ๋ผ ๊ตณ์ด channel ํ๋กํผํฐ ์์ ๋ฃ์ง ์๊ณ admin, participants ํ๋์ ํํ๋ฅผ ๋๊ฐ๊ฒ ์์ ํ๋๊ฒ ์ข๋ค๊ณ ์๊ฐํฉ๋๋ค.
ํ์ฌ ํ๋ก ํธ ์ฝ๋๋ฅผ ์๋ฒ์์ ๋ฐฐํฌํ๊ธฐ ์ํด build ๋ ํ์ผ์ ์๋ฒ์์ ๋ณด๋ด์ฃผ๊ณ ์์ต๋๋ค. ๋ฌธ์ ๋ ํด๋น ๋ ํฌ์งํ ๋ฆฌ์ ๋์ปคํ์ผ์ ํด๋น ๋ ํฌ์งํ ๋ฆฌ์ ์์ค์ฝ๋๋ง ๋ณต์ฌํ์ฌ ๋์ปค ์ปจํ
์ด๋ ๋ด์ ๋ง๋ญ๋๋ค.
๋ฐ๋ผ์, index.js์์ ../../ ๋ฅผ ํ๋๋ผ๋ ํ๋ก ํธ ์ฝ๋(๋น๋ํ์ผ)๋ ํด๋น ๊ฒฝ๋ก์ ์์ต๋๋ค. ๋์ปค ์ปจํ
์ด๋ ๋ด์ ๋ณต์ฌ๋ ์์ค์ฝ๋๋ ์๋ฒ ๋ ํฌ์งํ ๋ฆฌ ๋ฟ์
๋๋ค.
Lines 3 to 10 in 8c7c7ae
docker build -t upgle .
๋ฅผ ์ํํ๋ฉด ํ์ฌ ๋๋ ํ ๋ฆฌ(Jandy_Web_Back)์์ ์ํํ๊ธฐ ๋๋ฌธ์ ํด๋น ๋ ํฌ๋ง ๋ณต์ฌํ๊ฒ ๋จ.
์ฐจ๋ผ๋ฆฌ ํ๋ก ํธ ๋น๋ ํ์ผ์ ์๋ฒ์ ๋ฃจํธ ๋๋ ํ ๋ฆฌ์ sftp๋ฑ์ผ๋ก ์ด์ ํ๊ณ , ์๋ฒ ์ธ์คํด์ค์ ๊ตณ์ด ํ๋ก ํธ ๋ ํฌ๋ฅผ ๋ง๋ค์ง ์๋๋ฐฉ๋ฒ.
๋์ปคํ์ผ์ ์ธ์คํด์ค ํ ๋๋ ํ ๋ฆฌ์ ๋๊ณ (ํน์ docker build -t upgle ../.
), ๋์ปคํ์ผ ๋ด์ฉ์ ์์ ํ๋ค.
์ด์ฌ์ธ์ ์ ๊ฐ ์์ ํ๋ ๊ฑธ ๊ธฐ๋ณธ์ผ๋ก ํ๊ณ , @InHyeok-J ์๊ฒ ์์ ๋ด์ญ์ ์ ๋ฌํ๋๋ก ํ๊ฒ ์ต๋๋ค. ์์ ์งํ์ํฉ ๊ณต์ ํ๊ฒ ์~!
๋ฒ๊ทธ๋ฅผ ์ค๋ช
ํด์ฃผ์ธ์
GET /api/Search ์๋ต ๊ฐ์ฒด์ ์ ์ฒด ๊ฒ์๋ ๊ฐฏ์๊ฐ ์์ต๋๋ค.
๋ง๋ ๋์
์๋ต๊ฐ์ฒด๋ ์ ์ฒด ๊ฒ์๋ ๊ฐฏ์๋ฅผ ํฌํจํด์ผ ํฉ๋๋ค. ์๋๋ ์๋ต ์์์
๋๋ค.
{
"total" : 32,
"data" : [
{},
{},
]
}
์ถ๊ฐ์ ์ธ ์ํฉ
๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋๋ฐ ๋์๋๋ ๋น์์ ์ํฉ์ ์ ์ด์ฃผ์ธ์.
์ถํ Table์ ๋ณ๊ฒฝ์ ์ค์ด๊ธฐ ์ํด issue์ ์ด์์ต๋๋ค.
model Archive {
id Int @id @default(autoincrement())
status ArchiveStatus // Private, Public ๊ณต๊ฐ๋ฒ์
content String // ์์นด์ด๋น์ ๋ค์ด๊ฐ (๊ฒ์๊ธ, ์ง๋ฌธ๋ต์)์ ๋ํ ์ถ๊ฐ ๋ด์ฉ ํน์ ํฌ์คํ
archiveComment Comment[] // ์์นด์ด๋น์ ์ํ๋ ๋๊ธ ๋ชฉ๋ก
owner User @relation("archive", fields: [ownerId], references: [id])
ownerId Int // ์์นด์ด๋น์ ์์ ์ฃผ
channel Channel @relation(fields: [channelId], references: [id])
channelId Int // ๊ณต๊ฐ๋ฒ์๊ฐ Private์ ์ํ ์ฑ๋์ ์ ์ ๋ฅผ ํ๋ณํ๊ธฐ์ํ ๊ฐ
post Post? @relation(fields: [postId], references: [id])
postId Int // ์ฃผ์ ๊ฐ ๋๋ POST ์ ๋ณด
chatMessage ChatMessage[] // ์ง๋ฌธ๋ต์์ ์ ๋ณด
createdAt DateTime
updatedAt DateTime?
@@map("archives")
}
enum ArchiveStatus {
Private
Public
}
model Channel {
...
archive Archive[]
...
}
model ChatMessage {
...
archive Archive? @relation(fields: [archiveId], references: [id])
archiveId Int? // ์ง๋ฌธ ๋ต์์ ์ ๋ฌํ๊ธฐ ์ํ ์์นด์ด๋ธ
...
}
model Post {
...
archive Archive?
...
}
model Comment {
....
post Post? @relation(fields: [postId], references: [id])
postId Int
archive Archive? @relation(fields: [archiveId], references: [id])
archiveId Int
...
}
ํ๋ฆฌ์ฆ๋ง์์ ์๊ฐ ๊ฐ์ ์ ์ฅํ ๋, KST ์๊ฐ์ด ์๋ UTC ์๊ฐ์ด ์ ์ฅ๋จ.
ex)(ํ์ฌ ์๊ฐ) : 21.5.13์ -> (ํ๋ฆฌ์ฆ๋ง๋ฅผ ํตํด DB์ ์ ์ฅ๋๋ ์๊ฐ ) 21.5.04์ (UTC : KTC-9hour)
๋ฌธ์ ๊ฐ ๋ฐ์ํ ์์ธ์ ์ ํํ ์ด์๋ ๋ชจ๋ฅด๊ฒ ์ผ๋ ํ๋ฆฌ์ฆ๋ง ์์ฒด์์ local timezone์ ๋ํ ์ง์์ ์ํ๋ ๋ฏ ํจ.
์ฐ๋ฆฌ ์๋น์ค๋ ์๊ฐ ๊ด๋ จ ์ด์๊ฐ ๋งค์ฐ ์ค์ํ ๊ฒ ๊ฐ์์ ์ด ๋ฌธ์ ์ ๋ํด์๋ ์ฌ์ฉํ๋ ์ธก client๊ฐ ํด๊ฒฐํ๊ฑฐ๋ , ์๋ฒ์์ DB์ ์ ์ฅ๋ ์๊ฐ์
๋ค์ ๊ฐ๊ณตํด์ ์ฒ๋ฆฌํ๊ฑฐ๋ ์์ ์ ์ฅํ๋ ์๊ฐ์ ๋ณ๊ฒฝํด์ผ ํจ.
prisma/prisma#5051 <- ์ฌ๊ธฐ์์ jhaemin์ด๋ ๋ถ์ด prisma์ issue๋ฅผ ๋จ๊ฒผ๋๋ฐ ์์ง๊น์ง ์ง์์ ์ํ๊ณ ์์.
์๋ ์๋ฃจ์ ์ ์ด์ ์์ฑ์ jhaemin ์ด๋ ๋ถ์ด ์ ์ํ ๋ฐฉ๋ฒ.
// UTC-9 using dayjs
export const dbNow = (): Date => dayjs().add(9, 'hour').toDate()
const now = dbNow()
await prisma.user.create({
data: {
createdAt: now,
updatedAt: now,
},
})
// Subtract 9 hours from all the Date objects recursively
function subtract9Hours(obj: Record<string, unknown>) {
if (!obj) return
for (const key of Object.keys(obj)) {
const val = obj[key]
if (val instanceof Date) {
obj[key] = dayjs(val).subtract(9, 'hour').toDate()
} else if (!isPrimitive(val)) {
subtract9Hours(val as any)
}
}
}
function prismaTimeMod<T>(value: T): T {
if (value instanceof Date) {
return dayjs(value).subtract(9, 'hour').toDate() as any
}
if (isPrimitive(value)) {
return value
}
subtract9Hours(value as any)
return value
}
// Create a prisma client instance with timemod
const prisma = new PrismaClient()
prisma.$use(async (params, next) => {
const result = await next(params)
return prismaTimeMod(result)
})
์์ง DB์ ๋ฐ์ดํฐ๊ฐ ๋ง์ด ๋ด๊ฒจ์ ธ ์์ง ์๊ณ ๋ฐฐํฌํ์ง ์์์ผ๋๊น, create, update ๋ก์ง ์ ์์ ์๊ฐํ now
์ ์ฉ์์ผ์ ๊ตฌํํ๊ณ ,
์คํค๋ง ์์ ์ด ํ์ํด ๋ณด์
Jandy_Web_Back/src/repositories/ChatMessageRepository.js
Lines 219 to 251 in cc39a1b
๋ฒ๊ทธ๋ฅผ ์ค๋ช
ํด์ฃผ์ธ์
GET /api/Search?code=&skip=0&take=10&type=channel
์ผ ์ code๊ฐ null์ด์ด์ validation์์ ์๋ฌ๊ฐ ๋ฉ๋๋ค.
๋ง๋ ๋์
code๊ฐ null ์ด๋ฉด ์ ์ฒด ์ฑ๋์ ๊ฐ์ ธ์์ผ ํฉ๋๋ค.
์ถ๊ฐ์ ์ธ ์ํฉ
๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋๋ฐ ๋์๋๋ ๋น์์ ์ํฉ์ ์ ์ด์ฃผ์ธ์.
name | code |
---|---|
๋ฏธ์ / ๊ณต์ | ART |
์๋ฆฌ / ์กฐ๋ฆฌ | COOK |
ํฌ์ / ๋ถ์ | INVEST |
์ธ๊ตญ์ด | LANGUAGE |
๋์์ธ | DESIGN |
ํจ์ / ๋ทฐํฐ | BEAUTY |
ํ๋ก๊ทธ๋๋ฐ | PROGRAMMING |
์ฐฝ์ | STARTUP |
์์ | MUSIC |
ํ๋ฆฌ๋น / ์ธํ ๋ฆฌ์ด | INTERIOR |
์ํ / ์๊ฒฉ์ฆ | EXAM |
์คํฌ์ธ | SPORTS |
์ฐ๊ธฐ / ๋ง์ | ACT |
ํซ / ๋ฐ๋ ค๋๋ฌผ | PET |
์ปค๋ฆฌ์ด | CAREER |
๊ฑด๊ฐ | HEALTH |
๋์ค | DANCE |
์ฌํ | TRAVEL |
ํ๋ฌธ | STUDY |
์ธ๊ฐ๊ด๊ณ | RELRATIONSHIP |
๋ผ์ดํ | LIFE |
์ฌ์ง / ์์ | MEDIA |
์ทจ๋ฏธ ์ํ | HOBBY |
๊ธฐํ | ETC |
๋ง์ด ์ฑ๋์์ ์ข ๋ฃ๋ ์ฑํ ๋ฐฉ์ด๋, ์ฑํ ๋ฐฉ์ ๋๊ฐ ๋ ๋ฆฌ๋ทฐ๋ฅผ ์์ฑํ๊ฒ ๋๋๋ฐ ์ฃผ์ด์ง๋ ๋ฐ์ดํฐ์ ์ฑ๋ID, OnwerId๊ฐ ์์ด ๋ฆฌ๋ทฐ๊ฐ ๋ถ๊ฐ๋ฅํ๊ณ ๋ฐ์ดํฐ ํ์์ด GET /api/Room/info/:roomId์ ๋ค๋ฆ ๋๋ค.
๋ฒ๊ทธ๋ฅผ ์ค๋ช
ํด์ฃผ์ธ์
์์นด์ด๋ธ ์
๋ฐ์ดํธ ์ ํ๊ทธ ์
๋ฐ์ดํธ ๋ฐ์ ์๋จ
๋ง๋ ๋์
์์นด์ด๋ธ ์
๋ฐ์ดํธ ์ ํ๊ทธ๋ ์
๋ฐ์ดํธ ๋์ด์ผ ํจ.
์ถ๊ฐ์ ์ธ ์ํฉ
๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋๋ฐ ๋์๋๋ ๋น์์ ์ํฉ์ ์ ์ด์ฃผ์ธ์.
๋ฒ๊ทธ๋ฅผ ์ค๋ช
ํด์ฃผ์ธ์
GET /api/Archive/channel/:channelId
api๊ฐ ํ์ด์ง๋ค์ด์
์ด ์ง์๋์ง ์์ต๋๋ค.
๋ง๋ ๋์
GET /api/Archive/channel/:channelId?page=&pageSize=
๋ก ๋ฐ๋์ด์ผ ํฉ๋๋ค.
์ถ๊ฐ์ ์ธ ์ํฉ
๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋๋ฐ ๋์๋๋ ๋น์์ ์ํฉ์ ์ ์ด์ฃผ์ธ์.
๋ฒ๊ทธ๋ฅผ ์ค๋ช
ํด์ฃผ์ธ์
GET /api/Archive/:archiveId์ ์๋ต๋ฐ๋์ archiveLike๊ฐ ์์ต๋๋ค.
{
"status": 200,
"success": true,
"message": "์ ๋ณด ์ป๊ธฐ ์ฑ๊ณต",
"data": {
"id": 3,
"title": "Prisma Timezone Error ๋ฐ์",
"status": "Public",
"content": "Timezone ERROR",
"ownerId": 10,
"channelId": 1,
"postId": null,
"createdAt": "2021-10-10T19:23:24.566Z",
"updatedAt": null,
"owner": {
"id": 10,
"email": "[email protected]",
"nickname": "์ค์ฐ์ด",
"profile": {
"id": 8,
"department": "",
"introduce": "",
"createdAt": "2021-10-10T01:51:30.827Z",
"updatedAt": null,
"userId": 10,
"profileImage": null
}
},
"post": null,
"tags": [
{
"archiveId": 3,
"tagId": 6,
"createdAt": "2021-10-10T19:23:24.566Z",
"updatedAt": null,
"tag": {
"id": 6,
"name": "bad",
"createdAt": "2021-10-10T19:23:24.566Z",
"updatedAt": null
}
},
{
"archiveId": 3,
"tagId": 7,
"createdAt": "2021-10-10T19:23:24.566Z",
"updatedAt": null,
"tag": {
"id": 7,
"name": "log",
"createdAt": "2021-10-10T19:23:24.566Z",
"updatedAt": null
}
},
{
"archiveId": 3,
"tagId": 8,
"createdAt": "2021-10-10T19:23:24.566Z",
"updatedAt": null,
"tag": {
"id": 8,
"name": "error",
"createdAt": "2021-10-10T19:23:24.566Z",
"updatedAt": null
}
}
],
"images": [
{
"src": null
}
]
}
}
์ฌํ๋ฐฉ๋ฒ
ํด๋น api ์์ฒญ
๋ง๋ ๋์
์๋ต ๋ฐ๋์ archiveLike(๋ฐฐ์ด, ํด๋น ์์นด์ด๋ธ๋ฅผ ๊ณต๊ฐํ ์ฌ์ฉ์Id)
๋ฒ๊ทธ๋ฅผ ์ค๋ช
ํด์ฃผ์ธ์
๋ฃธ ์์ฝ ์์ฑ ์ ์๊ฐ์ด AWS์ ์๊ฐ๋๋ก ์ค์ ๋๋ ๊ฒ ๊ฐ์
Locale์ ๋ง๋ ์๊ฐ ์ค์ ํ์
์ํฉ
์๋ฒ์์ ์ ์ฅํ๋ ๋ฐ์ดํฐ ์๊ฐ์ด UTC๊ฐ ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
์คํฌ๋ฆฐ์ท
Jandy_Web_Back/src/services/RoomServices.js
Lines 50 to 70 in 49af048
const date = new Date(req.body.reservedTime);
ํด๋น ๋ถ๋ถ์์ ๋ฌธ์ ๊ฐ ์๊ธฐ๋ ๊ฒ ๊ฐ์ต๋๋ค.
์ถ๊ฐ์ ์ธ ์ํฉ
POST /api/Room ์์ UTC, GMT+0900๋๋ค ๋ณด๋ด๋ดค๋๋ฐ ์๋ฒ์๋ -9์๊ฐ๋ผ์ ์ ์ฅ๋๋ค์
ํ์ฌ ํด๋ผ์ ์๋ฒ์ ์ด์์์ฑ ์ปจ๋ฒค์
์์ ๋ผ๋ฒจ์ ๋ถํ๋ ์ปจ๋ฒค์
์ด ํต์ผ์ด ์๋์ด ์์.
ํ์คํฌ ๋ถ๋ฅ์ ๋ฐ๋ฅธ ์ ์ ํ ๋ผ๋ฒจ ํด๋ฌ์คํฐ๋ง๊ณผ ๊นํ์์ ๊ธฐ๋ณธ์ง์ํ๋ ๋ผ๋ฒจ์ ์ข ์ปค์คํ
ํด์ ์ปจ๋ฒค์
์ ๋ฆฝํด์ผ ํจ.
2021.09.24์ ์ ๋ฆฝ ์์ .
์์นด์ด๋ธ ๊ธ์ด ์ถ๊ฐ๋๋ฉด์ ๋๊ธ ์์ฑ, ๋ถ๋ฌ์ค๊ธฐ API์ type ์ฟผ๋ฆฌ๊ฐ ์๊ฒผ๋๋ฐ์,
๋๊ธ ์์ฑ์์๋ [channel, archive] enum์ ์ฌ์ฉํ๊ณ ,
๋๊ธ ๋ถ๋ฌ์ค๊ธฐ์์๋ [post, archive] enum์ ์ฌ์ฉํด์ ๋ช
์นญ์ด ํท๊ฐ๋ฆฌ๋ ๊ฒ ๊ฐ์ต๋๋ค.
channel์ post๋ก ๋ฐ๊ฟ์ ํต์ผ ์ํค๋ฉด ์ดํดํ๊ธฐ ๋ ๋ช
ํํ ๊ฒ ๊ฐ์๋ฐ ์ด๋ป๊ฒ ์๊ฐํ์๋์?
๋ฒ๊ทธ๋ฅผ ์ค๋ช
ํด์ฃผ์ธ์
์ฑ๋ ์นดํ
๊ณ ๋ฆฌ ์คํค๋ง ๋ณ๊ฒฝ ์ดํ ์ฑ๋์์ฑ, ์ฑ๋ ์์ ์ด ๋ถ๊ฐํฉ๋๋ค.
์ฌํ๋ฐฉ๋ฒ
๋ฒ๊ทธ๋ฅผ ์ฌํํ๋ ค๋ฉด...
๋ง๋ ๋์
์ฑ๋ ์์ฑ๊ณผ ์ฑ๋ ์ ๋ณด ์์ ์ด ์ด๋ฃจ์ด์ ธ์ผํจ.
์คํฌ๋ฆฐ์ท
๋ฐฐํฌ ์๋ฒ ์๋ฌ๋ก๊ทธ์
๋๋ค.
PrismaClientKnownRequestError2 [PrismaClientKnownRequestError]: An operation failed because it depends on one or more records that were required but not found. No 'Category' record (needed to inline connect on create for 'ChannelCategory' record) was found for a nested connect on one-to-one relation 'CategoryToChannelCategory'.
at cb (/usr/app/node_modules/@prisma/client/runtime/index.js:34800:17)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 'P2025',
clientVersion: '2.28.0',
meta: {
cause: "No 'Category' record (needed to inline connect on create for 'ChannelCategory' record) was found for a nested connect on one-to-one relation 'CategoryToChannelCategory'."
}
}
์ถ๊ฐ์ ์ธ ์ํฉ
@iqeq1945 ํด๋ผ ๋ ํฌ์ ํด๋น api ์์ ์ด์ ๋ฐ ์นดํ
๊ณ ๋ฆฌ ์ด๋ฆ<->์ฝ๋ ๋์
๋๋ฆฌ ์ ๋ฌํ๋ ์ด์ ์์ฑํด์ ํด๋ผ ์์ ์ด ๋ ์ ์๋๋ก ํด์ฃผ์ธ์.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.