-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hyejung #7
Merged
Hyejung #7
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
416e302
[CHORE#4] ์ฝ๋ ์ปจ๋ฒค์
์ ์ฉ
hyejungg c1ef0f8
[ADD:#3] ์ฝ๋ ์คํ ์ ๋น ์ปฌ๋ ์
์์ฑํ๋๋ก ์ฝ๋ ์ถ๊ฐ
hyejungg cb348af
[CHORE:#3] ๋ฆฌ๋ทฐ ์ค ์ํ ์ ๋ณด ๋ฐฐ์ด ํํ๋ก ๋ณ๊ฒฝ ๋ฐ ์คํ ์์
hyejungg 006fe12
[CHORE:#3] Quantity ์ปฌ๋ ์
๋ช
์คํ ์์
hyejungg a85cd0a
[FEAT:#3] ๋ฉ์ธ ํ์ด์ง ์กฐํ ๊ธฐ๋ฅ ๊ตฌํ
hyejungg 7ebbd7a
[CHORE:#3] interface์์ ๋น ๊ฐ์ฒด๋ฅผ ์ฌ์ฉํ ์ ์๋๋ก ๋ณ๊ฒฝ
hyejungg 874bc43
[FEAT:#5] ๋ผ๋ฉด ๊ตฌ๋
์ ์ต์
๋ด์ฉ ์กฐํ ๊ธฐ๋ฅ ๊ตฌํ
hyejungg f687a93
[FEAT:#6] ๋ฆฌ๋ทฐ ๋ฑ๋ก ๊ธฐ๋ฅ ๊ตฌํ
hyejungg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,44 @@ | ||
import { Request, Response } from 'express'; | ||
import { validationResult } from 'express-validator'; | ||
import { ReviewCreateDto } from '../interfaces/review/ReviewCreateDto'; | ||
import message from '../modules/responseMessage'; | ||
import statusCode from '../modules/statusCode'; | ||
import util from '../modules/util'; | ||
import { ReviewService } from '../services'; | ||
|
||
const getReviewList = async (req: Request, res: Response): Promise<Response | void> => { | ||
try { | ||
const data = await ReviewService.getReviewList(); | ||
if (!data) { | ||
res.status(statusCode.NOT_FOUND).send(util.fail(statusCode.NOT_FOUND, message.NOT_FOUND)); | ||
} | ||
res.status(statusCode.OK).send(util.success(statusCode.OK, message.READ_MAINPAGE_REVIEW_SUCCESS, data)); | ||
} catch (error) { | ||
console.log(error); | ||
res.status(statusCode.INTERNAL_SERVER_ERROR).send(util.fail(statusCode.INTERNAL_SERVER_ERROR, message.INTERNAL_SERVER_ERROR)); | ||
} | ||
}; | ||
|
||
const createReview = async (req: Request, res: Response): Promise<Response | void> => { | ||
const error = validationResult(req); | ||
if (!error.isEmpty()) { | ||
return res.status(statusCode.BAD_REQUEST).send(util.fail(statusCode.BAD_REQUEST, message.BAD_REQUEST)); | ||
} | ||
|
||
const reviewCreateDto: ReviewCreateDto = req.body; | ||
try { | ||
const data = await ReviewService.createReview(reviewCreateDto); | ||
if (!data) { | ||
res.status(statusCode.NOT_FOUND).send(util.fail(statusCode.NOT_FOUND, message.NOT_FOUND)); | ||
} | ||
res.status(statusCode.CREATED).send(util.success(statusCode.CREATED, message.CREATE_REVIEW_SUCCESS, data)); | ||
} catch (error) { | ||
console.log(error); | ||
res.status(statusCode.INTERNAL_SERVER_ERROR).send(util.fail(statusCode.INTERNAL_SERVER_ERROR, message.INTERNAL_SERVER_ERROR)); | ||
} | ||
}; | ||
|
||
export default { | ||
getReviewList, | ||
createReview, | ||
}; |
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 @@ | ||
import { Request, Response } from 'express'; | ||
import message from '../modules/responseMessage'; | ||
import statusCode from '../modules/statusCode'; | ||
import util from '../modules/util'; | ||
import SubscribeService from '../services/SubscribeService'; | ||
|
||
const getSubscribeOptions = async (req: Request, res: Response) => { | ||
try { | ||
const data = await SubscribeService.getSubscribeOptions(); | ||
if (!data) { | ||
res.status(statusCode.NOT_FOUND).send(util.fail(statusCode.NOT_FOUND, message.NOT_FOUND)); | ||
} | ||
res.status(statusCode.OK).send(util.success(statusCode.OK, message.READ_SUBSCRIBE_OPTION_SUCCESS, data)); | ||
} catch (error) { | ||
console.log(error); | ||
res.status(statusCode.INTERNAL_SERVER_ERROR).send(util.fail(statusCode.INTERNAL_SERVER_ERROR, message.INTERNAL_SERVER_ERROR)); | ||
} | ||
}; | ||
|
||
export default { getSubscribeOptions }; |
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,3 +1,4 @@ | ||
// controller index file | ||
export { }; | ||
import ReviewController from './ReviewController'; | ||
import SubscribeController from './SubscribeController'; | ||
|
||
export { ReviewController, SubscribeController }; |
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,5 +1,5 @@ | ||
import mongoose from "mongoose"; | ||
import mongoose from 'mongoose'; | ||
|
||
export interface PostBaseResponseDto { | ||
_id: mongoose.Schema.Types.ObjectId; | ||
} | ||
_id: mongoose.Schema.Types.ObjectId; | ||
} |
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,3 +1,3 @@ | ||
export interface PeriodInfo { | ||
option: string; | ||
} | ||
option: string; | ||
} |
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,3 +1,3 @@ | ||
export interface QuantityInfo { | ||
option: string; | ||
}; | ||
option: string; | ||
} |
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,3 @@ | ||
import { ReviewInfo } from './ReviewInfo'; | ||
|
||
export interface ReviewCreateDto extends ReviewInfo {} |
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,8 +1,8 @@ | ||
export interface ReviewInfo { | ||
userName: String; | ||
thumbnail?: String; | ||
description: Text; | ||
rates: Number; | ||
packageName: string; | ||
product: String; | ||
} | ||
userName: string; | ||
thumbnail?: string; | ||
description: Text; | ||
rates: number; | ||
packageName: string; | ||
product: string[]; | ||
} |
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 @@ | ||
import mongoose from 'mongoose'; | ||
|
||
export interface ReviewResponseDto { | ||
_id: mongoose.Types.ObjectId; | ||
userName: string; | ||
description: Text; | ||
productList: string[]; | ||
reviewDate: string; | ||
thumbnail: string; | ||
} |
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,7 +1,7 @@ | ||
import { PeriodInfo } from "../period/PeriodInfo"; | ||
import { QuantityInfo } from "../quantity/QuantityInfo"; | ||
import { PeriodInfo } from '../period/PeriodInfo'; | ||
import { QuantityInfo } from '../quantity/QuantityInfo'; | ||
|
||
export interface SubscribeInfo { | ||
period: PeriodInfo; | ||
quantity: QuantityInfo; | ||
}; | ||
period: PeriodInfo; | ||
quantity: QuantityInfo; | ||
} |
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,7 @@ | ||
import { PeriodInfo } from '../period/PeriodInfo'; | ||
import { QuantityInfo } from '../quantity/QuantityInfo'; | ||
|
||
export interface SubscribeOptionDto { | ||
deliveryPeriodOptions: PeriodInfo[]; | ||
deliveryQuantityOptions: QuantityInfo[]; | ||
} |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import mongoose from "mongoose"; | ||
import { PeriodInfo } from "../interfaces/period/PeriodInfo"; | ||
import mongoose from 'mongoose'; | ||
import { PeriodInfo } from '../interfaces/period/PeriodInfo'; | ||
|
||
const PeriodSchema = new mongoose.Schema ({ | ||
option: { | ||
type: String, | ||
required: true | ||
} | ||
const PeriodSchema = new mongoose.Schema({ | ||
option: { | ||
type: String, | ||
required: true, | ||
}, | ||
}); | ||
|
||
export default mongoose.model<PeriodInfo & mongoose.Document>("Period", PeriodSchema) | ||
export default mongoose.model<PeriodInfo & mongoose.Document>('Period', PeriodSchema); |
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,11 +1,11 @@ | ||
import mongoose from "mongoose"; | ||
import { QuantityInfo } from "../interfaces/quantity/QuantityInfo"; | ||
import mongoose from 'mongoose'; | ||
import { QuantityInfo } from '../interfaces/quantity/QuantityInfo'; | ||
|
||
const QuantitySchema = new mongoose.Schema ({ | ||
option: { | ||
type: String, | ||
required: true | ||
} | ||
const QuantitySchema = new mongoose.Schema({ | ||
option: { | ||
type: String, | ||
required: true, | ||
}, | ||
}); | ||
|
||
export default mongoose.model<QuantityInfo & mongoose.Document>("Queantity", QuantitySchema) | ||
export default mongoose.model<QuantityInfo & mongoose.Document>('Quantity', QuantitySchema); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๋ง์ด ๋ฏธ์คํ ์,, |
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,32 +1,33 @@ | ||
import mongoose from "mongoose"; | ||
import { ReviewInfo } from "../interfaces/review/ReviewInfo"; | ||
import mongoose from 'mongoose'; | ||
import { ReviewInfo } from '../interfaces/review/ReviewInfo'; | ||
|
||
const ReviewSchema = new mongoose.Schema ({ | ||
const ReviewSchema = new mongoose.Schema( | ||
{ | ||
userName: { | ||
type: String, | ||
required: true | ||
type: String, | ||
required: true, | ||
}, | ||
thumbnanil: { | ||
type: String | ||
thumbnail: { | ||
type: String, | ||
}, | ||
description: { | ||
type: String, | ||
required: true | ||
type: String, | ||
required: true, | ||
}, | ||
rates: { | ||
type: Number, | ||
required: true | ||
type: Number, | ||
required: true, | ||
}, | ||
packageName: { | ||
type: String, | ||
required: true | ||
type: String, | ||
required: true, | ||
}, | ||
product: { | ||
type: String, | ||
required: true | ||
} | ||
}, | ||
{timestamps: true} | ||
type: Array, | ||
required: true, | ||
}, | ||
}, | ||
{ timestamps: true }, | ||
); | ||
|
||
export default mongoose.model<ReviewInfo & mongoose.Document>("Review", ReviewSchema) | ||
export default mongoose.model<ReviewInfo & mongoose.Document>('Review', ReviewSchema); |
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,19 +1,19 @@ | ||
import mongoose from "mongoose"; | ||
import { SubscribeInfo } from "../interfaces/subscribe/SubscribeInfo"; | ||
import mongoose from 'mongoose'; | ||
import { SubscribeInfo } from '../interfaces/subscribe/SubscribeInfo'; | ||
|
||
const SubscribeSchema = new mongoose.Schema ({ | ||
period: { | ||
option: { | ||
type: String, | ||
required: true | ||
} | ||
const SubscribeSchema = new mongoose.Schema({ | ||
period: { | ||
option: { | ||
type: String, | ||
required: true, | ||
}, | ||
quantity: { | ||
option: { | ||
type: String, | ||
required: true | ||
} | ||
} | ||
}, | ||
quantity: { | ||
option: { | ||
type: String, | ||
required: true, | ||
}, | ||
}, | ||
}); | ||
|
||
export default mongoose.model<SubscribeInfo & mongoose.Document>("Subscribe", SubscribeSchema) | ||
export default mongoose.model<SubscribeInfo & mongoose.Document>('Subscribe', SubscribeSchema); |
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,10 @@ | ||
import { Router } from 'express'; | ||
import { body } from 'express-validator'; | ||
import { ReviewController } from '../controllers'; | ||
|
||
const router: Router = Router(); | ||
|
||
router.get('/', ReviewController.getReviewList); | ||
router.post('/', [body('userName').notEmpty(), body('description').notEmpty(), body('rates').notEmpty(), body('packageName').notEmpty(), body('product').notEmpty()], ReviewController.createReview); | ||
|
||
export default router; |
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 { Router } from 'express'; | ||
import { SubscribeController } from '../controllers'; | ||
|
||
const router: Router = Router(); | ||
|
||
router.get('/', SubscribeController.getSubscribeOptions); | ||
|
||
export default router; |
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,6 +1,11 @@ | ||
// router index file | ||
import { Router } from 'express'; | ||
import ReviewRouter from './ReviewRouter'; | ||
import SubScribeRouter from './SubscribeRouter'; | ||
|
||
const router = Router(); | ||
const router: Router = Router(); | ||
|
||
router.use('/review', ReviewRouter); | ||
router.use('/subscribe', SubScribeRouter); | ||
|
||
export default router; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋นผ๋จน์ ๋ก๋ ์ ์ฑ๊ฒจ์ฃผ์ ์ ๊ฐ์ผ๋น~! ๐