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
butter-studio
Commits
ab2a8d78
Commit
ab2a8d78
authored
Aug 10, 2021
by
Kim, Subin
Browse files
SearchResult Pagination 필요없음 -> 관련 기능 삭제
parent
4b0f9909
Changes
3
Show whitespace changes
Inline
Side-by-side
client/src/components/Admin/MovieEdit.js
View file @
ab2a8d78
...
...
@@ -18,6 +18,7 @@ const MovieEdit = () => {
async
function
paginate
(
pageNum
)
{
try
{
setError
(
""
)
const
{
TMDBmovies
,
totalPage
}
=
(
search
.
keyword
!==
''
)
?
await
movieApi
.
search
(
search
,
pageNum
)
:
await
movieApi
.
getAllfromTM
(
pageNum
)
setActivePage
(
pageNum
)
setTotalPages
(
totalPage
)
...
...
client/src/components/SearchResult.js
View file @
ab2a8d78
...
...
@@ -2,6 +2,7 @@ import { useState, useEffect } from 'react'
import
{
useLocation
}
from
'
react-router-dom
'
import
queryString
from
'
query-string
'
import
MovieCard
from
"
./MovieCard/index.js
"
import
Pagination
from
"
./Pagination.js
"
;
import
movieApi
from
'
../apis/movie.api.js
'
import
catchErrors
from
'
../utils/catchErrors.js
'
...
...
@@ -18,8 +19,8 @@ const SearchResult = () => {
async
function
findforKeyword
()
{
try
{
setError
(
""
)
const
{
count
,
results
}
=
await
movieApi
.
search
({
type
:
"
home
"
,
keyword
:
title
})
setResult
(
[...
results
]
)
const
res
=
await
movieApi
.
search
({
type
:
"
home
"
,
keyword
:
title
})
setResult
(
res
)
}
catch
(
error
)
{
catchErrors
(
error
,
setError
)
}
...
...
server/controllers/movie.controller.js
View file @
ab2a8d78
...
...
@@ -97,8 +97,6 @@ const getMovieById = async (req, res) => {
}
const
getMovieList
=
async
(
req
,
res
)
=>
{
const
{
category
}
=
req
.
params
// console.log(category)
try
{
const
{
category
}
=
req
.
params
const
movieList
=
await
Movie
.
findAll
()
...
...
@@ -178,15 +176,15 @@ const findonlyTitle = async (req, res) => {
try
{
const
{
keyword
}
=
req
.
query
const
movieIds
=
[]
const
{
count
,
rows
}
=
await
Movie
.
findA
ndCountA
ll
({
const
findAll
=
await
Movie
.
findAll
({
where
:
{
title
:
{
[
Op
.
substring
]:
keyword
}
}
});
if
(
rows
)
{
rows
.
forEach
(
movie
=>
movieIds
.
push
(
movie
.
movieId
))
if
(
findAll
)
{
findAll
.
forEach
(
movie
=>
movieIds
.
push
(
movie
.
movieId
))
const
elements
=
await
Promise
.
all
(
movieIds
.
map
(
async
(
movieId
)
=>
{
const
movie
=
await
axios
.
get
(
`https://api.themoviedb.org/3/movie/
${
movieId
}
?api_key=
${
process
.
env
.
TMDB_APP_KEY
}
&language=ko-KR`
)
...
...
@@ -200,8 +198,8 @@ const findonlyTitle = async (req, res) => {
return
{
...
movie
.
data
,
ticket_sales
:
cols
.
ticket_sales
,
vote_average
:
cols
.
vote_average
,
totalReservationRate
:
totalReservationRate
[
0
]
}
})
)
return
res
.
json
(
{
count
:
movieIds
.
length
,
results
:
elements
}
)
}
else
return
res
.
json
(
{
count
:
count
,
results
:
rows
}
)
return
res
.
json
(
elements
)
}
else
return
res
.
json
(
findAll
)
}
catch
(
error
)
{
return
res
.
status
(
500
).
send
(
error
.
message
||
"
영화 검색 중 에러 발생
"
);
}
...
...
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