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
4f17e307
Commit
4f17e307
authored
Jul 21, 2022
by
Jiwon Yoon
Browse files
Merge branch 'seoyeon_' into jiwon0718
parents
463ce408
117bbc7e
Changes
8
Show whitespace changes
Inline
Side-by-side
frontend/src/apis/survey.api.ts
View file @
4f17e307
...
...
@@ -17,7 +17,6 @@ export const ansSurvey = async (surveyId: string) => {
return
data
;
};
//동혁
export
const
getSurveys
=
async
()
=>
{
const
{
data
}
=
await
axios
.
get
(
`
${
baseUrl
}
/surveys/`
);
return
data
;
...
...
frontend/src/commons/ACheckbox.tsx
→
frontend/src/commons/ACheckbox
Form
.tsx
View file @
4f17e307
...
...
@@ -21,7 +21,7 @@ export const ACheckboxForm = ({ element, response, handleAnswer }: Props) => {
handleAnswer
();
};
return
(
<
div
className
=
"flex w-full gap-
4
justify-around my-3"
>
<
div
className
=
"flex w-full gap-
2
justify-around my-3"
>
{
element
.
content
.
choices
.
map
((
choice
)
=>
(
<
div
>
<
input
...
...
frontend/src/commons/ADateForm.tsx
0 → 100644
View file @
4f17e307
import
React
from
"
react
"
;
export
const
ADateForm
=
()
=>
{
return
(
<
div
className
=
"justify-start w-11/12 m-3 py-4"
>
<
input
type
=
"date"
></
input
>
</
div
>
);
};
frontend/src/commons/ADropdown.tsx
→
frontend/src/commons/ADropdown
Form
.tsx
View file @
4f17e307
File moved
frontend/src/commons/AQuestion.tsx
View file @
4f17e307
import
React
,
{
useState
}
from
"
react
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
BasicQuestionType
,
AnswerType
,
SurveyType
}
from
"
../types
"
;
import
{
ACheckboxForm
}
from
"
./ACheckbox
"
;
import
{
ADropdownForm
}
from
"
./ADropdown
"
;
import
{
ACheckboxForm
}
from
"
./ACheckboxForm
"
;
import
{
ADateForm
}
from
"
./ADateForm
"
;
import
{
ADropdownForm
}
from
"
./ADropdownForm
"
;
import
{
AEssayForm
}
from
"
./AEssayForm
"
;
import
{
ARadioForm
}
from
"
./ARadioForm
"
;
import
{
AFileForm
}
from
"
./AFileForm
"
;
import
{
ARadioForm
}
from
"
./ARadioForm
"
;
import
{
ARatingForm
}
from
"
./ARatingForm
"
;
type
Props
=
{
question
:
BasicQuestionType
;
...
...
@@ -70,6 +72,10 @@ export const AQuestion = ({
// currentId={currentId}
// />
// );
case
"
rating
"
:
return
<
ARatingForm
element
=
{
question
}
/>;
case
"
date
"
:
return
<
ADateForm
/>;
default
:
return
<></>;
}
...
...
frontend/src/commons/ARadioForm.tsx
View file @
4f17e307
...
...
@@ -21,7 +21,7 @@ export const ARadioForm = ({ element, response, handleAnswer }: Props) => {
handleAnswer
();
};
return
(
<
div
className
=
"flex w-full gap-
4
justify-around my-3"
>
<
div
className
=
"flex w-full gap-
2
justify-around my-3"
>
{
element
.
content
.
choices
.
map
((
choice
)
=>
(
<
div
>
<
input
...
...
frontend/src/commons/ARatingForm.tsx
0 → 100644
View file @
4f17e307
import
React
,
{
useState
}
from
"
react
"
;
import
{
RatingType
}
from
"
../types
"
;
type
Props
=
{
element
:
RatingType
;
};
export
const
ARatingForm
=
({
element
}:
Props
)
=>
{
const
[
selectedchoice
,
setSelectedchoice
]
=
useState
(
""
);
function
buttonClick
(
event
:
React
.
MouseEvent
<
HTMLButtonElement
>
)
{
event
.
preventDefault
();
setSelectedchoice
(
event
.
currentTarget
.
name
);
}
return
(
<
div
className
=
"flex w-full justify-center space-x-12 my-3"
>
<
label
className
=
"mt-3"
>
{
element
.
content
.
minRateDescription
}
</
label
>
{
element
.
content
.
choices
.
map
((
choice
)
=>
(
<
div
className
=
"flex gap-4"
>
<
button
type
=
"button"
className
=
"border border-themeColor rounded-full w-12 h-12 text-center hover:bg-slate-300"
name
=
{
choice
.
text
}
onClick
=
{
buttonClick
}
style
=
{
{
backgroundColor
:
selectedchoice
===
choice
.
text
?
"
#58ACFA
"
:
"
white
"
,
}
}
>
{
choice
.
text
}
</
button
>
</
div
>
))
}
<
label
className
=
"mt-3"
>
{
element
.
content
.
maxRateDescription
}
</
label
>
</
div
>
);
};
src/controllers/survey.controller.ts
View file @
4f17e307
import
{
NextFunction
,
Request
,
Response
}
from
"
express
"
;
import
{
surveyDb
}
from
"
../db
"
;
import
{
asyncWrap
}
from
"
../helpers/asyncWrap
"
;
// import jwt, { JwtPayload } from "jsonwebtoken";
// import { cookieConfig, envConfig, jwtCofig } from "../config";
export
interface
TypedRequestAuth
<
T
>
extends
Request
{
auth
:
T
;
...
...
@@ -68,3 +70,29 @@ export const userBySurveyId = async (
);
}
};
// export const checksurvey = asyncWrap(async(req, res)=> {
// const {_id} = req.body
// const surveyExist = await surveyDb.isSurvey(_id);
// if (surveyExist) {
// return res.status(422).send("이미 제출된 설문조사입니다")
// }
// });
// export const surveynotexist = asyncWrap(async (req, res) => {
// const { _id } = req.body;
// console.log(`surveyId: ${_id}`);
// const checksurveyId = await surveyDb.findUserBySurveyId(_id);
// const surveytoken = jwt.sign({existsurveyId: checksurveyId?.id}, jwtCofig.secret, {
// expiresIn:jwtCofig.expires,
// });
// res.cookie(cookieConfig.name, surveytoken, {
// maxAge:cookieConfig.maxAge,
// path:"/",
// httpOnly: envConfig.mode === "production",
// secure: envConfig.mode === "production",
// })
// res.json({
// surveyId: checksurveyId?._id
// })
// });
\ No newline at end of file
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