Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Gestion des stages Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Fatima Ezzahra Majidi
Gestion des stages Backend
Merge requests
!3
Modif + Delete candidature
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Modif + Delete candidature
master
into
main
Overview
0
Commits
1
Pipelines
0
Changes
2
Merged
Fatima Ezzahra Majidi
requested to merge
master
into
main
2 months ago
Overview
0
Commits
1
Pipelines
0
Changes
2
Expand
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
9fbb9d85
1 commit,
2 months ago
2 files
+
37
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
src/main/java/com/example/gestionstagesbackend/controllers/CandidacyController.java
+
33
−
0
Options
@@ -80,4 +80,37 @@ public class CandidacyController {
.
map
(
ResponseEntity:
:
ok
)
.
orElse
(
ResponseEntity
.
notFound
().
build
());
}
@DeleteMapping
(
"/{id}"
)
public
ResponseEntity
<
Void
>
deleteCandidacy
(
@PathVariable
Long
id
)
{
if
(!
candidacyService
.
existsById
(
id
))
{
return
ResponseEntity
.
notFound
().
build
();
}
candidacyService
.
deleteCandidacy
(
id
);
return
ResponseEntity
.
noContent
().
build
();
}
@PutMapping
(
"/{id}"
)
public
ResponseEntity
<?>
updateCandidacy
(
@PathVariable
Long
id
,
@RequestBody
Candidacy
updatedCandidacy
)
{
Optional
<
Candidacy
>
existingCandidacy
=
candidacyService
.
getCandidacyById
(
id
);
if
(
existingCandidacy
.
isEmpty
())
{
return
ResponseEntity
.
notFound
().
build
();
}
Candidacy
candidacy
=
existingCandidacy
.
get
();
if
(
updatedCandidacy
.
getStudent
()
!=
null
&&
updatedCandidacy
.
getStudent
().
getId
()
!=
null
)
{
candidacy
.
setStudent
(
updatedCandidacy
.
getStudent
());
}
if
(
updatedCandidacy
.
getStage
()
!=
null
&&
updatedCandidacy
.
getStage
().
getId
()
!=
null
)
{
candidacy
.
setStage
(
updatedCandidacy
.
getStage
());
}
if
(
updatedCandidacy
.
getUnivSupervisor
()
!=
null
)
{
candidacy
.
setUnivSupervisor
(
updatedCandidacy
.
getUnivSupervisor
());
}
Candidacy
savedCandidacy
=
candidacyService
.
saveCandidacy
(
candidacy
);
return
ResponseEntity
.
ok
(
savedCandidacy
);
}
}
Loading