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
travel
Commits
f8c7d710
Commit
f8c7d710
authored
Jul 27, 2022
by
Kim, MinGyu
Browse files
css 수정 및 이미지 중첩 수정
parent
32764f1e
Changes
5
Show whitespace changes
Inline
Side-by-side
frontend/src/auth/profile.tsx
View file @
f8c7d710
...
...
@@ -42,6 +42,8 @@ export default function Profile() {
console
.
log
(
"
profile in submit
"
,
profile
);
const
formdata
=
new
FormData
();
profile
.
avatar
&&
formdata
.
append
(
"
avatar
"
,
profile
.
avatar
);
console
.
log
(
profile
.
avatar
);
formdata
.
append
(
"
name
"
,
profile
.
name
);
console
.
log
(
"
form data
"
,
formdata
.
get
(
"
avatar
"
));
profileApi
.
profileUpload
(
formdata
);
...
...
frontend/src/home/header.tsx
View file @
f8c7d710
...
...
@@ -14,11 +14,15 @@ export default function Header() {
};
return
(
<
div
className
=
"flex flex-col md:px-56 "
>
<
div
className
=
"flex flex-col-reverse pt-3 pb-12 border-b-2 border-sky-200 bg-gradient-to-t from-sky-200"
>
<
div
className
=
"flex flex-col "
>
<
div
className
=
"flex flex-col md:px-56 z-10 "
>
<
div
className
=
"flex flex-col-reverse pt-3 pb-12 "
>
<
div
className
=
"flex mt-5 justify-between pr-3"
>
<
button
className
=
"ml-3 shrink-0 md:text-2xl"
>
<
Link
to
=
"/"
className
=
"hover:text-sky-300 active:text-purple-500"
>
<
Link
to
=
"/"
className
=
"hover:text-sky-300 active:text-purple-500 text-white"
>
Travel Report
</
Link
>
</
button
>
...
...
@@ -39,7 +43,9 @@ export default function Header() {
프로필
</
Link
>
<
div
className
=
"border-0 border-r-2 border-black "
></
div
>
{
user
.
role
===
"
admin
"
?
<
Link
to
=
{
"
/admin
"
}
>
어드민
</
Link
>
:
null
}
{
user
.
role
===
"
admin
"
?
(
<
Link
to
=
{
"
/admin
"
}
>
어드민
</
Link
>
)
:
null
}
<
button
className
=
"ml-2 text-xs"
onClick
=
{
()
=>
{
...
...
@@ -74,5 +80,7 @@ export default function Header() {
<
Outlet
/>
</
div
>
<
div
className
=
"bg-center z-0 absolute w-full h-44 overflow-hidden object-cover object-center bg-[url('https://blog.kakaocdn.net/dn/b5qUMZ/btqN9NEYqcW/ZuZmPcI4u7bdK89shT3RL1/img.jpg')]"
></
div
>
</
div
>
);
}
frontend/src/home/theme.tsx
View file @
f8c7d710
...
...
@@ -15,7 +15,7 @@ export default function Theme({ handleClick }: ThemeProps) {
};
return
(
<
div
className
=
"overflow-x-auto flex rounded py-2 md:p-
2 border-b-2
divide-x-2"
>
<
div
className
=
"overflow-x-auto flex rounded py-2 md:p-
4 shadow-lg
divide-x-2
bg-white
"
>
<
div
onClick
=
{
()
=>
clickActive
(
1
)
}
>
<
button
id
=
{
"
surfing
"
}
...
...
frontend/src/pages/citylist.tsx
View file @
f8c7d710
...
...
@@ -15,7 +15,7 @@ export default function Citylist({ handleClick }: CityProps) {
};
return
(
<
div
className
=
"overflow-auto w-full flex flex-row md:flex-col md:mr-24 bg-
sky
-100"
>
<
div
className
=
"overflow-auto w-full flex flex-row md:flex-col md:mr-24 bg-
red
-100
shadow-lg
"
>
<
div
className
=
"text-start px-5 py-2 bg-white whitespace-nowrap"
>
도시
</
div
>
...
...
src/controllers/user.controller.ts
View file @
f8c7d710
...
...
@@ -2,9 +2,9 @@ import { userDb } from "../db";
import
{
asyncWrap
}
from
"
../helpers/asyncWrap
"
;
import
{
Request
}
from
"
express
"
;
import
formidable
from
"
formidable
"
;
import
{
ObjectId
}
from
"
mongoose
"
;
import
fs
from
"
fs
"
;
import
fs
from
"
fs/promises
"
;
import
{
TypedRequest
}
from
"
../types
"
;
import
{
FileInfo
,
IUser
,
User
}
from
"
../models
"
;
export
interface
TypedRequestAuth
<
T
>
extends
Request
{
auth
:
T
;
...
...
@@ -36,8 +36,28 @@ export const updateProfile = asyncWrap(async (reqExp, res) => {
const
{
name
}
=
req
.
body
;
const
{
avatar
}:
{
avatar
:
formidable
.
File
}
=
req
.
files
;
const
duplicate
=
await
FileInfo
.
findOne
({
originalfilename
:
avatar
.
originalFilename
,
});
// 같은 사진이 DB에 있는지 확인
console
.
log
(
duplicate
);
if
(
!
duplicate
)
{
//만약 같은 사진이 DB안에 존재하지 않을 경우
const
user
=
await
userDb
.
updateProfile
(
userId
,
name
,
avatar
);
res
.
json
(
user
);
}
else
{
// 같은 사진이 DB안에 존재할 경우
await
fs
.
unlink
(
avatar
.
filepath
);
// await FileInfo.deleteOne({ _id: user?.avatar }); // 덮기 전의 FileInfo 삭제
const
user
=
await
User
.
findById
(
userId
);
if
(
user
!==
null
)
{
user
.
avatar
=
duplicate
.
_id
;
await
user
.
save
();
}
}
// if (!Array.isArray(file.avatar)) {
// //파일 좁히기 중
// if (!Array.isArray(field.nickname)) {
...
...
@@ -58,8 +78,6 @@ export const updateProfile = asyncWrap(async (reqExp, res) => {
// }
// }
// }
res
.
json
(
user
);
});
export
const
deleteUser
=
asyncWrap
(
async
(
reqExp
,
res
)
=>
{
...
...
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