Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
students
travel
Commits
3be6ef0d
Commit
3be6ef0d
authored
Jul 22, 2022
by
Kim, MinGyu
Browse files
프로필 수정
parent
e99115b3
Changes
4
Hide whitespace changes
Inline
Side-by-side
frontend/src/auth/profile.tsx
View file @
3be6ef0d
...
@@ -59,11 +59,7 @@ export default function Profile() {
...
@@ -59,11 +59,7 @@ export default function Profile() {
formdata
.
append
(
"
nickname
"
,
nickname
);
formdata
.
append
(
"
nickname
"
,
nickname
);
console
.
log
(
"
both
"
);
console
.
log
(
"
both
"
);
await
profileApi
.
picture
(
formdata
);
await
profileApi
.
picture
(
formdata
);
}
else
if
(
!
(
file
===
undefined
)
&&
nickname
===
""
)
{
}
else
if
(
!
(
nickname
===
""
))
{
formdata
.
append
(
"
picture
"
,
file
);
console
.
log
(
"
file
"
);
await
profileApi
.
picture
(
formdata
);
}
else
if
(
file
===
undefined
&&
!
(
nickname
===
""
))
{
formdata
.
append
(
"
nickname
"
,
nickname
);
formdata
.
append
(
"
nickname
"
,
nickname
);
console
.
log
(
"
picture
"
);
console
.
log
(
"
picture
"
);
await
profileApi
.
picture
(
formdata
);
await
profileApi
.
picture
(
formdata
);
...
...
frontend/src/home/header.tsx
View file @
3be6ef0d
...
@@ -9,7 +9,7 @@ export default function Header() {
...
@@ -9,7 +9,7 @@ export default function Header() {
return
(
return
(
<
div
className
=
"flex flex-col "
>
<
div
className
=
"flex flex-col "
>
<
div
className
=
"flex py-10 "
>
<
div
className
=
"flex py-10 "
>
<
button
className
=
"shrink-0 mx-5"
>
<
button
className
=
"shrink-0
mx-5"
>
<
Link
to
=
"/"
className
=
"hover:text-sky-300 focus:text-purple-500"
>
<
Link
to
=
"/"
className
=
"hover:text-sky-300 focus:text-purple-500"
>
Travel Report
Travel Report
</
Link
>
</
Link
>
...
...
src/controllers/user.controller.ts
View file @
3be6ef0d
...
@@ -42,36 +42,26 @@ export const postPicture = asyncWrap(async (reqExp, res) => {
...
@@ -42,36 +42,26 @@ export const postPicture = asyncWrap(async (reqExp, res) => {
form
.
parse
(
req
,
(
err
,
fields
,
files
)
=>
{
form
.
parse
(
req
,
(
err
,
fields
,
files
)
=>
{
if
(
!
Array
.
isArray
(
files
.
picture
))
{
if
(
!
Array
.
isArray
(
files
.
picture
))
{
//파일 좁히기 중
//파일 좁히기 중
if
(
Array
.
isArray
(
fields
.
nickname
))
{
if
(
!
Array
.
isArray
(
fields
.
nickname
))
{
console
.
log
(
fields
.
nickname
);
const
nickname
=
fields
.
nickname
.
join
();
const
originalfilename
=
files
.
picture
.
originalFilename
;
const
newfilename
=
files
.
picture
.
newFilename
;
const
picturepath
=
files
.
picture
.
filepath
;
userDb
.
postPicture
(
userId
,
originalfilename
,
newfilename
,
picturepath
,
nickname
);
}
else
{
const
nickname
=
fields
.
nickname
;
const
nickname
=
fields
.
nickname
;
if
(
!
(
files
.
picture
===
undefined
))
{
const
originalfilename
=
files
.
picture
.
originalFilename
;
const
originalfilename
=
files
.
picture
.
originalFilename
;
const
newfilename
=
files
.
picture
.
newFilename
;
const
newfilename
=
files
.
picture
.
newFilename
;
const
picturepath
=
files
.
picture
.
filepath
;
const
picturepath
=
files
.
picture
.
filepath
;
userDb
.
postPicture
(
userDb
.
postPicture
(
userId
,
userId
,
originalfilename
,
nickname
,
newfilename
,
originalfilename
,
picturepath
,
newfilename
,
nickname
picturepath
);
);
}
else
{
userDb
.
postPicture
(
userId
,
nickname
);
}
}
}
}
}
});
});
res
.
json
();
res
.
json
();
});
});
...
...
src/db/user.db.ts
View file @
3be6ef0d
...
@@ -73,19 +73,32 @@ export const isValidUserId = async (userId: string) => {
...
@@ -73,19 +73,32 @@ export const isValidUserId = async (userId: string) => {
export
const
postPicture
=
async
(
export
const
postPicture
=
async
(
userId
:
ObjectId
,
userId
:
ObjectId
,
originalfile
name
:
string
|
null
,
nick
name
:
string
,
new
filename
:
string
,
original
filename
?
:
string
|
null
,
picturepath
:
string
,
newfilename
?
:
string
,
n
ic
kname
:
string
p
ic
turepath
?
:
string
)
=>
{
)
=>
{
const
profile
=
await
User
.
findById
(
userId
);
const
profile
=
await
User
.
findById
(
userId
);
if
(
!
(
profile
?.
avatar
===
undefined
))
{
if
(
!
(
profile
?.
avatar
===
undefined
))
{
await
Avatar
.
findByIdAndUpdate
(
profile
.
avatar
.
_id
,
{
if
(
originalfilename
===
null
)
{
originalfilename
:
originalfilename
,
await
Avatar
.
findByIdAndUpdate
(
profile
.
avatar
.
_id
,
{
newfilename
:
newfilename
,
nickname
:
nickname
,
picturepath
:
picturepath
,
});
nickname
:
nickname
,
}
else
if
(
nickname
===
""
)
{
});
await
Avatar
.
findByIdAndUpdate
(
profile
.
avatar
.
_id
,
{
originalfilename
:
originalfilename
,
newfilename
:
newfilename
,
picturepath
:
picturepath
,
});
}
else
{
await
Avatar
.
findByIdAndUpdate
(
profile
.
avatar
.
_id
,
{
originalfilename
:
originalfilename
,
newfilename
:
newfilename
,
picturepath
:
picturepath
,
nickname
:
nickname
,
});
}
}
}
};
};
...
...
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