Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
meanspec-backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MeanSpec (SCE338 2024-2 Group 1)
meanspec-backend
Commits
0888fe4b
Commit
0888fe4b
authored
6 months ago
by
Lee WooChang
Browse files
Options
Downloads
Patches
Plain Diff
feat: 실제 유저가 가지고 있는 부품만을 필터로 반환
parent
7bdca999
No related branches found
No related tags found
1 merge request
!10
Parts 추가
Pipeline
#10580
passed
6 months ago
Stage: test
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/repositories/partRepository.js
+6
-5
6 additions, 5 deletions
src/repositories/partRepository.js
src/routes/parts.js
+0
-2
0 additions, 2 deletions
src/routes/parts.js
src/services/partService.js
+1
-1
1 addition, 1 deletion
src/services/partService.js
with
7 additions
and
8 deletions
src/repositories/partRepository.js
+
6
−
5
View file @
0888fe4b
...
@@ -32,10 +32,11 @@ const PartRepository = {
...
@@ -32,10 +32,11 @@ const PartRepository = {
async
getFilterDataByTypeAndColumn
(
type
,
column
)
{
async
getFilterDataByTypeAndColumn
(
type
,
column
)
{
const
query
=
`
const
query
=
`
SELECT DISTINCT
${
column
}
SELECT DISTINCT p.
${
column
}
FROM part_info_
${
type
}
FROM relations r
WHERE
${
column
}
IS NOT NULL
JOIN part_info_
${
type
}
p ON r.part_id = p.part_id -- id 대신 part_id 사용
ORDER BY
${
column
}
WHERE p.
${
column
}
IS NOT NULL
ORDER BY p.
${
column
}
`
;
`
;
const
resp
=
await
pool
.
query
(
query
);
const
resp
=
await
pool
.
query
(
query
);
return
resp
.
rows
.
map
((
row
)
=>
row
[
column
]);
return
resp
.
rows
.
map
((
row
)
=>
row
[
column
]);
...
...
This diff is collapsed.
Click to expand it.
src/routes/parts.js
+
0
−
2
View file @
0888fe4b
...
@@ -9,9 +9,7 @@ partRouter.get(
...
@@ -9,9 +9,7 @@ partRouter.get(
'
/
'
,
'
/
'
,
wrapAsync
(
async
(
req
,
res
)
=>
{
wrapAsync
(
async
(
req
,
res
)
=>
{
const
{
partType
,
filters
}
=
req
.
query
;
const
{
partType
,
filters
}
=
req
.
query
;
const
parts
=
await
PartService
.
getParts
(
partType
,
filters
);
const
parts
=
await
PartService
.
getParts
(
partType
,
filters
);
return
res
.
sendResponse
(
''
,
200
,
{
parts
});
return
res
.
sendResponse
(
''
,
200
,
{
parts
});
})
})
);
);
...
...
This diff is collapsed.
Click to expand it.
src/services/partService.js
+
1
−
1
View file @
0888fe4b
...
@@ -52,7 +52,7 @@ const PartService = {
...
@@ -52,7 +52,7 @@ const PartService = {
async
getParts
(
partType
,
filters
)
{
async
getParts
(
partType
,
filters
)
{
if
(
!
partType
)
{
if
(
!
partType
)
{
throw
new
Error
(
'
파트 타입이 필요합니다.
'
);
throw
new
Reportable
Error
(
400
,
'
파트 타입이 필요합니다.
'
);
}
}
let
parsedFilters
;
let
parsedFilters
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment