Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b8de317
Hotfix: 랭킹 검색 오류 수정
GulSauce Mar 7, 2025
a32180c
Hotfix:title_ regex_edit
GB6105 Mar 7, 2025
2caeab2
Hotfix: 모의고사 문제 풀이 부분 입력
GulSauce Mar 7, 2025
b9a0ed4
Hotfix: password_change_logic_edit
GB6105 Mar 8, 2025
19d031d
[SUS-76] notice까지 완료
GulSauce Mar 9, 2025
4a89604
[SUS-76] tier까지 완료
GulSauce Mar 9, 2025
9cc836a
[SUS-76] :idx 관련 수정
GulSauce Mar 9, 2025
4a295e0
[SUS-76] 리팩터링 완료
GulSauce Mar 9, 2025
6fbf1c1
[SUS-76] 잘못된 의존성 수정
GulSauce Mar 9, 2025
45e60a8
[SUS-76] 불필요한 의존성 제거
GulSauce Mar 9, 2025
83a2d60
Merge pull request #30 from Stageus/SUS-76-endpoint-refactor
GulSauce Mar 9, 2025
758ff08
[SUS-75]Feat/member_data_check_query_edit
GB6105 Mar 9, 2025
a56d2e0
[SUS-75]Feat/checkEmail_query_added
GB6105 Mar 10, 2025
d4b8d6a
Merge pull request #31 from Stageus/SUS-75-social-login-edit
GB6105 Mar 11, 2025
afa07bd
[SUS-78]Feat/Regexp_class_delete
GB6105 Mar 10, 2025
7026621
[SUS-78]Feat/request_input_regex_delete
GB6105 Mar 10, 2025
394398e
Merge pull request #32 from Stageus/SUS-78-regexp-staticfication
GB6105 Mar 11, 2025
c6afa32
[SUS-82] 체크 포인트
GulSauce Mar 12, 2025
f593d77
[SUS-81]Feat/modify_date_format_from_query_result
GB6105 Mar 12, 2025
c0657f4
[SUS-82] 체크포인트
GulSauce Mar 12, 2025
8b11203
[SUS-82] 글 작성 사양 변경
GulSauce Mar 12, 2025
88af6b3
[SUS-82] 수정 완료
GulSauce Mar 12, 2025
f55e680
[SUS-82] mock rank 존재하지 않을 경우 빈 배열
GulSauce Mar 12, 2025
4ce5ebc
Merge pull request #35 from Stageus/SUS-82-fe-link-edit
GB6105 Mar 12, 2025
80e75c4
Merge pull request #33 from Stageus/SUS-81-date-query-edit
GB6105 Mar 13, 2025
820011d
[SUS-83]Feat/dao_added
GB6105 Mar 12, 2025
56126a0
[SUS-83]Feat/modify_types_of_frontend_dao
GB6105 Mar 12, 2025
7574c03
Merge pull request #34 from Stageus/SUS-83-notice-dao
GB6105 Mar 13, 2025
18c4828
Hotfix: reset_redis_after_signup_approved
GB6105 Mar 13, 2025
a9946d2
[SUS-84] 통일 완료
GulSauce Mar 14, 2025
b6b8aad
[SUS-84] 닉네임 dao 변경
GulSauce Mar 14, 2025
4e5cab0
[SUS-84] 발생한 추가 수정 사항 반영
GulSauce Mar 14, 2025
cf7c830
Merge pull request #36 from Stageus/SUS-84-request-dto
GulSauce Mar 14, 2025
4c8a1a6
[SUS-86]Feat/modify_mock_date_format
GB6105 Mar 14, 2025
11e3f4f
[SUS-85] 응답 dto 수정
GulSauce Mar 14, 2025
fcf591c
Merge pull request #37 from Stageus/SUS-86-mock-date-modify
GB6105 Mar 14, 2025
c57c31f
Merge pull request #38 from Stageus/SUS-85-result-rank
GulSauce Mar 14, 2025
0f1ed1f
HotfiX:google_login_url_edit
GB6105 Mar 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .sql/.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ CREATE TABLE "mock" (
"title" TEXT NOT NULL,
"description" TEXT NOT NULL,
"quiz_count" INTEGER NOT NULL,
"like_count" INTEGER DEFAULT 0 NOT NULL,
"created_at" TIMESTAMP NOT NULL,
"updated_at" TIMESTAMP DEFAULT NOW() NOT NULL,
"is_deleted" BOOLEAN DEFAULT FALSE NOT NULL
Expand Down
1 change: 1 addition & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import express from 'express'
configDotenv()

const app = express()

app.use(
cors({
origin: process.env.FRONTEND_SERVER_URL,
Expand Down
73 changes: 5 additions & 68 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@
"#error/*": "./dist/src/core/error/*.js"
},
"dependencies": {
"@types/crypto-js": "4.2.2",
"@upstash/redis": "1.34.4",
"cookie-parser": "1.4.7",
"cors": "2.8.5",
"crypto-js": "4.2.0",
"crypto-ts": "1.0.2",
"dotenv": "16.4.7",
"express": "4.21.2",
"jsonwebtoken": "9.0.2",
Expand All @@ -40,6 +38,7 @@
"devDependencies": {
"@types/cookie-parser": "1.4.8",
"@types/cors": "2.8.17",
"@types/crypto-js": "^4.2.2",
"@types/express": "5.0.0",
"@types/jsonwebtoken": "9.0.8",
"@types/multer": "1.4.12",
Expand Down
5 changes: 5 additions & 0 deletions src/core/error/ErrorRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ export default class ErrorRegistry {
'MU001',
'지원하지 않는 파일 형식입니다',
)
static readonly OUT_OF_UPLOAD_LIMIT = new CustomError(
400,
'MU002',
'파일 업로드 개수를 초과했습니다',
)

// Like(LI)
static readonly DUPLICATE_LIKE = new CustomError(
Expand Down
27 changes: 11 additions & 16 deletions src/core/util/Regex/index.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
export default class Regex {
public static readonly ID = /^(?=.*[a-zA-Z])[a-zA-Z0-9]{5,16}$/
public static readonly EMAIL =
/^[a-zA-Z0-9._%+-]{1,20}@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
public static readonly NICKNAME =
/^(?=.*[가-힣a-zA-Z])[가-힣a-zA-Z0-9]{2,12}$/
public static readonly TITLE = /^[가-힣a-zA-Z0-9]{2,50}$/
public static readonly DESCRIPTION = /^[가-힣a-zA-Z0-9]{2,500}$/
public static readonly SUBJECT = /^(?=.*[가-힣a-zA-Z])[가-힣a-zA-Z0-9]{2,50}$/
public static readonly QUIZ_COUNT = /^(10|[1-9])$/
public static readonly CONTENT = /^[가-힣a-zA-Z0-9]{2,500}$/
public static readonly TEXT_ANSWER =
/^[가-힣a-zA-Z0-9!@#$%^&*()_+={}\[\]:;"'<>,.?~`-]{1,100}$/
public static readonly SEARCH = /^[가-힣a-zA-Z0-9]{2,100}$/
public static readonly TIER = /^(DIAMOND|PLATINUM|GOLD|SILVER|BRONZE)$/
public static readonly FILE =
/^(?:[^\s]+\.jpg|[^\s]+\.png)(,(?:[^\s]+\.jpg|[^\s]+\.png)){0,4}$/
public static readonly PASSWORD =
/^(?=.*[a-zA-Z])(?=.*\d)[a-zA-Z0-9!@#$%^&*()_+={}\[\]:;"'<>,.?~`-]{8,16}$/

public static readonly EMAIL =
/^[a-zA-Z0-9._%+-]{1,20}@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,100}$/

public static readonly NICKNAME = /^.{2,12}$/
public static readonly SUBJECT = /^.{1,50}$/
public static readonly TITLE = /^.{1,50}$/
public static readonly DESCRIPTION = /^.{0,1000}$/
public static readonly CONTENT = /^.{0,10000}$/
public static readonly TIER = /^(DIAMOND|PLATINUM|GOLD|SILVER|BRONZE)$/
public static readonly UUID =
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/
}
24 changes: 20 additions & 4 deletions src/core/util/multipartParser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,26 @@ const multipartParser = (contentType: string, limit: number) => {
}
}

const uploadUrls = req.files.map((file) => {
const multerFile = file as Express.MulterS3.File
return replaceBaseUrl(multerFile.location)
})
const uploadUrls = []
if (req.body.existingUrls) {
const existingUrls = req.body.existingUrls.split(',')
existingUrls.forEach((url: string) => {
if (!url.startsWith(newBaseUrl)) {
return next(ErrorRegistry.INVALID_INPUT_FORMAT)
}
})
if (existingUrls.length + req.files.length > limit) {
return next(ErrorRegistry.OUT_OF_UPLOAD_LIMIT)
}
uploadUrls.push(...existingUrls)
}

uploadUrls.push(
...req.files.map((file) => {
const multerFile = file as Express.MulterS3.File
return replaceBaseUrl(multerFile.location)
}),
)

req.body = { ...req.body, uploadUrls }
next()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class ArticleIdxPath {
public idx: UUID

constructor(params: ArticleIdxPathParams) {
if (!new RegExp(Regex.UUID).test(params.idx)) {
if (!Regex.UUID.test(params.idx)) {
throw ErrorRegistry.INVALID_INPUT_FORMAT
}
this.idx = params.idx
Expand Down
21 changes: 0 additions & 21 deletions src/like/router/addRouter.ts

This file was deleted.

6 changes: 2 additions & 4 deletions src/like/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import express from 'express'
import { addRouter } from './addRouter.js'
import { deleteRouter } from './deleteRouter.js'
import { likeItemRouter } from './likeItemRouter.js'

export const likeRouter = express.Router()

likeRouter.use('/add', addRouter)
likeRouter.use('/delete', deleteRouter)
likeRouter.use('/', likeItemRouter)
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,24 @@ import express from 'express'
import ArticleIdxPath from '../entity/dao/frontend/request/path/ArticleIdxPath.js'
import LikeService from '../service/LikeService.js'

export const deleteRouter = express.Router()
export const likeItemRouter = express.Router()

deleteRouter.delete(
likeItemRouter.post(
'/:idx',
controller(
'login',
null,
ArticleIdxPath,
null,
null,
)(async (req, res) => {
return res.send(
await LikeService.addLikeToArticle(req.memberIdx, req.params.idx),
)
}),
)

likeItemRouter.delete(
'/:idx',
controller(
'login',
Expand Down
2 changes: 2 additions & 0 deletions src/member/entity/dao/db/ProfileResultFromDB.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export default interface ProfileResultFromDB {
nickname: string
role: string
idx: number
}
4 changes: 2 additions & 2 deletions src/member/entity/dao/frontend/request/FindIdRequest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ErrorRegistry from '#error/ErrorRegistry'
import Regex from '#util/Regex'
interface FindIdRequestParams {
email: string
}
Expand All @@ -7,10 +8,9 @@ export default class FindIdRequest {
public email: string

constructor(params: FindIdRequestParams) {
if (!params.email || params.email.length > 100) {
if (!Regex.EMAIL.test(params.email)) {
throw ErrorRegistry.INVALID_INPUT_FORMAT
}
this.email = params.email
}
}
;``
15 changes: 9 additions & 6 deletions src/member/entity/dao/frontend/request/FindPasswordRequest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ErrorRegistry from '#error/ErrorRegistry'
import Regex from '#util/Regex'
interface FindPasswordRequestParams {
id: string
email: string
Expand All @@ -9,15 +10,17 @@ export default class FindPasswordRequest {
public email: string

constructor(params: FindPasswordRequestParams) {
if (
!params.id ||
!params.email ||
params.id.length > 100 ||
params.email.length > 100
) {
if (!params.id) {
throw ErrorRegistry.INVALID_INPUT_FORMAT
}
if (params.id.length > 16) {
throw ErrorRegistry.INVALID_INPUT_FORMAT
}
this.id = params.id

if (!Regex.EMAIL.test(params.email)) {
throw ErrorRegistry.INVALID_INPUT_FORMAT
}
this.email = params.email
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default class NicknameChangeRequest {
public nickname: string

constructor(params: NicknameChangeRequestParams) {
if (!new RegExp(Regex.NICKNAME).test(params.nickname)) {
if (!Regex.NICKNAME.test(params.nickname)) {
throw ErrorRegistry.INVALID_INPUT_FORMAT
}
this.nickname = params.nickname
Expand Down
18 changes: 11 additions & 7 deletions src/member/entity/dao/frontend/request/NormalLoginRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@ export default class NormalLoginRequest {
public id: string
public password: string
constructor(params: NormalLoginRequestParams) {
if (
!params.id ||
!params.password ||
params.id.length > 100 ||
params.password.length > 100
) {
if (!params.id) {
throw ErrorRegistry.INVALID_INPUT_FORMAT
}
if (params.id.length > 16) {
throw ErrorRegistry.INVALID_INPUT_FORMAT
}

this.id = params.id

if (!params.password) {
throw ErrorRegistry.INVALID_INPUT_FORMAT
}
if (params.password.length > 16) {
throw ErrorRegistry.INVALID_INPUT_FORMAT
}
this.password = params.password
}
}
Loading