Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HARMONY-experimental-branch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Robin Korfmann
HARMONY-experimental-branch
Commits
240c000f
Commit
240c000f
authored
1 month ago
by
Colin Jakob
Browse files
Options
Downloads
Patches
Plain Diff
Clone Requirement handles the cloning of a requirement to a different project
parent
31a1f9dc
Branches
17-exercise-3-scaling-mandatory-features
Branches containing commit
No related tags found
1 merge request
!4
merge dev to main
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/project/service.go
+24
-0
24 additions, 0 deletions
src/app/project/service.go
with
24 additions
and
0 deletions
src/app/project/service.go
+
24
−
0
View file @
240c000f
...
@@ -194,3 +194,27 @@ func (s *ProjectService) SearchProjects(ctx context.Context, query string, userI
...
@@ -194,3 +194,27 @@ func (s *ProjectService) SearchProjects(ctx context.Context, query string, userI
log
.
Printf
(
"INFO: Search completed - found %d projects for query '%s'"
,
len
(
projects
),
query
)
log
.
Printf
(
"INFO: Search completed - found %d projects for query '%s'"
,
len
(
projects
),
query
)
return
projects
,
nil
return
projects
,
nil
}
}
// CloneRequirement handles the cloning of a requirement to a different project
func
(
s
*
ProjectService
)
CloneRequirement
(
ctx
context
.
Context
,
sourceReqID
primitive
.
ObjectID
,
targetProjectID
string
,
newName
string
)
error
{
log
.
Printf
(
"INFO: Cloning requirement %s to project %s with name '%s'"
,
sourceReqID
.
Hex
(),
targetProjectID
,
newName
)
// Validate that the target project exists
targetProject
,
err
:=
s
.
repo
.
FindByProjectID
(
ctx
,
targetProjectID
)
if
err
!=
nil
{
log
.
Printf
(
"ERROR: Target project '%s' not found: %v"
,
targetProjectID
,
err
)
return
fmt
.
Errorf
(
"target project not found"
)
}
log
.
Printf
(
"DEBUG: Target project '%s' found, proceeding with clone"
,
targetProject
.
Name
)
// Delegate to repository for the actual cloning operation
err
=
s
.
repo
.
CloneRequirement
(
ctx
,
sourceReqID
,
targetProjectID
,
newName
)
if
err
!=
nil
{
log
.
Printf
(
"ERROR: Failed to clone requirement %s: %v"
,
sourceReqID
.
Hex
(),
err
)
return
err
}
log
.
Printf
(
"INFO: Requirement cloned successfully to project '%s'"
,
targetProject
.
Name
)
return
nil
}
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