Skip to content

Commit 46fbea8

Browse files
authored
Merge pull request #109 from CodeStrong2023/test
Semana 10 Merge Test a rama Main
2 parents bb42879 + 473a1c9 commit 46fbea8

File tree

33 files changed

+1899
-272
lines changed

33 files changed

+1899
-272
lines changed

Java Avanzado/Lección03/tienda_libros/src/main/java/utn/tienda_libros/TiendaLibrosApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static void main(String[] args) {
1717
new SpringApplicationBuilder(TiendaLibrosApplication.class)
1818
.headless(false) // Configuración headless
1919
.web(WebApplicationType.NONE) // App Web
20-
.run(args);
20+
.run(args); // Aquí pasamos los argumentos recibidos por le método
2121

2222
// Ejecutamos el código para cargar el formulario
2323
EventQueue.invokeLater(() -> { // Método Lambda

Java Avanzado/Lección03/tienda_libros/src/main/java/utn/tienda_libros/modelo/Libro.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
@ToString
1818
public class Libro {
1919
@Id
20-
@GeneratedValue(strategy = GenerationType.IDENTITY)
20+
@GeneratedValue(strategy = GenerationType.IDENTITY) // Las anotaciones no llevan ;
2121
Integer idLibro;
2222
String nombreLibro;
2323
String autor;
2424
Double precio;
2525
Integer existencias;
26-
}
26+
27+
}

Java Avanzado/Lección03/tienda_libros/src/main/java/utn/tienda_libros/repositorio/LibroRepositorio.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
import utn.tienda_libros.modelo.Libro;
55

66
public interface LibroRepositorio extends JpaRepository<Libro, Integer> {
7-
}
7+
}

Java Avanzado/Lección03/tienda_libros/src/main/java/utn/tienda_libros/servicio/ILibroServicio.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ public interface ILibroServicio {
1313
public void guardarLibro(Libro libro);
1414

1515
public void eliminarLibro(Libro libro);
16-
}
16+
}

Java Avanzado/Lección03/tienda_libros/src/main/java/utn/tienda_libros/servicio/LibroServicio.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ public void guardarLibro(Libro libro) {
3333
public void eliminarLibro(Libro libro) {
3434
libroRepositorio.delete(libro);
3535
}
36-
}
36+
}

Java Avanzado/Lección03/tienda_libros/src/main/java/utn/tienda_libros/vista/LibroFrom.java

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,25 @@ private void agregarLibro(){
8484
}
8585

