Commit inicial

This commit is contained in:
Isidoro Nevares Martín 2026-01-20 22:29:17 +01:00
commit 10554beb09
12 changed files with 285 additions and 0 deletions

40
.classpath Normal file
View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/bin/
*.class
/target/

23
.project Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>aadd_act6_4</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,6 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View File

@ -0,0 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17

View File

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

66
pom.xml Normal file
View File

@ -0,0 +1,66 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.lapaloma.proyectosies</groupId>
<artifactId>aadd_act6_4</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SBProyectos_IES</name>
<description>Proyecto Spring Boot Proyectos IES</description>
<!-- Versión de Java -->
<properties>
<java.version>17</java.version>
</properties>
<packaging>jar</packaging>
<!-- Spring Boot como proyecto padre -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>4.0.1</version>
<relativePath/>
</parent>
<!-- Dependencias -->
<dependencies>
<!-- Starter básico (incluye logging, autoconfiguración, etc.) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Source: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- Driver PostgreSQL -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<!-- Source: https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
<!-- Plugin para ejecutar y empaquetar la app -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,21 @@
package org.lapaloma.aadd.api.proyectosies;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
*
* AppProyectosIES: Clase que realiza ....
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
* @date 20 ene 2026
*
*
*/
@SpringBootApplication
public class AppProyectosIES {
public static void main(String[] args) {
SpringApplication.run(AppProyectosIES.class, args);
}
}

View File

@ -0,0 +1,46 @@
package org.lapaloma.aadd.api.proyectosies.controller;
import java.util.List;
import org.lapaloma.aadd.api.proyectosies.model.Patrocinador;
import org.lapaloma.aadd.api.proyectosies.repository.IPatrocinadorRepositorio;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.server.ResponseStatusException;
/**
*
* PatrocinadorController: Clase que realiza ....
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
* @date 20 ene 2026
*
*
*/
@RestController
@RequestMapping("/api/patrocinadores")
public class PatrocinadorController {
private final IPatrocinadorRepositorio repository;
public PatrocinadorController(IPatrocinadorRepositorio repository) {
this.repository = repository;
}
@GetMapping
public List<Patrocinador> listar() {
return repository.findAll();
}
@GetMapping("/{id}")
public Patrocinador obtenerPorId(@PathVariable Long id) {
return repository.findById(id)
.orElseThrow(() -> new ResponseStatusException(
HttpStatus.NOT_FOUND,
"Patrocinador no encontrado"
));
}
}

View File

@ -0,0 +1,38 @@
package org.lapaloma.aadd.api.proyectosies.model;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Lob;
import jakarta.persistence.Table;
import lombok.Data;
/**
*
* Patrocinador: Clase que se usa para mapear la tabla de patrocinadoes
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
* @date 5 dic 2025
*
*
*/
@Data
@Entity
@Table(name="T_PATROCINADOR")
public class Patrocinador {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="identificador")
private int identificador;
@Column(name="nombre", length=100, nullable = false, unique = true)
private String nombre;
@Lob
@Column(name = "imagen")
private byte[] imagenLogo;
}

View File

@ -0,0 +1,17 @@
package org.lapaloma.aadd.api.proyectosies.repository;
import org.lapaloma.aadd.api.proyectosies.model.Patrocinador;
import org.springframework.data.jpa.repository.JpaRepository;
/**
*
* PatrocinadorRepositorio: Clase que realiza ....
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
* @date 20 ene 2026
*
*
*/
public interface IPatrocinadorRepositorio extends JpaRepository<Patrocinador, Long> {
}

View File

@ -0,0 +1,12 @@
# Datasource
spring.datasource.url=jdbc:postgresql://192.168.1.36:5432/proyectos_ies
spring.datasource.username=vdlp
spring.datasource.password=postgresql_123
# JPA / Hibernate
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
# Dialecto (opcional en Spring Boot 3, pero recomendable)
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect