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
Hide whitespace changes
Inline
Side-by-side
frontend/src/apis/survey.api.ts
View file @
73188bcd
...
...
@@ -6,4 +6,9 @@ export const createSurvey = async (survey:SurveyType) => {
console
.
log
(
survey
)
const
{
data
}
=
await
axios
.
post
(
`
${
baseUrl
}
/surveys/create`
,
{...
survey
})
return
data
;
}
\ No newline at end of file
}
// 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 = () => {
/>
<
input
className
=
"ml-2 text-lg font-medium"
>
First checkbox
</
input
>
</
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
>
);
...
...
frontend/src/commons/ADropdown.tsx
View file @
73188bcd
...
...
@@ -7,7 +7,7 @@ export const ADropdownForm = () => {
<
form
className
=
"text-xl font-bold ml-6 w-1/2"
>
dropdown
</
form
>
</
div
>
<
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
>
first
</
option
>
<
option
>
second
</
option
>
...
...
frontend/src/commons/SurveyForm.tsx
View file @
73188bcd
...
...
@@ -15,7 +15,7 @@ export const SurveyForm = () => {
rows
=
{
2
}
cols
=
{
60
}
></
textarea
>
<
ACheckboxForm
></
ACheckboxForm
>
{
/*
<ACheckboxForm></ACheckboxForm>
*/
}
<
ADropdownForm
></
ADropdownForm
>
<
AEssayForm
></
AEssayForm
>
<
ARadioForm
></
ARadioForm
>
...
...
frontend/src/home/Home.tsx
View file @
73188bcd
...
...
@@ -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 "
>
<
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
}
>
+
...
...
frontend/src/profile/Profile.tsx
View file @
73188bcd
import
React
from
"
react
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
SurveyType
}
from
"
../types
"
;
export
const
Profile
=
()
=>
{
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
=
()
=>
{
// 먼저 서버에 survey 테이블에 새로운 survey 항목 추가 로직 필요
...
...
src/controllers/survey.controller.ts
View file @
73188bcd
...
...
@@ -6,4 +6,9 @@ export const createSurvey = asyncWrap(async (req, res) => {
console
.
log
(
"
Survey body
"
,
survey
);
const
newSurvey
=
await
surveyDb
.
createSurvey
(
survey
);
return
res
.
json
(
newSurvey
);
});
\ No newline at end of file
});
// export const getSurveys = asyncWrap(async (req, res) => {
// const surveys = await surveyDb.getSurveys();
// return res.json(surveys);
// });
src/db/survey.db.ts
View file @
73188bcd
...
...
@@ -3,4 +3,9 @@ import { Survey, ISurvey } from "../models";
export
const
createSurvey
=
async
(
survey
:
ISurvey
)
=>
{
const
newSurvey
=
await
Survey
.
create
(
survey
);
return
newSurvey
;
};
\ No newline at end of file
};
// 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
.
route
(
"
/create
"
)
.
post
(
surveyCtrl
.
createSurvey
);
// router
// .route("/profile")
// .get(surveyCtrl.getSurveys)
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