Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
survey
Commits
5aef8193
Commit
5aef8193
authored
Sep 19, 2022
by
Yoon, Daeki
😅
Browse files
update 수정
parent
96d0a352
Changes
3
Show whitespace changes
Inline
Side-by-side
frontend/src/layouts/SurveyLayout.tsx
View file @
5aef8193
...
@@ -59,7 +59,10 @@ export const SurveyLayout = () => {
...
@@ -59,7 +59,10 @@ export const SurveyLayout = () => {
};
};
const
updateQuestion
=
async
(
question
:
CreateQuestionData
)
=>
{
const
updateQuestion
=
async
(
question
:
CreateQuestionData
)
=>
{
await
surveyApi
.
updateQuestion
(
survey
.
_id
!
,
question
);
const
updatedQuestion
=
await
surveyApi
.
updateQuestion
(
survey
.
_id
!
,
question
);
const
questions
=
survey
.
questions
;
const
questions
=
survey
.
questions
;
const
index
=
questions
.
findIndex
((
q
)
=>
q
.
_id
===
question
.
_id
);
const
index
=
questions
.
findIndex
((
q
)
=>
q
.
_id
===
question
.
_id
);
...
...
src/controllers/survey.controller.ts
View file @
5aef8193
...
@@ -65,6 +65,12 @@ export const getSurveys = asyncWrap(async (reqExp: Request, res: Response) => {
...
@@ -65,6 +65,12 @@ export const getSurveys = asyncWrap(async (reqExp: Request, res: Response) => {
return
res
.
json
(
surveys
);
return
res
.
json
(
surveys
);
});
});
export
const
updateQuestion
=
asyncWrap
(
async
(
req
:
Request
,
res
:
Response
)
=>
{
const
question
=
req
.
body
;
const
updatedQuestion
=
await
questionDb
.
updateQuestion
(
question
);
return
res
.
json
(
updatedQuestion
);
});
export
const
updateSurvey
=
asyncWrap
(
async
(
req
,
res
)
=>
{
export
const
updateSurvey
=
asyncWrap
(
async
(
req
,
res
)
=>
{
const
survey
=
req
.
body
;
const
survey
=
req
.
body
;
const
updatedSurvey
=
await
surveyDb
.
updateSurvey
(
survey
);
const
updatedSurvey
=
await
surveyDb
.
updateSurvey
(
survey
);
...
...
src/routes/survey.route.ts
View file @
5aef8193
...
@@ -24,6 +24,7 @@ router
...
@@ -24,6 +24,7 @@ router
router
router
.
route
(
"
/:surveyId/questions/:questionId
"
)
.
route
(
"
/:surveyId/questions/:questionId
"
)
.
put
(
authCtrl
.
requireLogin
,
authCtrl
.
authenticate
,
surveyCtrl
.
updateQuestion
)
.
delete
(
.
delete
(
authCtrl
.
requireLogin
,
authCtrl
.
requireLogin
,
authCtrl
.
authenticate
,
authCtrl
.
authenticate
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment