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
!19
조합 이름 변경 에러 수정
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
조합 이름 변경 에러 수정
fix/update-combination-name
into
main
Overview
0
Commits
1
Pipelines
1
Changes
4
Merged
Lee WooChang
requested to merge
fix/update-combination-name
into
main
7 months ago
Overview
0
Commits
1
Pipelines
1
Changes
4
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
668c3098
1 commit,
7 months ago
4 files
+
28
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
src/repositories/myRepository.js
+
25
−
1
View file @ 668c3098
Edit in single-file editor
Open in Web IDE
Show full file
import
pool
from
'
../db.js
'
;
const
myRepository
=
{
async
checkUserExists
(
userId
)
{
const
query
=
`
SELECT 1
FROM users
WHERE id = $1
`
;
const
values
=
[
userId
];
const
{
rows
}
=
await
pool
.
query
(
query
,
values
);
return
rows
.
length
>
0
;
},
async
getCombinationById
(
combinationId
)
{
const
query
=
`
SELECT id, name, owner_id AS "userId"
FROM combinations
WHERE id = $1
`
;
const
values
=
[
combinationId
];
const
{
rows
}
=
await
pool
.
query
(
query
,
values
);
return
rows
.
length
>
0
?
rows
[
0
]
:
null
;
},
async
getCombinationsByUserId
(
userId
)
{
const
query
=
`
SELECT id, name
@@ -49,7 +73,7 @@ const myRepository = {
async
updateCombinationName
(
combinationId
,
newName
)
{
const
query
=
`
UPDATE combinations
SET name = $1
, updated_at = NOW()
SET name = $1
WHERE id = $2
`
;
const
values
=
[
newName
,
combinationId
];
Loading