8686
private boolean validarCamposVacios() {
87-
String[] campos = {libroTexto.getText(), autorTexto.getText(), precioTexto.getText(), existenciasTexto.getText()};
88-
String[] mensajes = {
89-
"Ingresa nombre del libro",
90-
"Ingresa nombre del Autor",
91-
"Ingresa precio del libro",
92-
"Ingresa existencias del libro"
93-
};
94-
for (int i = 0; i < campos.length; i++) {
95-
if (campos[i].isEmpty()) {
96-
mostrarMensaje(mensajes[i]);
97-
return true;
98-
}
87+
if (libroTexto.getText().isEmpty()) {
88+
mostrarMensaje("Ingresa nombre del libro");
89+
libroTexto.requestFocusInWindow();
90+
return true;
91+
}
92+
if (autorTexto.getText().isEmpty()) {
93+
mostrarMensaje("Ingresa nombre del Autor");
94+
autorTexto.requestFocusInWindow();
95+
return true;
96+
}
97+
if (precioTexto.getText().isEmpty()) {
98+
mostrarMensaje("Ingresa precio del libro");
99+
precioTexto.requestFocusInWindow();
100+
return true;
101+
}
102+
if (existenciasTexto.getText().isEmpty()) {
103+
mostrarMensaje("Ingresa existencias del libro");
104+
existenciasTexto.requestFocusInWindow();
105+
return true;
99106
}
100107
return false;
101108
}
@@ -118,27 +125,34 @@ private void cargarLibroSeleccionado() {
118125
}
119126

120127
private void modificarLibro() {
121-
if (idTexto.getText().isEmpty()) {
128+
if (this.idTexto.equals("")){
122129
mostrarMensaje("Debes seleccionar un registro en la tabla");
123-
return;
124130
}
125-
// Verificamos que nombre del libro no sea nulo
126-
if (libroTexto.getText().isEmpty()) {
127-
mostrarMensaje("Digite el nombre del libro...");
128-
libroTexto.requestFocusInWindow();
129-
return;
131+
else {
132+
// verificamos que nombre del libro no sea nulo
133+
if(libroTexto.getText().equals("")){
134+
mostrarMensaje("Debes seleccionar un registro en la tabla");
135+
}
136+
else {
137+
// verificamos que nombre del libro no sea nulo
138+
if (libroTexto.getText().equals("")){
139+
mostrarMensaje("Digite el nombre del libro...");
140+
libroTexto.requestFocusInWindow();
141+
return;
142+
}
143+
// Lllenamos el objeto libro a actualizar
144+
int idLibro = Integer.parseInt(idTexto.getText());
145+
var nombreLibro = libroTexto.getText();
146+
var autor = autorTexto.getText();
147+
var precio = Double.parseDouble(precioTexto.getText());
148+
var existencias = Integer.parseInt(existenciasTexto.getText());
149+
var libro = new Libro(idLibro, nombreLibro, autor, precio, existencias);
150+
libroServicio.guardarLibro(libro);
151+
mostrarMensaje("Se modificó el libro...");
152+
limpiarFormulario();
153+
listarLibros();
154+
}
130155
}
131-
// Llenamos el objeto libro a actualizar
132-
int idLibro = Integer.parseInt(idTexto.getText());
133-
var nombreLibro = libroTexto.getText();
134-
var autor = autorTexto.getText();
135-
var precio = Double.parseDouble(precioTexto.getText());
136-
var existencias = Integer.parseInt(existenciasTexto.getText());
137-
var libro = new Libro(idLibro, nombreLibro, autor, precio, existencias);
138-
libroServicio.guardarLibro(libro);
139-
mostrarMensaje("Se modificó el libro...");
140-
limpiarFormulario();
141-
listarLibros();
142156
}
143157

144158
private void eliminarLibro() {
@@ -250,4 +264,4 @@ private void configurarLayout(){
250264
)
251265
);
252266
}
253-
}
267+
}

Java Avanzado/Lección03/tienda_libros/src/test/java/utn/tienda_libros/TiendaLibrosApplicationTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ class TiendaLibrosApplicationTests {
99
@Test
1010
void contextLoads() {
1111
}
12+
1213
}
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
CREATE TABLE tareas (
22
id SERIAL PRIMARY KEY,
33
titulo VARCHAR(255) UNIQUE NOT NULL,
4-
descripcion TEXT,
4+
descripcion TEXT
55
);
66

7+
ALTER TABLE tareas ADD COLUMN usuario_id INTEGER REFERENCES usuarios(id);
8+
79
CREATE TABLE usuarios (
810
id SERIAL PRIMARY KEY,
911
name VARCHAR(255) NOT NULL,
1012
email VARCHAR(255) UNIQUE NOT NULL,
1113
password VARCHAR(255) NOT NULL,
1214
fecha_registro TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
1315

14-
fecha_actualizacion TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
15-
);
16+
fecha_actualizacion TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
17+
);
18+
19+
ALTER TABLE usuarios ADD COLUMN gravatar VARCHAR(255)

JavaScript/PERN-stack/frontend/package-lock.json

Lines changed: 4 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

JavaScript/PERN-stack/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
"globals": "^15.9.0",
3131
"postcss": "^8.4.47",
3232
"tailwindcss": "^3.4.14",
33-
"vite": "^5.4.8"
33+
"vite": "^5.4.11"
3434
}
3535
}

0 commit comments

Comments
 (0)