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
GitLab 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
Merge requests
!12
조합 필터링 로직 수정
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
조합 필터링 로직 수정
fix/filtered-combination
into
main
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Lee WooChang
requested to merge
fix/filtered-combination
into
main
7 months ago
Overview
0
Commits
1
Pipelines
1
Changes
1
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
e87e56d1
1 commit,
7 months ago
1 file
+
15
−
9
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/repositories/partRepository.js
+
15
−
9
View file @ e87e56d1
Edit in single-file editor
Open in Web IDE
Show full file
@@ -72,18 +72,24 @@ const PartRepository = {
async
getFilteredCombinations
(
queryValues
)
{
const
query
=
`
SELECT
c.id AS combination_id,
array_agg(r.part_id) AS partIds
FROM combinations c
LEFT JOIN relations r ON c.id = r.combination_id
WHERE r.combination_id IN (
SELECT DISTINCT combination_id
WITH input_parts AS (
SELECT array_agg(unnest) AS required_parts
FROM unnest($1::int[]) AS unnest
),
parts AS (
SELECT
combination_id,
array_agg(part_id ORDER BY part_id) AS existing_parts
FROM relations
WHERE part_id = ANY($1::int[])
GROUP BY combination_id
)
GROUP BY c.id;
SELECT
p.combination_id,
p.existing_parts AS partIds
FROM parts p, input_parts i
WHERE p.existing_parts @> i.required_parts;
`
;
const
result
=
await
pool
.
query
(
query
,
queryValues
);
return
result
.
rows
;
},
Loading