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
!11
조합 API 추가
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
조합 API 추가
feat/combinations
into
main
Overview
0
Commits
1
Pipelines
1
Changes
3
Merged
Lee WooChang
requested to merge
feat/combinations
into
main
7 months ago
Overview
0
Commits
1
Pipelines
1
Changes
3
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
613d8e4b
1 commit,
7 months ago
3 files
+
81
−
0
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
src/repositories/partRepository.js
+
30
−
0
View file @ 613d8e4b
Edit in single-file editor
Open in Web IDE
Show full file
@@ -57,6 +57,36 @@ const PartRepository = {
@@ -57,6 +57,36 @@ const PartRepository = {
const
result
=
await
pool
.
query
(
query
,
queryValues
);
const
result
=
await
pool
.
query
(
query
,
queryValues
);
return
result
.
rows
;
return
result
.
rows
;
},
},
async
getAllCombinations
()
{
const
query
=
`
SELECT array_agg(r.part_id) AS partIds
FROM combinations c
LEFT JOIN relations r ON c.id = r.combination_id
GROUP BY c.id;
`
;
const
result
=
await
pool
.
query
(
query
);
return
result
.
rows
;
},
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
FROM relations
WHERE part_id = ANY($1::int[])
)
GROUP BY c.id;
`
;
const
result
=
await
pool
.
query
(
query
,
queryValues
);
return
result
.
rows
;
},
};
};
export
default
PartRepository
;
export
default
PartRepository
;
Loading