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
73188bcd
Commit
73188bcd
authored
Jul 12, 2022
by
Lee SeoYeon
Browse files
.
parent
a6bbadc0
Changes
9
Show whitespace changes
Inline
Side-by-side
frontend/src/apis/survey.api.ts
View file @
73188bcd
...
@@ -7,3 +7,8 @@ export const createSurvey = async (survey:SurveyType) => {
...
@@ -7,3 +7,8 @@ export const createSurvey = async (survey:SurveyType) => {
const
{
data
}
=
await
axios
.
post
(
`
${
baseUrl
}
/surveys/create`
,
{...
survey
})
const
{
data
}
=
await
axios
.
post
(
`
${
baseUrl
}
/surveys/create`
,
{...
survey
})
return
data
;
return
data
;
}
}
// export const getSurvey = async () => {
// const {data} = await axios.get(`${baseUrl}/surveys/profile`)
// return data;
// }
\ No newline at end of file
frontend/src/commons/ACheckbox.tsx
View file @
73188bcd
...
@@ -16,6 +16,32 @@ export const ACheckboxForm = () => {
...
@@ -16,6 +16,32 @@ export const ACheckboxForm = () => {
/>
/>
<
input
className
=
"ml-2 text-lg font-medium"
>
First checkbox
</
input
>
<
input
className
=
"ml-2 text-lg font-medium"
>
First checkbox
</
input
>
</
div
>
</
div
>
<
div
className
=
"mb-4 mx-3"
>
<
input
id
=
"default-checkbox"
type
=
"checkbox"
className
=
"w-5 h-5 mt-3 text-blue-600 bg-gray-100 rounded border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
/>
<
label
className
=
"ml-2 text-lg font-medium"
>
Second checkbox
</
label
>
</
div
>
<
div
className
=
"mb-4 mx-3"
>
<
input
id
=
"default-checkbox"
type
=
"checkbox"
value
=
""
className
=
"w-5 h-5 mt-3 text-blue-600 bg-gray-100 rounded border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
/>
<
label
className
=
"ml-2 text-lg font-medium"
>
Third checkbox
</
label
>
</
div
>
<
div
className
=
"mb-4 mx-4"
>
<
input
id
=
"default-checkbox"
type
=
"checkbox"
value
=
""
className
=
"w-5 h-5 mt-3 text-blue-600 bg-gray-100 rounded border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
/>
<
label
className
=
"ml-2 text-lg font-medium"
>
Fourth checkbox
</
label
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
);
);
...
...
frontend/src/commons/ADropdown.tsx
View file @
73188bcd
...
@@ -7,7 +7,7 @@ export const ADropdownForm = () => {
...
@@ -7,7 +7,7 @@ export const ADropdownForm = () => {
<
form
className
=
"text-xl font-bold ml-6 w-1/2"
>
dropdown
</
form
>
<
form
className
=
"text-xl font-bold ml-6 w-1/2"
>
dropdown
</
form
>
</
div
>
</
div
>
<
form
className
=
"border w-11/12 my-3"
>
설문조사 설명
</
form
>
<
form
className
=
"border w-11/12 my-3"
>
설문조사 설명
</
form
>
<
select
className
=
"py-2 bg-themeColor
rounded text-white
"
>
<
select
className
=
"py-2
hover:
bg-themeColor
bg-gray-200 rounded
"
>
<
option
selected
>
choose answer
</
option
>
<
option
selected
>
choose answer
</
option
>
<
option
>
first
</
option
>
<
option
>
first
</
option
>
<
option
>
second
</
option
>
<
option
>
second
</
option
>
...
...
frontend/src/commons/SurveyForm.tsx
View file @
73188bcd
...
@@ -15,7 +15,7 @@ export const SurveyForm = () => {
...
@@ -15,7 +15,7 @@ export const SurveyForm = () => {
rows
=
{
2
}
rows
=
{
2
}
cols
=
{
60
}
cols
=
{
60
}
></
textarea
>
></
textarea
>
<
ACheckboxForm
></
ACheckboxForm
>
{
/*
<ACheckboxForm></ACheckboxForm>
*/
}
<
ADropdownForm
></
ADropdownForm
>
<
ADropdownForm
></
ADropdownForm
>
<
AEssayForm
></
AEssayForm
>
<
AEssayForm
></
AEssayForm
>
<
ARadioForm
></
ARadioForm
>
<
ARadioForm
></
ARadioForm
>
...
...
frontend/src/home/Home.tsx
View file @
73188bcd
...
@@ -23,7 +23,7 @@ export const Home = () => {
...
@@ -23,7 +23,7 @@ export const Home = () => {
<
div
className
=
"flex h-14 w-28 items-center border-2 border-themeColor font-bold text-black bg-gray-200 hover:bg-themeColor rounded-lg "
>
<
div
className
=
"flex h-14 w-28 items-center border-2 border-themeColor font-bold text-black bg-gray-200 hover:bg-themeColor rounded-lg "
>
<
button
<
button
type
=
"button"
type
=
"button"
className
=
"text-center h-full w-28 font-bold text-black place-items-center
mb-3
"
className
=
"text-center h-full w-28 font-bold text-black place-items-center"
onClick
=
{
clickHome
}
onClick
=
{
clickHome
}
>
>
+
+
...
...
frontend/src/profile/Profile.tsx
View file @
73188bcd
import
React
from
"
react
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
SurveyType
}
from
"
../types
"
;
export
const
Profile
=
()
=>
{
export
const
Profile
=
()
=>
{
const
navigate
=
useNavigate
();
const
navigate
=
useNavigate
();
// const [Ssurvey, setSsurvey] = useState<SurveyType>({
// title: "",
// comment: "",
// //questions 는 _id들의 배열
// questions: [],
// });
// function handleAnswer(event: React.ChangeEvent<HTMLInputElement>) {
// setSsurvey({
// ...survey,
// [event.currentTarget.name]: event.currentTarget.value,
// })
// }
const
createSurvey
=
()
=>
{
const
createSurvey
=
()
=>
{
// 먼저 서버에 survey 테이블에 새로운 survey 항목 추가 로직 필요
// 먼저 서버에 survey 테이블에 새로운 survey 항목 추가 로직 필요
...
...
src/controllers/survey.controller.ts
View file @
73188bcd
...
@@ -7,3 +7,8 @@ export const createSurvey = asyncWrap(async (req, res) => {
...
@@ -7,3 +7,8 @@ export const createSurvey = asyncWrap(async (req, res) => {
const
newSurvey
=
await
surveyDb
.
createSurvey
(
survey
);
const
newSurvey
=
await
surveyDb
.
createSurvey
(
survey
);
return
res
.
json
(
newSurvey
);
return
res
.
json
(
newSurvey
);
});
});
// export const getSurveys = asyncWrap(async (req, res) => {
// const surveys = await surveyDb.getSurveys();
// return res.json(surveys);
// });
src/db/survey.db.ts
View file @
73188bcd
...
@@ -4,3 +4,8 @@ export const createSurvey = async (survey: ISurvey) => {
...
@@ -4,3 +4,8 @@ export const createSurvey = async (survey: ISurvey) => {
const
newSurvey
=
await
Survey
.
create
(
survey
);
const
newSurvey
=
await
Survey
.
create
(
survey
);
return
newSurvey
;
return
newSurvey
;
};
};
// export const getSurveys = async () => {
// const surveys = await Survey.find({}).populate("questions")
// return surveys
// }
\ No newline at end of file
src/routes/survey.route.ts
View file @
73188bcd
...
@@ -7,4 +7,7 @@ router
...
@@ -7,4 +7,7 @@ router
.
route
(
"
/create
"
)
.
route
(
"
/create
"
)
.
post
(
surveyCtrl
.
createSurvey
);
.
post
(
surveyCtrl
.
createSurvey
);
// router
// .route("/profile")
// .get(surveyCtrl.getSurveys)
export
default
router
;
export
default
router
;
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