Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
th-app-java
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Amparo Oliver
th-app-java
Commits
89dbfaec
Commit
89dbfaec
authored
3 years ago
by
Cesar Giulano Gonzalez Maqueda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validacion en back tmb
parent
2f4802c5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
20 deletions
+23
-20
curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java
+23
-19
curriculumsearch/src/main/resources/static/main.js
+0
-1
No files found.
curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java
View file @
89dbfaec
...
...
@@ -46,7 +46,8 @@ import org.springframework.ui.Model;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
org.springframework.web.servlet.view.RedirectView
;
@Controller
...
...
@@ -144,8 +145,9 @@ public class PostulanteController {
}
@PostMapping
(
value
=
"/postulante"
,
consumes
=
"application/json"
)
public
String
guardarPostulante
(
@RequestBody
Postulante
postulante
){
public
RedirectView
guardarPostulante
(
@RequestBody
Postulante
postulante
,
RedirectAttributes
redirectAttributes
){
//Codigo encargado de modificar postulacion si se envia mismo CI
RedirectView
redirectView
=
new
RedirectView
(
"/postulacion-correcta"
,
true
);
Postulante
postulantex
=
post
.
findByNroDocument
(
postulante
.
getnroDocument
());
if
(
postulantex
!=
null
){
estudioRepository
.
findByPostulante
(
postulantex
).
forEach
(
x
->
estudioRepository
.
delete
(
x
));
...
...
@@ -153,29 +155,31 @@ public class PostulanteController {
postulanteTecnologiaRepository
.
findByPostulante
(
postulantex
).
forEach
(
x
->
postulanteTecnologiaRepository
.
delete
(
x
));
postulante
.
setId
(
postulantex
.
getId
());
}
postulante
.
getTecnologias
().
stream
().
filter
(
tec
->
tec
.
getTecnologia
().
getId
()
!=
0
).
forEach
(
tec
->
tec
.
setTecnologia
(
tecRepo
.
getById
(
tec
.
getTecnologia
().
getId
()))
);
postulante
.
getTecnologias
().
stream
().
filter
(
tec
->
tec
.
getTecnologia
().
getId
()
!=
0
)
.
forEach
(
tec
->
tec
.
setTecnologia
(
tecRepo
.
getById
(
tec
.
getTecnologia
().
getId
())));
/* for (int i = 0; i < postulante.getPostulaciones().size(); i++) {
postulante.getPostulaciones().set(i, cargoRepo.getById(postulante.getPostulaciones().get(i).getId()));
}
*/
for
(
Estudio
estudio:
postulante
.
getEstudios
()){
String
nombreIns
=
""
;
nombreIns
=
estudio
.
getInstitucion
().
getNombre
().
toLowerCase
();
Institucion
institucion
=
institucionRepository
.
findByNombre
(
nombreIns
);
if
(
institucion
==
null
){
institucionRepository
.
save
(
estudio
.
getInstitucion
());
}
else
{
estudio
.
setInstitucion
(
institucion
);
}
}
post
.
save
(
postulante
);
return
"redirect:/postulacion-correcta"
;
for
(
Estudio
estudio:
postulante
.
getEstudios
()){
String
nombreIns
=
""
;
nombreIns
=
estudio
.
getInstitucion
().
getNombre
().
toLowerCase
();
Institucion
institucion
=
institucionRepository
.
findByNombre
(
nombreIns
);
if
(
institucion
==
null
){
institucionRepository
.
save
(
estudio
.
getInstitucion
());
}
else
{
estudio
.
setInstitucion
(
institucion
);
}
}
if
(
postulante
.
getPostulaciones
().
isEmpty
()
||
postulante
.
getTecnologias
().
isEmpty
()){
redirectView
.
setUrl
(
"/postulante"
);
redirectAttributes
.
addFlashAttribute
(
"error"
,
"Datos invalidos"
);
return
redirectView
;
}
post
.
save
(
postulante
);
return
redirectView
;
}
@GetMapping
(
"/postulacion-correcta"
)
public
String
successPostulation
(
Model
model
){
...
...
This diff is collapsed.
Click to expand it.
curriculumsearch/src/main/resources/static/main.js
View file @
89dbfaec
...
...
@@ -245,7 +245,6 @@ async function postData(url = '', data = {}) {
}
senddata
[
"headers"
][
headerxs
]
=
token
;
let
response
=
null
console
.
log
(
noValidateFlag
)
if
(
!
noValidateFlag
){
response
=
await
fetch
(
url
,
senddata
);
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment