diff --git a/gitignore.io b/gitignore.io
index 3a411b6..328f507 100644
--- a/gitignore.io
+++ b/gitignore.io
@@ -98,5 +98,6 @@ spring-boot-modules/spring-boot-react/frontend/node
spring-boot-modules/spring-boot-react/frontend/yarn.lock
spring-boot-modules/spring-boot-properties-3/*.log
+# ficheros .c no estan
+*.c
# SDKMan
-.sdkmanrc
diff --git a/tutoria_13_01_2021/barbershop/.gitignore b/tutoria_13_01_2021/barbershop/.gitignore
deleted file mode 100644
index 549e00a..0000000
--- a/tutoria_13_01_2021/barbershop/.gitignore
+++ /dev/null
@@ -1,33 +0,0 @@
-HELP.md
-target/
-!.mvn/wrapper/maven-wrapper.jar
-!**/src/main/**/target/
-!**/src/test/**/target/
-
-### STS ###
-.apt_generated
-.classpath
-.factorypath
-.project
-.settings
-.springBeans
-.sts4-cache
-
-### IntelliJ IDEA ###
-.idea
-*.iws
-*.iml
-*.ipr
-
-### NetBeans ###
-/nbproject/private/
-/nbbuild/
-/dist/
-/nbdist/
-/.nb-gradle/
-build/
-!**/src/main/**/build/
-!**/src/test/**/build/
-
-### VS Code ###
-.vscode/
diff --git a/tutoria_13_01_2021/barbershop/.mvn/wrapper/MavenWrapperDownloader.java b/tutoria_13_01_2021/barbershop/.mvn/wrapper/MavenWrapperDownloader.java
deleted file mode 100644
index e76d1f3..0000000
--- a/tutoria_13_01_2021/barbershop/.mvn/wrapper/MavenWrapperDownloader.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright 2007-present the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import java.net.*;
-import java.io.*;
-import java.nio.channels.*;
-import java.util.Properties;
-
-public class MavenWrapperDownloader {
-
- private static final String WRAPPER_VERSION = "0.5.6";
- /**
- * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
- */
- private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
- + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
-
- /**
- * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
- * use instead of the default one.
- */
- private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
- ".mvn/wrapper/maven-wrapper.properties";
-
- /**
- * Path where the maven-wrapper.jar will be saved to.
- */
- private static final String MAVEN_WRAPPER_JAR_PATH =
- ".mvn/wrapper/maven-wrapper.jar";
-
- /**
- * Name of the property which should be used to override the default download url for the wrapper.
- */
- private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
-
- public static void main(String args[]) {
- System.out.println("- Downloader started");
- File baseDirectory = new File(args[0]);
- System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
-
- // If the maven-wrapper.properties exists, read it and check if it contains a custom
- // wrapperUrl parameter.
- File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
- String url = DEFAULT_DOWNLOAD_URL;
- if(mavenWrapperPropertyFile.exists()) {
- FileInputStream mavenWrapperPropertyFileInputStream = null;
- try {
- mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
- Properties mavenWrapperProperties = new Properties();
- mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
- url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
- } catch (IOException e) {
- System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
- } finally {
- try {
- if(mavenWrapperPropertyFileInputStream != null) {
- mavenWrapperPropertyFileInputStream.close();
- }
- } catch (IOException e) {
- // Ignore ...
- }
- }
- }
- System.out.println("- Downloading from: " + url);
-
- File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
- if(!outputFile.getParentFile().exists()) {
- if(!outputFile.getParentFile().mkdirs()) {
- System.out.println(
- "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
- }
- }
- System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
- try {
- downloadFileFromURL(url, outputFile);
- System.out.println("Done");
- System.exit(0);
- } catch (Throwable e) {
- System.out.println("- Error downloading");
- e.printStackTrace();
- System.exit(1);
- }
- }
-
- private static void downloadFileFromURL(String urlString, File destination) throws Exception {
- if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
- String username = System.getenv("MVNW_USERNAME");
- char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
- Authenticator.setDefault(new Authenticator() {
- @Override
- protected PasswordAuthentication getPasswordAuthentication() {
- return new PasswordAuthentication(username, password);
- }
- });
- }
- URL website = new URL(urlString);
- ReadableByteChannel rbc;
- rbc = Channels.newChannel(website.openStream());
- FileOutputStream fos = new FileOutputStream(destination);
- fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
- fos.close();
- rbc.close();
- }
-
-}
diff --git a/tutoria_13_01_2021/barbershop/.mvn/wrapper/maven-wrapper.jar b/tutoria_13_01_2021/barbershop/.mvn/wrapper/maven-wrapper.jar
deleted file mode 100644
index 2cc7d4a..0000000
Binary files a/tutoria_13_01_2021/barbershop/.mvn/wrapper/maven-wrapper.jar and /dev/null differ
diff --git a/tutoria_13_01_2021/barbershop/.mvn/wrapper/maven-wrapper.properties b/tutoria_13_01_2021/barbershop/.mvn/wrapper/maven-wrapper.properties
deleted file mode 100644
index a9f1ef8..0000000
--- a/tutoria_13_01_2021/barbershop/.mvn/wrapper/maven-wrapper.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.3/apache-maven-3.8.3-bin.zip
-wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
diff --git a/tutoria_13_01_2021/barbershop/README.md b/tutoria_13_01_2021/barbershop/README.md
deleted file mode 100644
index f7d6fa4..0000000
--- a/tutoria_13_01_2021/barbershop/README.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# Barbershop
-
-## Entidades JPA
-
-* Appointment: representa una cita en una peluquería
-* C
-
-
-## Frameworks control de versiones sobre la base de datos
-
-Liquibase: https://www.liquibase.org/
-
-Flyway: https://flywaydb.org/
-
-## Framework Lombok
-
-https://projectlombok.org/features/all
-
-Revisar @Data
-
-https://projectlombok.org/features/Data
-
-## Spring Data JPA
-
-Cómo crear nuevos métodos:
-
-https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories
-
-https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query-methods.query-creation
-
-
diff --git a/tutoria_13_01_2021/barbershop/barbershop.postman_collection.json b/tutoria_13_01_2021/barbershop/barbershop.postman_collection.json
deleted file mode 100644
index 9b502a5..0000000
--- a/tutoria_13_01_2021/barbershop/barbershop.postman_collection.json
+++ /dev/null
@@ -1,821 +0,0 @@
-{
- "info": {
- "_postman_id": "d34033e5-7757-44af-9c20-35e2dcd5cd95",
- "name": "barbershop",
- "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
- },
- "item": [
- {
- "name": "appointments",
- "item": [
- {
- "name": "/api/appointments",
- "request": {
- "method": "GET",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/appointments",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "appointments"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/appointments/1",
- "request": {
- "method": "GET",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/appointments/4",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "appointments",
- "4"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/appointments/999 (404)",
- "request": {
- "method": "GET",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/appointments/999",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "appointments",
- "999"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/appointments",
- "request": {
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "{\r\n \"date\": \"2022-01-20T11:30:00\",\r\n \"duration\": 30,\r\n \"description\": \"Corte de pelo creado desde postman\",\r\n \"customer\": {\r\n \"id\": 1\r\n },\r\n \"hairAssistance\": {\r\n \"id\": 2\r\n },\r\n \"employee\": {\r\n \"id\": 1\r\n }\r\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "http://localhost:8081/api/appointments",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "appointments"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/appointments",
- "request": {
- "method": "PUT",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "{\r\n \"id\": 4,\r\n \"date\": \"2022-01-20T11:30:00\",\r\n \"duration\": 35,\r\n \"description\": \"Corte de pelo creado desde postman editado\",\r\n \"customer\": {\r\n \"id\": 2\r\n },\r\n \"hairAssistance\": {\r\n \"id\": 1\r\n },\r\n \"employee\": {\r\n \"id\": 1\r\n }\r\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "http://localhost:8081/api/appointments",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "appointments"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/appointments/1",
- "request": {
- "method": "DELETE",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/appointments/4",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "appointments",
- "4"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/appointments/benefits/year/month/day",
- "request": {
- "method": "GET",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/appointments/benefits/2022/1/11",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "appointments",
- "benefits",
- "2022",
- "1",
- "11"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/appointments/benefits/year/month",
- "request": {
- "method": "GET",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/appointments/benefits/2022/1",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "appointments",
- "benefits",
- "2022",
- "1"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/appointments/benefits/year",
- "request": {
- "method": "GET",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/appointments/benefits/2022",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "appointments",
- "benefits",
- "2022"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/appointments/search/customer",
- "request": {
- "method": "GET",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/appointments/search/customer/email/customer3@example.com",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "appointments",
- "search",
- "customer",
- "email",
- "customer3@example.com"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/appointments/search/employee",
- "request": {
- "method": "GET",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/appointments/search/employee/dni/8765674H",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "appointments",
- "search",
- "employee",
- "dni",
- "8765674H"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/appointments/search/hair-assistance/price",
- "request": {
- "method": "GET",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/appointments/search/hair-assistance/price/15",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "appointments",
- "search",
- "hair-assistance",
- "price",
- "15"
- ]
- }
- },
- "response": []
- }
- ]
- },
- {
- "name": "customers",
- "item": [
- {
- "name": "/api/customers",
- "request": {
- "method": "GET",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/customers",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "customers"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/customers/1",
- "request": {
- "method": "GET",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/customers/1",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "customers",
- "1"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/customers/999999",
- "request": {
- "method": "GET",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/customers/999999",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "customers",
- "999999"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/customers",
- "request": {
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "{\r\n \"id\": null,\r\n \"firstName\": \"Customer creado desde Postman 1\",\r\n \"lastName\": \"lastname54636\",\r\n \"email\": \"customerPostman1@example.com\",\r\n \"birthDate\": \"1991-01-03\"\r\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "http://localhost:8081/api/customers",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "customers"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/customers Appointment",
- "request": {
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "{\r\n \"firstName\": \"Customer postman 3\",\r\n \"lastName\": \"lastname3\",\r\n \"email\": \"customerpostman3@example.com\",\r\n \"birthDate\": \"1990-01-03\",\r\n \"appointments\": [\r\n {\r\n \"id\": 1\r\n },\r\n {\r\n \"id\": 2\r\n },\r\n {\r\n \"id\": 3\r\n }\r\n ]\r\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "http://localhost:8081/api/customers",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "customers"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/customers",
- "request": {
- "method": "PUT",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "{\r\n \"id\": 1,\r\n \"date\": \"2022-01-20T11:30:00\",\r\n \"duration\": 35,\r\n \"description\": \"Corte de pelo creado desde postman editado\",\r\n \"customer\": {\r\n \"id\": 5\r\n },\r\n \"hairAssistance\": {\r\n \"id\": 1\r\n },\r\n \"employee\": {\r\n \"id\": 1\r\n }\r\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "http://localhost:8081/api/appointments",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "appointments"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/customers",
- "request": {
- "method": "PUT",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "{\r\n \"id\": 2,\r\n \"firstName\": \"cliente 2 modificado desde Postman\",\r\n \"lastName\": \"postman\",\r\n \"email\": \"customer2@example.com\",\r\n \"birthDate\": \"1980-01-03\",\r\n \"appointments\": [\r\n {\r\n \"id\": 1\r\n },\r\n {\r\n \"id\": 2\r\n }\r\n ]\r\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "http://localhost:8081/api/customers",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "customers"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/customers/1",
- "request": {
- "method": "DELETE",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/customers/1",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "customers",
- "1"
- ]
- }
- },
- "response": []
- }
- ]
- },
- {
- "name": "employees",
- "item": [
- {
- "name": "/api/employees",
- "request": {
- "method": "GET",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/employees",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "employees"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/employees/2",
- "request": {
- "method": "GET",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/employees/3",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "employees",
- "3"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/employees/999999",
- "request": {
- "method": "GET",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/employees/999999",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "employees",
- "999999"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/employees",
- "request": {
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "{\r\n \"firstName\": \"emp creado desde postman\",\r\n \"lastName\": \"postman\",\r\n \"email\": \"postman3@company.com\",\r\n \"birthDate\": null,\r\n \"nss\": \"2543265\",\r\n \"dni\": \"142324F\",\r\n \"direction\": {\r\n \"street\": \"Calle Verdadera\",\r\n \"postalCode\": \"28070\",\r\n \"country\": \"Spain\"\r\n }\r\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "http://localhost:8081/api/employees",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "employees"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/employees Copy",
- "request": {
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "{\r\n \"firstName\": \"24354253\",\r\n \"lastName\": \"234543252\",\r\n \"email\": \"sfdgsdgf\",\r\n \"birthDate\": null,\r\n \"nss\": \"sdfgfsdg\",\r\n \"dni\": \"srgdsfg\",\r\n \"direction\": {\r\n \"id\": 1,\r\n \"street\": \"\",\r\n \"postalCode\": \"\",\r\n \"country\": \"Andorra\"\r\n }\r\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "http://localhost:8081/api/employees",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "employees"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/employees",
- "request": {
- "method": "PUT",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "{\r\n \"id\": 1,\r\n \"firstName\": \"emp actualizado desde postman\",\r\n \"lastName\": \"postman\",\r\n \"email\": \"postman1@company.com\",\r\n \"birthDate\": null,\r\n \"nss\": \"254326354435\",\r\n \"dni\": \"142324F354345\"\r\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "http://localhost:8081/api/employees",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "employees"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/employees/1",
- "request": {
- "method": "DELETE",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/employees/1",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "employees",
- "1"
- ]
- }
- },
- "response": []
- }
- ]
- },
- {
- "name": "hair-assistances",
- "item": [
- {
- "name": "/api/hair-assistances",
- "request": {
- "method": "GET",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/hair-assistances",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "hair-assistances"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/hair-assistances/2",
- "request": {
- "method": "GET",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/hair-assistances/2",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "hair-assistances",
- "2"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/hair-assistances/999999",
- "request": {
- "method": "GET",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/hair-assistances/999999",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "hair-assistances",
- "999999"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/hair-assistances",
- "request": {
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "{\r\n \"name\": \"Corte Pelo Postman\",\r\n \"price\": 45.0,\r\n \"duration\": 80\r\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "http://localhost:8081/api/hair-assistances",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "hair-assistances"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/hair-assistances",
- "request": {
- "method": "PUT",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "{\r\n \"id\": 2,\r\n \"name\": \"Corte Pelo femenino editado desde Postman\",\r\n \"price\": 77.0,\r\n \"duration\": 90\r\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "http://localhost:8081/api/hair-assistances",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "hair-assistances"
- ]
- }
- },
- "response": []
- },
- {
- "name": "/api/hair-assistances/1",
- "request": {
- "method": "DELETE",
- "header": [],
- "url": {
- "raw": "http://localhost:8081/api/hair-assistances/1",
- "protocol": "http",
- "host": [
- "localhost"
- ],
- "port": "8081",
- "path": [
- "api",
- "hair-assistances",
- "1"
- ]
- }
- },
- "response": []
- }
- ]
- }
- ]
-}
\ No newline at end of file
diff --git a/tutoria_13_01_2021/barbershop/ejercicios_03_01_2022.md b/tutoria_13_01_2021/barbershop/ejercicios_03_01_2022.md
deleted file mode 100644
index 6ab8732..0000000
--- a/tutoria_13_01_2021/barbershop/ejercicios_03_01_2022.md
+++ /dev/null
@@ -1,16 +0,0 @@
-## Proyecto BARBERSHOP.
-
-Tareas para realizar:
-
-~~TODO - agregar campo description en la entidad Appointment~~
-
-~~TODO - Crear la entidad HairAssistance que representa un servicio a realizar a un cliente (cortar el pelo, peinar, arreglar barba, teñir, etc.)~~
-
-~~TODO - Asociación entidades Appointment y HairAssistance~~
-
-~~TODO - Entidad Employee~~
-
-~~TODO - Asociación entidades Appointment y Employee~~
-
-~~TODO - Capa servicio para todas las entidades con métodos CRUD~~
-
diff --git a/tutoria_13_01_2021/barbershop/ejercicios_04_01_2021.md b/tutoria_13_01_2021/barbershop/ejercicios_04_01_2021.md
deleted file mode 100644
index 290fc94..0000000
--- a/tutoria_13_01_2021/barbershop/ejercicios_04_01_2021.md
+++ /dev/null
@@ -1,7 +0,0 @@
-~~TODO - Capa servicio entidad Appointment con métodos CRUD~~
-
-~~TODO - Capa controlador entidad Appointment con métodos CRUD~~
-
-~~TODO - Pruebas con Postman: Pruebas GET, POST, PUT, DELETE entidad Appointment~~
-
-~~TODO - Métodos cálculo beneficio por fecha (día) en el controller~~
\ No newline at end of file
diff --git a/tutoria_13_01_2021/barbershop/ejercicios_05_01_2021.md b/tutoria_13_01_2021/barbershop/ejercicios_05_01_2021.md
deleted file mode 100644
index b1a7a23..0000000
--- a/tutoria_13_01_2021/barbershop/ejercicios_05_01_2021.md
+++ /dev/null
@@ -1,21 +0,0 @@
-
-~~TODO - Cálculo beneficios por mes~~
-
-~~TODO - Cálculo beneficios por año~~
-
-TODO - crear métodos de búsqueda:
-~~- Buscar todas las citas a partir de un email de cliente~~
-~~- Buscar todas las citas para un determinado Employee~~
-~~- Buscar todas las citas para un determinado rango de precios en el HairService asociado~~
-
-~~TODO - servicio resto de entidades:~~
-~~- CustomerService~~
-~~- EmployeeService~~
-~~- HairAssistanceService~~
-
-~~TODO - terminar controller Appointment~~
-
-TODO - controller resto de entidades
-~~- CustomerController~~
-~~- Métodos asociar/desasociar Customer-Appointment desde Customer~~
-~~- EmployeeController~~
\ No newline at end of file
diff --git a/tutoria_13_01_2021/barbershop/ejercicios_finales.md b/tutoria_13_01_2021/barbershop/ejercicios_finales.md
deleted file mode 100644
index e7ce6b9..0000000
--- a/tutoria_13_01_2021/barbershop/ejercicios_finales.md
+++ /dev/null
@@ -1,14 +0,0 @@
-~~TODO - controller resto de entidades~~
-~~- HairAssistanceController~~
-
-~~TODO - nueva entidad para asociación OneToOne: Address asociada con Employee~~
-
-TODO - nueva entidad para asociación ManyToMany: Car asociada con Employee
-
-TODO - Spring Test: Pruebas GET, POST, PUT, DELETE
-
-TODO - Seguridad con JWT y Spring Security
-
-TODO - Swagger
-
-TODO - Despliegue Heroku
\ No newline at end of file
diff --git a/tutoria_13_01_2021/barbershop/mvnw b/tutoria_13_01_2021/barbershop/mvnw
deleted file mode 100644
index a16b543..0000000
--- a/tutoria_13_01_2021/barbershop/mvnw
+++ /dev/null
@@ -1,310 +0,0 @@
-#!/bin/sh
-# ----------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ----------------------------------------------------------------------------
-
-# ----------------------------------------------------------------------------
-# Maven Start Up Batch script
-#
-# Required ENV vars:
-# ------------------
-# JAVA_HOME - location of a JDK home dir
-#
-# Optional ENV vars
-# -----------------
-# M2_HOME - location of maven2's installed home dir
-# MAVEN_OPTS - parameters passed to the Java VM when running Maven
-# e.g. to debug Maven itself, use
-# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-# ----------------------------------------------------------------------------
-
-if [ -z "$MAVEN_SKIP_RC" ] ; then
-
- if [ -f /etc/mavenrc ] ; then
- . /etc/mavenrc
- fi
-
- if [ -f "$HOME/.mavenrc" ] ; then
- . "$HOME/.mavenrc"
- fi
-
-fi
-
-# OS specific support. $var _must_ be set to either true or false.
-cygwin=false;
-darwin=false;
-mingw=false
-case "`uname`" in
- CYGWIN*) cygwin=true ;;
- MINGW*) mingw=true;;
- Darwin*) darwin=true
- # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
- # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
- if [ -z "$JAVA_HOME" ]; then
- if [ -x "/usr/libexec/java_home" ]; then
- export JAVA_HOME="`/usr/libexec/java_home`"
- else
- export JAVA_HOME="/Library/Java/Home"
- fi
- fi
- ;;
-esac
-
-if [ -z "$JAVA_HOME" ] ; then
- if [ -r /etc/gentoo-release ] ; then
- JAVA_HOME=`java-config --jre-home`
- fi
-fi
-
-if [ -z "$M2_HOME" ] ; then
- ## resolve links - $0 may be a link to maven's home
- PRG="$0"
-
- # need this for relative symlinks
- while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG="`dirname "$PRG"`/$link"
- fi
- done
-
- saveddir=`pwd`
-
- M2_HOME=`dirname "$PRG"`/..
-
- # make it fully qualified
- M2_HOME=`cd "$M2_HOME" && pwd`
-
- cd "$saveddir"
- # echo Using m2 at $M2_HOME
-fi
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched
-if $cygwin ; then
- [ -n "$M2_HOME" ] &&
- M2_HOME=`cygpath --unix "$M2_HOME"`
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
-fi
-
-# For Mingw, ensure paths are in UNIX format before anything is touched
-if $mingw ; then
- [ -n "$M2_HOME" ] &&
- M2_HOME="`(cd "$M2_HOME"; pwd)`"
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
-fi
-
-if [ -z "$JAVA_HOME" ]; then
- javaExecutable="`which javac`"
- if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
- # readlink(1) is not available as standard on Solaris 10.
- readLink=`which readlink`
- if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
- if $darwin ; then
- javaHome="`dirname \"$javaExecutable\"`"
- javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
- else
- javaExecutable="`readlink -f \"$javaExecutable\"`"
- fi
- javaHome="`dirname \"$javaExecutable\"`"
- javaHome=`expr "$javaHome" : '\(.*\)/bin'`
- JAVA_HOME="$javaHome"
- export JAVA_HOME
- fi
- fi
-fi
-
-if [ -z "$JAVACMD" ] ; then
- if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- else
- JAVACMD="`which java`"
- fi
-fi
-
-if [ ! -x "$JAVACMD" ] ; then
- echo "Error: JAVA_HOME is not defined correctly." >&2
- echo " We cannot execute $JAVACMD" >&2
- exit 1
-fi
-
-if [ -z "$JAVA_HOME" ] ; then
- echo "Warning: JAVA_HOME environment variable is not set."
-fi
-
-CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
-
-# traverses directory structure from process work directory to filesystem root
-# first directory with .mvn subdirectory is considered project base directory
-find_maven_basedir() {
-
- if [ -z "$1" ]
- then
- echo "Path not specified to find_maven_basedir"
- return 1
- fi
-
- basedir="$1"
- wdir="$1"
- while [ "$wdir" != '/' ] ; do
- if [ -d "$wdir"/.mvn ] ; then
- basedir=$wdir
- break
- fi
- # workaround for JBEAP-8937 (on Solaris 10/Sparc)
- if [ -d "${wdir}" ]; then
- wdir=`cd "$wdir/.."; pwd`
- fi
- # end of workaround
- done
- echo "${basedir}"
-}
-
-# concatenates all lines of a file
-concat_lines() {
- if [ -f "$1" ]; then
- echo "$(tr -s '\n' ' ' < "$1")"
- fi
-}
-
-BASE_DIR=`find_maven_basedir "$(pwd)"`
-if [ -z "$BASE_DIR" ]; then
- exit 1;
-fi
-
-##########################################################################################
-# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
-# This allows using the maven wrapper in projects that prohibit checking in binary data.
-##########################################################################################
-if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Found .mvn/wrapper/maven-wrapper.jar"
- fi
-else
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
- fi
- if [ -n "$MVNW_REPOURL" ]; then
- jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
- else
- jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
- fi
- while IFS="=" read key value; do
- case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
- esac
- done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Downloading from: $jarUrl"
- fi
- wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
- if $cygwin; then
- wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
- fi
-
- if command -v wget > /dev/null; then
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Found wget ... using wget"
- fi
- if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
- wget "$jarUrl" -O "$wrapperJarPath"
- else
- wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
- fi
- elif command -v curl > /dev/null; then
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Found curl ... using curl"
- fi
- if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
- curl -o "$wrapperJarPath" "$jarUrl" -f
- else
- curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
- fi
-
- else
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Falling back to using Java to download"
- fi
- javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
- # For Cygwin, switch paths to Windows format before running javac
- if $cygwin; then
- javaClass=`cygpath --path --windows "$javaClass"`
- fi
- if [ -e "$javaClass" ]; then
- if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
- if [ "$MVNW_VERBOSE" = true ]; then
- echo " - Compiling MavenWrapperDownloader.java ..."
- fi
- # Compiling the Java class
- ("$JAVA_HOME/bin/javac" "$javaClass")
- fi
- if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
- # Running the downloader
- if [ "$MVNW_VERBOSE" = true ]; then
- echo " - Running MavenWrapperDownloader.java ..."
- fi
- ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
- fi
- fi
- fi
-fi
-##########################################################################################
-# End of extension
-##########################################################################################
-
-export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
-if [ "$MVNW_VERBOSE" = true ]; then
- echo $MAVEN_PROJECTBASEDIR
-fi
-MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin; then
- [ -n "$M2_HOME" ] &&
- M2_HOME=`cygpath --path --windows "$M2_HOME"`
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
- [ -n "$MAVEN_PROJECTBASEDIR" ] &&
- MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
-fi
-
-# Provide a "standardized" way to retrieve the CLI args that will
-# work with both Windows and non-Windows executions.
-MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
-export MAVEN_CMD_LINE_ARGS
-
-WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-exec "$JAVACMD" \
- $MAVEN_OPTS \
- -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
- "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
- ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/tutoria_13_01_2021/barbershop/mvnw.cmd b/tutoria_13_01_2021/barbershop/mvnw.cmd
deleted file mode 100644
index c8d4337..0000000
--- a/tutoria_13_01_2021/barbershop/mvnw.cmd
+++ /dev/null
@@ -1,182 +0,0 @@
-@REM ----------------------------------------------------------------------------
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM https://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM ----------------------------------------------------------------------------
-
-@REM ----------------------------------------------------------------------------
-@REM Maven Start Up Batch script
-@REM
-@REM Required ENV vars:
-@REM JAVA_HOME - location of a JDK home dir
-@REM
-@REM Optional ENV vars
-@REM M2_HOME - location of maven2's installed home dir
-@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
-@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
-@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
-@REM e.g. to debug Maven itself, use
-@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-@REM ----------------------------------------------------------------------------
-
-@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
-@echo off
-@REM set title of command window
-title %0
-@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
-@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
-
-@REM set %HOME% to equivalent of $HOME
-if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
-
-@REM Execute a user defined script before this one
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
-@REM check for pre script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
-if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
-:skipRcPre
-
-@setlocal
-
-set ERROR_CODE=0
-
-@REM To isolate internal variables from possible post scripts, we use another setlocal
-@setlocal
-
-@REM ==== START VALIDATION ====
-if not "%JAVA_HOME%" == "" goto OkJHome
-
-echo.
-echo Error: JAVA_HOME not found in your environment. >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-:OkJHome
-if exist "%JAVA_HOME%\bin\java.exe" goto init
-
-echo.
-echo Error: JAVA_HOME is set to an invalid directory. >&2
-echo JAVA_HOME = "%JAVA_HOME%" >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-@REM ==== END VALIDATION ====
-
-:init
-
-@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
-@REM Fallback to current working directory if not found.
-
-set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
-IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
-
-set EXEC_DIR=%CD%
-set WDIR=%EXEC_DIR%
-:findBaseDir
-IF EXIST "%WDIR%"\.mvn goto baseDirFound
-cd ..
-IF "%WDIR%"=="%CD%" goto baseDirNotFound
-set WDIR=%CD%
-goto findBaseDir
-
-:baseDirFound
-set MAVEN_PROJECTBASEDIR=%WDIR%
-cd "%EXEC_DIR%"
-goto endDetectBaseDir
-
-:baseDirNotFound
-set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
-cd "%EXEC_DIR%"
-
-:endDetectBaseDir
-
-IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
-
-@setlocal EnableExtensions EnableDelayedExpansion
-for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
-@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
-
-:endReadAdditionalConfig
-
-SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
-set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
-set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
-
-FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
- IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
-)
-
-@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
-@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
-if exist %WRAPPER_JAR% (
- if "%MVNW_VERBOSE%" == "true" (
- echo Found %WRAPPER_JAR%
- )
-) else (
- if not "%MVNW_REPOURL%" == "" (
- SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
- )
- if "%MVNW_VERBOSE%" == "true" (
- echo Couldn't find %WRAPPER_JAR%, downloading it ...
- echo Downloading from: %DOWNLOAD_URL%
- )
-
- powershell -Command "&{"^
- "$webclient = new-object System.Net.WebClient;"^
- "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
- "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
- "}"^
- "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
- "}"
- if "%MVNW_VERBOSE%" == "true" (
- echo Finished downloading %WRAPPER_JAR%
- )
-)
-@REM End of extension
-
-@REM Provide a "standardized" way to retrieve the CLI args that will
-@REM work with both Windows and non-Windows executions.
-set MAVEN_CMD_LINE_ARGS=%*
-
-%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
-if ERRORLEVEL 1 goto error
-goto end
-
-:error
-set ERROR_CODE=1
-
-:end
-@endlocal & set ERROR_CODE=%ERROR_CODE%
-
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
-@REM check for post script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
-if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
-:skipRcPost
-
-@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
-if "%MAVEN_BATCH_PAUSE%" == "on" pause
-
-if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
-
-exit /B %ERROR_CODE%
diff --git a/tutoria_13_01_2021/barbershop/pom.xml b/tutoria_13_01_2021/barbershop/pom.xml
deleted file mode 100644
index 92d6ba9..0000000
--- a/tutoria_13_01_2021/barbershop/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
- 4.0.0
-
- org.springframework.boot
- spring-boot-starter-parent
- 2.6.2
-
-
- com.example
- barbershop
- 0.0.1-SNAPSHOT
- barbershop
- Demo project for Spring Boot
-
- 17
-
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- org.springframework.boot
- spring-boot-devtools
- runtime
- true
-
-
- org.postgresql
- postgresql
- runtime
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
-
diff --git a/tutoria_13_01_2021/barbershop/postman-get-findall.json b/tutoria_13_01_2021/barbershop/postman-get-findall.json
deleted file mode 100644
index c1b3dcf..0000000
--- a/tutoria_13_01_2021/barbershop/postman-get-findall.json
+++ /dev/null
@@ -1,52 +0,0 @@
-[
- {
- "id": 3,
- "date": "2022-01-05T16:37:55.689625",
- "duration": 60,
- "description": "Lorem ipsum dolor sit amet",
- "hairAssistance": null,
- "employee": null
- },
- {
- "id": 1,
- "date": "2022-01-14T10:30:00",
- "duration": 60,
- "description": "Lorem ipsum dolor sit amet",
- "hairAssistance": {
- "id": 2,
- "name": "Corte Pelo femenino",
- "price": 20.0,
- "duration": 80
- },
- "employee": {
- "id": 1,
- "firstName": "emp1",
- "lastName": "emp1",
- "email": "emp1@company.com",
- "birthDate": null,
- "nss": "12345",
- "dni": "8765674H"
- }
- },
- {
- "id": 2,
- "date": "2022-01-05T16:37:55.686127",
- "duration": 60,
- "description": "Lorem ipsum dolor sit amet",
- "hairAssistance": {
- "id": 2,
- "name": "Corte Pelo femenino",
- "price": 20.0,
- "duration": 80
- },
- "employee": {
- "id": 1,
- "firstName": "emp1",
- "lastName": "emp1",
- "email": "emp1@company.com",
- "birthDate": null,
- "nss": "12345",
- "dni": "8765674H"
- }
- }
-]
\ No newline at end of file
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/BarbershopApplication.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/BarbershopApplication.java
deleted file mode 100644
index 53652b4..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/BarbershopApplication.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package com.example.barbershop;
-
-import com.example.barbershop.entities.*;
-import com.example.barbershop.repository.*;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.ApplicationContext;
-
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.temporal.TemporalAdjusters;
-import java.util.List;
-import java.util.Optional;
-
-@SpringBootApplication
-public class BarbershopApplication {
-
- public static void main(String[] args) {
-
-
-
-
- ApplicationContext context = SpringApplication.run(BarbershopApplication.class, args);
-
- // CITA
- AppointmentRepository appRepository = context.getBean(AppointmentRepository.class);
-
- Appointment cita1 = new Appointment(
- null,
- LocalDateTime.of(2022, 1, 14, 10, 30),
- 60,
- "Lorem ipsum dolor sit amet");
-
-
- appRepository.save(cita1);
-
- // CLIENTE
- CustomerRepository customerRepository = context.getBean(CustomerRepository.class);
-
- Customer customer = new Customer(null, "Customer1", "lastname1", "customer1@example.com",
- LocalDate.of(1990, 1, 3));
-
- // customer.getAppointments().add(cita1);
-
- customerRepository.save(customer);
-
- // ASOCIACIÓN APPOINTMENT - CUSTOMER
- cita1.setCustomer(customer);
- appRepository.save(cita1);
-
- // COMPROBAR QUE AL BUSCAR EL APPOINTMENT RECUPERA TAMBIÉN EL CUSTOMER
- Optional appointmentOpt = appRepository.findById(1L);
- Appointment appointment1 = null;
- if(appointmentOpt.isPresent()) {
- appointment1 = appointmentOpt.get();
- System.out.println(appointment1.getCustomer());
- }
-
-
- // ESCENARIO INVERSO (IMPORTANTE: Como Customer no es owner de la asociación entonces no se guarda en base de datos esa asociación )
- Appointment cita2 = new Appointment(null, LocalDateTime.now(), 60, "Lorem ipsum dolor sit amet");
- appRepository.save(cita2);
- Appointment cita3 = new Appointment(null, LocalDateTime.now(), 60, "Lorem ipsum dolor sit amet");
- appRepository.save(cita3);
-
- Customer customer2 = new Customer(null, "customer2", "lastname2", "customer2@example.com", null);
- customer2.getAppointments().add(cita2);
- customer2.getAppointments().add(cita3);
- customerRepository.save(customer2);
-
-
- // HAIR ASSISTANCE
-
- HairAssistanceRepository hairAssistRepository = context.getBean(HairAssistanceRepository.class);
- HairAssistance cortePeloM = new HairAssistance(null, "Corte Pelo hombre", 12d, 40);
- HairAssistance cortePeloF = new HairAssistance(null, "Corte Pelo femenino", 20d, 80);
- hairAssistRepository.save(cortePeloM);
- hairAssistRepository.save(cortePeloF);
-
-
- // HAIR ASSISTANCE - APPOINTMENT
- cita1.setHairAssistance(cortePeloF); // asociación Many To One
- cita2.setHairAssistance(cortePeloF);
- cita3.setHairAssistance(cortePeloM);
- appRepository.save(cita1);
- appRepository.save(cita2);
- appRepository.save(cita3);
-
-
- // EMPLOYEE
- EmployeeRepository employeeRepository = context.getBean(EmployeeRepository.class);
- Employee emp1 = new Employee(null, "emp1", "emp1", "emp1@company.com", null, "12345", "8765674H");
- Employee emp2 = new Employee(null, "emp2", "emp2", "emp2@company.com", null, "12346", "8765674J");
- employeeRepository.save(emp1);
- employeeRepository.save(emp2);
-
-
- // APPOINTMENT - EMPLOYEE
- cita1.setEmployee(emp1);
- cita2.setEmployee(emp1);
- appRepository.saveAll(List.of(cita1, cita2));
-
-
- HairAssistance ha1 = new HairAssistance(null, "Corte pelo M", 15.0, 40);
- HairAssistance ha2 = new HairAssistance(null, "Corte pelo F", 30.0, 40);
- HairAssistance ha3 = new HairAssistance(null, "Corte pelo M advance", 20.0, 40);
- HairAssistance ha4 = new HairAssistance(null, "Corte pelo M san valentin", 20.0, 40);
- hairAssistRepository.save(ha1);
- hairAssistRepository.save(ha2);
- hairAssistRepository.save(ha3);
- hairAssistRepository.save(ha4);
-
-
- Customer customer3 = new Customer(null, "customer3", "lastname3", "customer3@example.com", null);
- customerRepository.save(customer3);
-
- Appointment app1 = new Appointment(null, LocalDateTime.of(2022, 1, 1, 13, 30), 50, "");
- app1.setHairAssistance(ha1);
- app1.setCustomer(customer3);
- appRepository.save(app1);
-
- Appointment app2 = new Appointment(null, LocalDateTime.of(2022, 1, 14, 16, 30), 50, "");
- app2.setHairAssistance(ha2);
- app2.setCustomer(customer);
- appRepository.save(app2);
-
- Appointment app3 = new Appointment(null, LocalDateTime.of(2022, 1, 31, 20, 30), 50, "");
- app3.setHairAssistance(ha3);
- app3.setCustomer(customer2);
- appRepository.save(app3);
-
- Appointment app4 = new Appointment(null, LocalDateTime.of(2022, 2, 14, 20, 30), 50, "");
- app4.setHairAssistance(ha4);
- appRepository.save(app4);
-
-
- // DIRECTION
- DirectionRepository directionRepository = context.getBean(DirectionRepository.class);
- Direction direction1 = new Direction(null, "Calle Falsa", "28070", "Spain");
- // directionRepository.save(direction1); // @OneToOne(cascade = CascadeType.ALL) en Employee guarda también la Direction
- Direction direction2 = new Direction(null, "Calle sin empleado", "28070", "Spain");
- directionRepository.save(direction2);
-
- Employee emp3 = new Employee(null, "emp3", "emp3", "emp3@company.com", null, "dfgdgfdsg", "324324");
- emp3.setDirection(direction1);
- employeeRepository.save(emp3);
-
- // Comprobar org.postgresql.util.PSQLException: ERROR: llave duplicada viola restricción de unicidad
-// Employee emp4 = new Employee(null, "emp4", "emp4", "emp4@company.com", null, "dfgsdgfds", "46254654");
-// emp4.setDirection(direction1);
-// employeeRepository.save(emp4);
-
- }
-
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/controller/AppointmentController.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/controller/AppointmentController.java
deleted file mode 100644
index cf4a90d..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/controller/AppointmentController.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package com.example.barbershop.controller;
-
-import com.example.barbershop.dto.BenefitsDTO;
-import com.example.barbershop.entities.Appointment;
-import com.example.barbershop.service.AppointmentService;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-import java.time.LocalDate;
-import java.time.Month;
-import java.util.List;
-import java.util.Optional;
-
-@RestController
-@RequestMapping("/api")
-public class AppointmentController {
-
- private final AppointmentService appointmentService;
-
- public AppointmentController(AppointmentService appointmentService) {
- this.appointmentService = appointmentService;
- }
-
- /**
- * GET http://localhost:8081/api/appointments
- */
- @GetMapping("/appointments")
- public List findAll(){
- return appointmentService.findAll();
- }
-
- @GetMapping("/appointments/search/customer/email/{email}")
- public List findAllByCustomerEmail(@PathVariable String email){
- return appointmentService.findAllByCustomerEmail(email);
- }
-
-
- @GetMapping("/appointments/search/employee/dni/{dni}")
- public List findAllByEmployeeDni(@PathVariable String dni){
- return appointmentService.findAllByEmployeeDni(dni);
- }
-
- @GetMapping("/appointments/search/hair-assistance/price/{price}")
- public List findAllByPriceLessThanEqual(@PathVariable Double price){
- return appointmentService.findAllByPriceLessThanEqual(price);
- }
-
- /**
- * GET http://localhost:8081/api/appointments/1
- * GET http://localhost:8081/api/appointments/2
- */
- @GetMapping("/appointments/{id}")
- public ResponseEntity findById(@PathVariable Long id){
-
- Optional appointmentOpt = appointmentService.findById(id);
- if(appointmentOpt.isPresent())
- return ResponseEntity.ok(appointmentOpt.get());
-
- return ResponseEntity.notFound().build(); // 404
-
-// return appointmentService.findById(id)
-// .map(ResponseEntity::ok)
-// .orElseGet(() -> ResponseEntity.notFound().build());
- }
-
- /**
- * Crea una nueva cita
- * POST http://localhost:8081/api/appointments
- */
- @PostMapping("/appointments")
- public ResponseEntity create(@RequestBody Appointment appointment){
- if (appointment.getId() != null)
- return ResponseEntity.badRequest().build(); // 400
-
- return ResponseEntity.ok(appointmentService.save(appointment));
- }
-
- /**
- * Actualizar una cita existente
- * PUT http://localhost:8081/api/appointments
- */
- @PutMapping("/appointments")
- public ResponseEntity update(@RequestBody Appointment appointment){
- if (appointment.getId() == null)
- return ResponseEntity.badRequest().build(); // 400
-
- return ResponseEntity.ok(appointmentService.save(appointment));
- }
-
- @DeleteMapping("/appointments/{id}")
- public ResponseEntity deleteById(@PathVariable Long id){
- boolean result = appointmentService.deleteById(id);
- if(result)
- return ResponseEntity.noContent().build();
- else
- return ResponseEntity.internalServerError().build();
- }
-
-
- @GetMapping("/appointments/benefits/{year}/{month}/{day}")
- public ResponseEntity calculateBenefitsByDate(@PathVariable int year, @PathVariable int month, @PathVariable int day){
- double benefits = appointmentService.calculateBenefitsByDate(LocalDate.of(year, month, day));
- BenefitsDTO benefitsDTO = new BenefitsDTO(benefits);
- return ResponseEntity.ok(benefitsDTO);
- }
-
- @GetMapping("/appointments/benefits/{year}/{month}")
- public ResponseEntity calculateBenefitsByMonth(@PathVariable int year, @PathVariable int month){
- double benefits = appointmentService.calculateBenefitsByMonth(year, Month.of(month));
- BenefitsDTO benefitsDTO = new BenefitsDTO(benefits);
- return ResponseEntity.ok(benefitsDTO);
- }
-
- @GetMapping("/appointments/benefits/{year}")
- public ResponseEntity calculateBenefitsByYear(@PathVariable int year){
- double benefits = appointmentService.calculateBenefitsByYear(year);
- BenefitsDTO benefitsDTO = new BenefitsDTO(benefits);
- return ResponseEntity.ok(benefitsDTO);
- }
-
-
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/controller/CustomerController.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/controller/CustomerController.java
deleted file mode 100644
index 21ba54b..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/controller/CustomerController.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.example.barbershop.controller;
-
-import com.example.barbershop.dto.BenefitsDTO;
-import com.example.barbershop.entities.Customer;
-import com.example.barbershop.service.CustomerService;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-import java.time.LocalDate;
-import java.time.Month;
-import java.util.List;
-import java.util.Optional;
-
-@RestController
-@RequestMapping("/api")
-public class CustomerController {
-
- private final CustomerService customerService;
-
- public CustomerController(CustomerService customerService) {
- this.customerService = customerService;
- }
-
- @GetMapping("/customers")
- public List findAll(){
- return customerService.findAll();
- }
-
- @GetMapping("/customers/{id}")
- public ResponseEntity findById(@PathVariable Long id){
- Optional customerOpt = customerService.findById(id);
- if(customerOpt.isPresent())
- return ResponseEntity.ok(customerOpt.get());
-
- return ResponseEntity.notFound().build(); // 404
- }
-
- @PostMapping("/customers")
- public ResponseEntity create(@RequestBody Customer customer){
- if (customer.getId() != null)
- return ResponseEntity.badRequest().build(); // 400
-
- return ResponseEntity.ok(customerService.save(customer));
- }
-
- /**
- * Actualizar una cita existente
- * PUT http://localhost:8081/api/customers
- */
- @PutMapping("/customers")
- public ResponseEntity update(@RequestBody Customer customer){
- if (customer.getId() == null)
- return ResponseEntity.badRequest().build(); // 400
-
- return ResponseEntity.ok(customerService.save(customer));
- }
-
- @DeleteMapping("/customers/{id}")
- public ResponseEntity deleteById(@PathVariable Long id){
- boolean result = customerService.deleteById(id);
- if(result)
- return ResponseEntity.noContent().build();
- else
- return ResponseEntity.internalServerError().build();
- }
-
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/controller/EmployeeController.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/controller/EmployeeController.java
deleted file mode 100644
index 49eea85..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/controller/EmployeeController.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.example.barbershop.controller;
-
-import com.example.barbershop.entities.Employee;
-import com.example.barbershop.service.EmployeeService;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-import java.util.Optional;
-
-@RestController
-@RequestMapping("/api")
-public class EmployeeController {
-
- private final EmployeeService employeeService;
-
- public EmployeeController(EmployeeService employeeService) {
- this.employeeService = employeeService;
- }
-
- @GetMapping("/employees")
- public List findAll(){
- return employeeService.findAll();
- }
-
- @GetMapping("/employees/{id}")
- public ResponseEntity findById(@PathVariable Long id){
- Optional employeeOpt = employeeService.findById(id);
- if(employeeOpt.isPresent())
- return ResponseEntity.ok(employeeOpt.get());
-
- return ResponseEntity.notFound().build(); // 404
- }
-
- @PostMapping("/employees")
- public ResponseEntity create(@RequestBody Employee employee){
- if (employee.getId() != null)
- return ResponseEntity.badRequest().build(); // 400
-
- return ResponseEntity.ok(employeeService.save(employee));
- }
-
- /**
- * Actualizar una cita existente
- * PUT http://localhost:8081/api/employees
- */
- @PutMapping("/employees")
- public ResponseEntity update(@RequestBody Employee employee){
- if (employee.getId() == null)
- return ResponseEntity.badRequest().build(); // 400
-
- return ResponseEntity.ok(employeeService.save(employee));
- }
-
- @DeleteMapping("/employees/{id}")
- public ResponseEntity deleteById(@PathVariable Long id){
- boolean result = employeeService.deleteById(id);
- if(result)
- return ResponseEntity.noContent().build();
- else
- return ResponseEntity.internalServerError().build();
- }
-
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/controller/HairAssistanceController.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/controller/HairAssistanceController.java
deleted file mode 100644
index 5897c8e..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/controller/HairAssistanceController.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.example.barbershop.controller;
-
-import com.example.barbershop.entities.HairAssistance;
-import com.example.barbershop.service.HairAssistanceService;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-import java.util.Optional;
-
-@RestController
-@RequestMapping("/api")
-public class HairAssistanceController {
-
- private final HairAssistanceService hairAssistanceService;
-
- public HairAssistanceController(HairAssistanceService hairAssistanceService) {
- this.hairAssistanceService = hairAssistanceService;
- }
-
- @GetMapping("/hair-assistances")
- public List findAll(){
- return hairAssistanceService.findAll();
- }
-
- @GetMapping("/hair-assistances/{id}")
- public ResponseEntity findById(@PathVariable Long id){
- Optional hairAssistanceOpt = hairAssistanceService.findById(id);
- return hairAssistanceOpt.map(ResponseEntity::ok).orElseGet(() -> ResponseEntity.notFound().build());
-
- }
-
- @PostMapping("/hair-assistances")
- public ResponseEntity create(@RequestBody HairAssistance hairAssistance){
- if (hairAssistance.getId() != null)
- return ResponseEntity.badRequest().build(); // 400
-
- return ResponseEntity.ok(hairAssistanceService.save(hairAssistance));
- }
-
- /**
- * Actualizar una cita existente
- * PUT http://localhost:8081/api/hair-assistances
- */
- @PutMapping("/hair-assistances")
- public ResponseEntity update(@RequestBody HairAssistance hairAssistance){
- if (hairAssistance.getId() == null)
- return ResponseEntity.badRequest().build(); // 400
-
- return ResponseEntity.ok(hairAssistanceService.save(hairAssistance));
- }
-
- @DeleteMapping("/hair-assistances/{id}")
- public ResponseEntity deleteById(@PathVariable Long id){
- boolean result = hairAssistanceService.deleteById(id);
- if(result)
- return ResponseEntity.noContent().build();
- else
- return ResponseEntity.internalServerError().build();
- }
-
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/dto/BenefitsDTO.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/dto/BenefitsDTO.java
deleted file mode 100644
index 1dd8ada..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/dto/BenefitsDTO.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.example.barbershop.dto;
-
-public class BenefitsDTO {
-
- private Double benefits;
-
-
- public BenefitsDTO(){}
-
- public BenefitsDTO(Double benefits) {
- this.benefits = benefits;
- }
-
- public Double getBenefits() {
- return benefits;
- }
-
- public void setBenefits(Double benefits) {
- this.benefits = benefits;
- }
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/entities/Appointment.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/entities/Appointment.java
deleted file mode 100644
index 5c8c303..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/entities/Appointment.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package com.example.barbershop.entities;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.time.LocalDateTime;
-
-@Entity
-@Table(name = "appointments")
-public class Appointment implements Serializable {
-
- // atributos
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
-
- private LocalDateTime date;
-
- private Integer duration; // tiempo real en minutos
-
- @Column(length = 400)
- private String description;
-
- // asociaciones: OneToOne, OneToMany, ManyToOne, ManyToMany
-
- // cliente
- // @JsonIgnore // ignora el customer por completo
- @JsonIgnoreProperties(value = {"appointments"}) // ignora atributos específicos del customer
- @ManyToOne
- @JoinColumn(name = "customer_id", foreignKey = @ForeignKey(name = "fk_appointment_customer"))
- private Customer customer;
-
- // servicio
- @ManyToOne
- @JoinColumn(name = "hair_assistance_id", foreignKey = @ForeignKey(name = "fk_appointment_hairassistance"))
- private HairAssistance hairAssistance;
-
- @ManyToOne
- @JoinColumn(name = "employee_id", foreignKey = @ForeignKey(name = "fk_appointment_employee"))
- private Employee employee;
-
-
- // constructores
-
- public Appointment() {
- }
-
- public Appointment(Long id, LocalDateTime date, Integer duration, String description) {
- this.id = id;
- this.date = date;
- this.duration = duration;
- this.description = description;
- }
-
- // métodos (getter, setter, demás)
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public LocalDateTime getDate() {
- return date;
- }
-
- public void setDate(LocalDateTime date) {
- this.date = date;
- }
-
- public Integer getDuration() {
- return duration;
- }
-
- public void setDuration(Integer duration) {
- this.duration = duration;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Customer getCustomer() {
- return customer;
- }
-
- public void setCustomer(Customer customer) {
- this.customer = customer;
- }
-
- public HairAssistance getHairAssistance() {
- return hairAssistance;
- }
-
- public void setHairAssistance(HairAssistance hairAssistance) {
- this.hairAssistance = hairAssistance;
- }
-
- public Employee getEmployee() {
- return employee;
- }
-
- public void setEmployee(Employee employee) {
- this.employee = employee;
- }
-
- @Override
- public String toString() {
- return "Appointment{" +
- "id=" + id +
- ", date=" + date +
- ", duration=" + duration +
- '}';
- }
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/entities/Customer.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/entities/Customer.java
deleted file mode 100644
index f28a94a..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/entities/Customer.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package com.example.barbershop.entities;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.time.LocalDate;
-import java.util.ArrayList;
-import java.util.List;
-
-@Entity
-@Table(name = "customers")
-public class Customer implements Serializable {
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
-
- @Column(nullable = false, length = 40, name = "first_name")
- private String firstName;
-
- @Column(name="last_name")
- private String lastName;
-
- @Column(nullable = false, unique = true)
- private String email;
-
- @Column(name="birth_date")
- private LocalDate birthDate;
-
- // asociaciones
- // por defecto las asociaciones many son lazy
-// @JsonIgnore
- @JsonIgnoreProperties(value = {"customer"})
- @OneToMany(mappedBy = "customer")
- private List appointments = new ArrayList<>();
-
- public Customer(){}
-
- public Customer(Long id, String firstName, String lastName, String email, LocalDate birthDate) {
- this.id = id;
- this.firstName = firstName;
- this.lastName = lastName;
- this.email = email;
- this.birthDate = birthDate;
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public LocalDate getBirthDate() {
- return birthDate;
- }
-
- public void setBirthDate(LocalDate birthDate) {
- this.birthDate = birthDate;
- }
-
- public List getAppointments() {
- return appointments;
- }
-
- public void setAppointments(List appointments) {
- this.appointments = appointments;
- }
-
- @Override
- public String toString() {
- return "Customer{" +
- "id=" + id +
- ", firstName='" + firstName + '\'' +
- ", lastName='" + lastName + '\'' +
- ", email='" + email + '\'' +
- ", birthDate=" + birthDate +
- '}';
- }
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/entities/Direction.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/entities/Direction.java
deleted file mode 100644
index cdc9fc8..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/entities/Direction.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.example.barbershop.entities;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@Table(name = "directions")
-public class Direction implements Serializable {
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
-
- private String street;
-
- private String postalCode;
-
- private String country;
-
- public Direction(){}
-
- public Direction(Long id, String street, String postalCode, String country) {
- this.id = id;
- this.street = street;
- this.postalCode = postalCode;
- this.country = country;
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getStreet() {
- return street;
- }
-
- public void setStreet(String street) {
- this.street = street;
- }
-
- public String getPostalCode() {
- return postalCode;
- }
-
- public void setPostalCode(String postalCode) {
- this.postalCode = postalCode;
- }
-
- public String getCountry() {
- return country;
- }
-
- public void setCountry(String country) {
- this.country = country;
- }
-
- @Override
- public String toString() {
- return "Direction{" +
- "id=" + id +
- ", street='" + street + '\'' +
- ", postalCode='" + postalCode + '\'' +
- ", country='" + country + '\'' +
- '}';
- }
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/entities/Employee.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/entities/Employee.java
deleted file mode 100644
index 171c8b4..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/entities/Employee.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package com.example.barbershop.entities;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-import javax.persistence.*;
-import java.io.Serializable;
-import java.time.LocalDate;
-
-@Entity
-@Table(name = "employees")
-public class Employee implements Serializable {
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
-
- @Column(nullable = false, length = 40, name = "first_name")
- private String firstName;
-
- @Column(name="last_name")
- private String lastName;
-
- @Column(nullable = false, unique = true)
- private String email;
-
- @Column(name="birth_date")
- private LocalDate birthDate;
-
- @Column(nullable = false, unique = true)
- private String nss;
-
- @Column(nullable = false, unique = true)
- private String dni;
-
-// @JsonIgnore
-// @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
- @OneToOne(cascade = CascadeType.ALL)
- @JoinColumn(name = "direction_id", unique = true,
- foreignKey = @ForeignKey(name = "fk_employee_direction"))
- private Direction direction;
-
- public Employee(){}
-
- public Employee(Long id, String firstName, String lastName, String email, LocalDate birthDate, String nss, String dni) {
- this.id = id;
- this.firstName = firstName;
- this.lastName = lastName;
- this.email = email;
- this.birthDate = birthDate;
- this.nss = nss;
- this.dni = dni;
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public LocalDate getBirthDate() {
- return birthDate;
- }
-
- public void setBirthDate(LocalDate birthDate) {
- this.birthDate = birthDate;
- }
-
- public String getNss() {
- return nss;
- }
-
- public void setNss(String nss) {
- this.nss = nss;
- }
-
- public String getDni() {
- return dni;
- }
-
- public void setDni(String dni) {
- this.dni = dni;
- }
-
- public Direction getDirection() {
- return direction;
- }
-
- public void setDirection(Direction direction) {
- this.direction = direction;
- }
-
- @Override
- public String toString() {
- return "Employee{" +
- "id=" + id +
- ", firstName='" + firstName + '\'' +
- ", lastName='" + lastName + '\'' +
- ", email='" + email + '\'' +
- ", birthDate=" + birthDate +
- ", nss='" + nss + '\'' +
- ", dni='" + dni + '\'' +
- '}';
- }
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/entities/HairAssistance.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/entities/HairAssistance.java
deleted file mode 100644
index 1b1e09b..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/entities/HairAssistance.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.example.barbershop.entities;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-@Entity
-@Table(name = "hair_assistances")
-public class HairAssistance implements Serializable {
-
- // atributos
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
-
- private String name;
-
- private Double price;
-
- private Integer duration; // tiempo estimado en minutos
-
- public HairAssistance(){}
-
- public HairAssistance(Long id, String name, Double price, Integer duration) {
- this.id = id;
- this.name = name;
- this.price = price;
- this.duration = duration;
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Double getPrice() {
- return price;
- }
-
- public void setPrice(Double price) {
- this.price = price;
- }
-
- public Integer getDuration() {
- return duration;
- }
-
- public void setDuration(Integer duration) {
- this.duration = duration;
- }
-
- @Override
- public String toString() {
- return "HairAssistance{" +
- "id=" + id +
- ", name='" + name + '\'' +
- ", price=" + price +
- ", duration=" + duration +
- '}';
- }
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/repository/AppointmentRepository.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/repository/AppointmentRepository.java
deleted file mode 100644
index 1d6958a..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/repository/AppointmentRepository.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.example.barbershop.repository;
-
-import com.example.barbershop.entities.Appointment;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-import java.time.LocalDateTime;
-import java.util.List;
-
-@Repository
-public interface AppointmentRepository extends JpaRepository {
-
- List findAllByCustomerEmail(String email);
-
- List findAllByCustomerId(Long id);
-
- List findAllByDateBetween(LocalDateTime min, LocalDateTime max);
-
- List findAllByHairAssistanceId(Long id);
-
- List findAllByEmployeeId(Long id);
-
- List findAllByEmployeeDni(String dni);
-
- List findAllByHairAssistancePriceLessThanEqual(Double price);
-
- List findAllByIdNotInAndCustomerId(List ids, Long id);
-
-
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/repository/CustomerRepository.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/repository/CustomerRepository.java
deleted file mode 100644
index e4e9950..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/repository/CustomerRepository.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.example.barbershop.repository;
-
-import com.example.barbershop.entities.Customer;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface CustomerRepository extends JpaRepository {
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/repository/DirectionRepository.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/repository/DirectionRepository.java
deleted file mode 100644
index c39bce6..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/repository/DirectionRepository.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.example.barbershop.repository;
-
-import com.example.barbershop.entities.Direction;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface DirectionRepository extends JpaRepository {
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/repository/EmployeeRepository.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/repository/EmployeeRepository.java
deleted file mode 100644
index a541993..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/repository/EmployeeRepository.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.example.barbershop.repository;
-
-import com.example.barbershop.entities.Employee;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface EmployeeRepository extends JpaRepository {
-
- boolean existsByDirectionId(Long id);
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/repository/HairAssistanceRepository.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/repository/HairAssistanceRepository.java
deleted file mode 100644
index 4c269f6..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/repository/HairAssistanceRepository.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.example.barbershop.repository;
-
-import com.example.barbershop.entities.HairAssistance;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface HairAssistanceRepository extends JpaRepository {
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/AppointmentService.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/AppointmentService.java
deleted file mode 100644
index f62972e..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/AppointmentService.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.example.barbershop.service;
-
-import com.example.barbershop.entities.Appointment;
-
-import java.time.LocalDate;
-import java.time.Month;
-import java.util.List;
-import java.util.Optional;
-
-/**
- * CRUD: Create, Retrieve / Read, Update, Delete
- */
-public interface AppointmentService {
-
- Optional findById(Long id);
-
- List findAll();
-
- List findAllById(List ids);
-
- List findAllByCustomerId(Long id);
-
- List findAllByHairAssistanceId(Long id);
-
- List findAllByIdNotInAndCustomerId(List ids, Long id);
-
- List findAllByCustomerEmail(String customerEmail) throws IllegalArgumentException;
-
- List findAllByEmployeeId(Long id);
-
- List findAllByEmployeeDni(String dni);
-
- List findAllByPriceLessThanEqual(Double price);
-
- double calculateBenefitsByDate(LocalDate date);
-
- double calculateBenefitsByMonth(int year, Month month);
-
- double calculateBenefitsByYear(int year);
-
- Appointment save(Appointment appointment);
-
- List saveAll(List appointments);
-
- boolean deleteById(Long id);
-
- boolean deleteAll();
-
-
-
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/CustomerService.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/CustomerService.java
deleted file mode 100644
index 5588dbb..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/CustomerService.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.example.barbershop.service;
-
-import com.example.barbershop.entities.Customer;
-
-import java.util.List;
-import java.util.Optional;
-
-public interface CustomerService {
-
- Optional findById(Long id);
-
- List findAll();
-
- Customer save(Customer customer);
-
- boolean deleteById(Long id);
-
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/DirectionService.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/DirectionService.java
deleted file mode 100644
index b8ca2c1..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/DirectionService.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.example.barbershop.service;
-
-import com.example.barbershop.entities.Direction;
-
-import java.util.List;
-import java.util.Optional;
-
-public interface DirectionService {
-
- Optional findById(Long id);
-
- List findAll();
-
- Direction save(Direction direction);
-
- boolean deleteById(Long id);
-
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/EmployeeService.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/EmployeeService.java
deleted file mode 100644
index 4742b74..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/EmployeeService.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.example.barbershop.service;
-
-import com.example.barbershop.entities.Employee;
-
-import java.util.List;
-import java.util.Optional;
-
-public interface EmployeeService {
-
- Optional findById(Long id);
-
- List findAll();
-
- Employee save(Employee employee);
-
- boolean deleteById(Long id);
-
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/HairAssistanceService.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/HairAssistanceService.java
deleted file mode 100644
index 78fa76d..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/HairAssistanceService.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.example.barbershop.service;
-
-import com.example.barbershop.entities.HairAssistance;
-
-import java.util.List;
-import java.util.Optional;
-
-public interface HairAssistanceService {
-
- Optional findById(Long id);
-
- List findAll();
-
- HairAssistance save(HairAssistance hairAssistance);
-
- boolean deleteById(Long id);
-
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/impl/AppointmentServiceImpl.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/impl/AppointmentServiceImpl.java
deleted file mode 100644
index 4ffbfce..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/impl/AppointmentServiceImpl.java
+++ /dev/null
@@ -1,199 +0,0 @@
-package com.example.barbershop.service.impl;
-
-import com.example.barbershop.entities.Appointment;
-import com.example.barbershop.repository.AppointmentRepository;
-import com.example.barbershop.service.AppointmentService;
-import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.StringUtils;
-
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.Month;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-
-@Service
-public class AppointmentServiceImpl implements AppointmentService {
-
- private final AppointmentRepository appointmentRepository;
-
- public AppointmentServiceImpl(AppointmentRepository appointmentRepository) {
- this.appointmentRepository = appointmentRepository;
- }
-
- @Override
- public Optional findById(Long id) {
- if (id == null || id <= 0)
- return Optional.empty();
-
- return appointmentRepository.findById(id);
- }
-
- @Override
- public List findAll() {
- return appointmentRepository.findAll();
- }
-
- @Override
- public List findAllById(List ids) {
- if(CollectionUtils.isEmpty(ids))
- return new ArrayList<>();
-
- return appointmentRepository.findAllById(ids);
- }
-
- @Override
- public List findAllByCustomerId(Long id) {
- if(id == null || id <= 0)
- return new ArrayList<>();
-
- return appointmentRepository.findAllByCustomerId(id);
- }
-
- @Override
- public List findAllByHairAssistanceId(Long id) {
- if(id == null || id <= 0)
- return new ArrayList<>();
-
- return appointmentRepository.findAllByHairAssistanceId(id);
- }
-
- @Override
- public List findAllByIdNotInAndCustomerId(List ids, Long id) {
- if(id == null || id <= 0)
- return new ArrayList<>();
-
- if(ids == null)
- ids = new ArrayList<>();
-
- return appointmentRepository.findAllByIdNotInAndCustomerId(ids, id);
- }
-
-
- @Override
- public List findAllByCustomerEmail(String customerEmail) throws IllegalArgumentException {
-
- if (!StringUtils.hasLength(customerEmail) && !customerEmail.contains("@"))
- throw new IllegalArgumentException("Email incorrecto");
-
- return appointmentRepository.findAllByCustomerEmail(customerEmail);
- }
-
- @Override
- public List findAllByEmployeeId(Long id) {
- if(id == null || id <= 0)
- return new ArrayList<>();
-
- return appointmentRepository.findAllByEmployeeId(id);
- }
-
- @Override
- public List findAllByEmployeeDni(String dni) {
- if (!StringUtils.hasLength(dni))
- throw new IllegalArgumentException("DNI incorrecto");
-
- return appointmentRepository.findAllByEmployeeDni(dni);
- }
-
- @Override
- public List findAllByPriceLessThanEqual(Double price) {
- // Between
- // if (min == null || max == null || min <= 0 || max <= 0 || min >= max)
-
- if (price == null || price <= 0)
- throw new IllegalArgumentException("Precio incorrecto");
-
- return appointmentRepository.findAllByHairAssistancePriceLessThanEqual(price);
- }
-
- @Override
- public double calculateBenefitsByDate(LocalDate date) {
- if (date == null)
- return 0;
-
- LocalDateTime min = date.atTime(0,0);
- LocalDateTime max = date.atTime(23, 59);
-
-// double benefits = 0;
-// for (Appointment appointment : appointments) {
-// if (appointment.getHairAssistance() == null)
-// continue;
-//
-// benefits += appointment.getHairAssistance().getPrice();
-// }
-// return benefits;
- return extractBenefits(appointmentRepository.findAllByDateBetween(min, max));
- }
-
- @Override
- public double calculateBenefitsByMonth(int year, Month month) {
-
- LocalDateTime min = LocalDateTime.of(year, month, 1, 0, 0);
- LocalDateTime max = min.plusMonths(1);
-
- // Opción alternativa
- // LocalDateTime max = min.with(TemporalAdjusters.lastDayOfMonth()).withHour(23).withMinute(59);
-
- List appointments = appointmentRepository.findAllByDateBetween(min, max);
- return extractBenefits(appointments);
- }
-
-
-
- @Override
- public double calculateBenefitsByYear(int year) {
- LocalDateTime min = LocalDateTime.of(year, 1, 1, 0, 0);
- LocalDateTime max = min.plusYears(1);
-
- return extractBenefits(appointmentRepository.findAllByDateBetween(min, max));
- }
-
- @Override
- public Appointment save(Appointment appointment) {
- if(appointment == null || appointment.getDate() == null)
- throw new IllegalArgumentException("Cita incorrecta");
-
- return appointmentRepository.save(appointment);
- }
-
- @Override
- public List saveAll(List appointments) {
- if(!CollectionUtils.isEmpty(appointments))
- return appointmentRepository.saveAll(appointments);
-
- return new ArrayList<>();
- }
-
- @Override
- public boolean deleteById(Long id) {
- if(id == null || !appointmentRepository.existsById(id))
- return false;
-
- appointmentRepository.deleteById(id);
-
- return true;
- }
-
- @Override
- public boolean deleteAll() {
- appointmentRepository.deleteAll();
- return true;
- }
-
-
- /**
- * Extrae el precio cobrado por cada cita y los suma obteniendo así el beneficio total
- * Utiliza técnicas de programación funcional
- * @param appointments lista de citas o sesiones
- * @return beneficio total
- */
- private Double extractBenefits(List appointments) {
- return appointments.stream()
- .filter(a -> a.getHairAssistance() != null)
- .map(s -> s.getHairAssistance().getPrice())
- .reduce(Double::sum)
- .orElse(0d);
- }
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/impl/CustomerServiceImpl.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/impl/CustomerServiceImpl.java
deleted file mode 100644
index 0a18d3a..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/impl/CustomerServiceImpl.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.example.barbershop.service.impl;
-
-import com.example.barbershop.entities.Appointment;
-import com.example.barbershop.entities.Customer;
-import com.example.barbershop.repository.CustomerRepository;
-import com.example.barbershop.service.AppointmentService;
-import com.example.barbershop.service.CustomerService;
-import org.springframework.stereotype.Service;
-import org.springframework.util.StringUtils;
-
-import java.util.List;
-import java.util.Optional;
-
-@Service
-public class CustomerServiceImpl implements CustomerService {
-
- private final CustomerRepository customerRepository;
-
- private final AppointmentService appointmentService;
-
- public CustomerServiceImpl(CustomerRepository customerRepository,
- AppointmentService appointmentService) {
- this.customerRepository = customerRepository;
- this.appointmentService = appointmentService;
- }
-
- @Override
- public Optional findById(Long id) {
- if (id == null || id <= 0)
- return Optional.empty();
-
- return customerRepository.findById(id);
- }
-
- @Override
- public List findAll() {
- return customerRepository.findAll();
- }
-
- @Override
- public Customer save(Customer customer) {
- if(customer == null || !StringUtils.hasLength(customer.getEmail()))
- throw new IllegalArgumentException("Email de cliente incorrecto");
-
- // 1. Guardar customer
- Customer customerDB = customerRepository.save(customer);
-
- /* 2. Actualizar appointments asociados:
- si queremos que desde el controlador /api/customers se puedan
- asociar citas a un cliente de manera efectiva entonces hay que guardar
- desde el lado owner, es decir, las citas.
- */
-
- List ids = customer.getAppointments().stream().map(Appointment::getId).toList();
- List appointments = appointmentService.findAllById(ids);
- appointments.forEach(app -> app.setCustomer(customerDB));
- customerDB.setAppointments(appointmentService.saveAll(appointments));
-
- // Desasociar appointments que no vienen en el update:
- List appointmentsToUpdate = appointmentService.findAllByIdNotInAndCustomerId(ids, customerDB.getId());
- appointmentsToUpdate.forEach(app -> app.setCustomer(null));
- appointmentService.saveAll(appointmentsToUpdate);
-
- return customerDB;
- }
-
- @Override
- public boolean deleteById(Long id) {
- if(id == null || !customerRepository.existsById(id))
- return false;
-
- // desasociar citas antes de borrar el cliente
- List appointmentsToUpdate = appointmentService.findAllByCustomerId(id);
- appointmentsToUpdate.forEach(app -> app.setCustomer(null));
- appointmentService.saveAll(appointmentsToUpdate);
-
- customerRepository.deleteById(id);
-
- return true;
- }
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/impl/DirectionServiceImpl.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/impl/DirectionServiceImpl.java
deleted file mode 100644
index 797b27a..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/impl/DirectionServiceImpl.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.example.barbershop.service.impl;
-
-import com.example.barbershop.entities.Appointment;
-import com.example.barbershop.entities.Direction;
-import com.example.barbershop.repository.DirectionRepository;
-import com.example.barbershop.service.AppointmentService;
-import com.example.barbershop.service.DirectionService;
-import org.springframework.stereotype.Service;
-import org.springframework.util.StringUtils;
-
-import java.util.List;
-import java.util.Optional;
-
-@Service
-public class DirectionServiceImpl implements DirectionService {
-
- private final DirectionRepository directionRepository;
-
- private final AppointmentService appointmentService;
-
- public DirectionServiceImpl(DirectionRepository directionRepository,
- AppointmentService appointmentService) {
- this.directionRepository = directionRepository;
- this.appointmentService = appointmentService;
- }
-
- @Override
- public Optional findById(Long id) {
- if (id == null || id <= 0)
- return Optional.empty();
-
- return directionRepository.findById(id);
- }
-
- @Override
- public List findAll() {
- return directionRepository.findAll();
- }
-
- @Override
- public Direction save(Direction direction) {
- if(direction == null)
- throw new IllegalArgumentException("Argumento Direction incorrecto");
-
- return directionRepository.save(direction);
-
- }
-
- @Override
- public boolean deleteById(Long id) {
- if(id == null || !directionRepository.existsById(id))
- return false;
-
- directionRepository.deleteById(id);
-
- return true;
- }
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/impl/EmployeeServiceImpl.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/impl/EmployeeServiceImpl.java
deleted file mode 100644
index 1190108..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/impl/EmployeeServiceImpl.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package com.example.barbershop.service.impl;
-
-import com.example.barbershop.entities.Appointment;
-import com.example.barbershop.entities.Direction;
-import com.example.barbershop.entities.Employee;
-import com.example.barbershop.repository.EmployeeRepository;
-import com.example.barbershop.service.AppointmentService;
-import com.example.barbershop.service.DirectionService;
-import com.example.barbershop.service.EmployeeService;
-import org.springframework.stereotype.Service;
-import org.springframework.util.StringUtils;
-
-import java.util.List;
-import java.util.Optional;
-
-@Service
-public class EmployeeServiceImpl implements EmployeeService {
-
- private final EmployeeRepository employeeRepository;
- private final AppointmentService appointmentService;
- private final DirectionService directionService;
-
- public EmployeeServiceImpl(EmployeeRepository employeeRepository, AppointmentService appointmentService, DirectionService directionService) {
- this.employeeRepository = employeeRepository;
- this.appointmentService = appointmentService;
- this.directionService = directionService;
- }
-
- @Override
- public Optional findById(Long id) {
- if (id == null || id <= 0)
- return Optional.empty();
-
- return employeeRepository.findById(id);
- }
-
- @Override
- public List findAll() {
- return employeeRepository.findAll();
- }
-
- /**
- * Casuísticas:
- * 1. Crear un empleado sin dirección ✅
- * 2. Crear un empleado con nueva dirección sin id ✅
- * 3. Crear un empleado con direccion con id falso ✅
- * 4. Crear un empleado con dirección ya existente no ocupada ✅
- * 5. Crear un empleado con dirección ya existente pero sin los campos solo el id no ocupada ✅
- * 6. Crear un empleado con dirección ya existente sí ocupada ✅
- * @param employee
- * @return
- */
- @Override
- public Employee save(Employee employee) {
- if(employee == null || !StringUtils.hasLength(employee.getEmail()))
- throw new IllegalArgumentException("Email de empleado incorrecto");
-
- if (employee.getDirection() == null || employee.getDirection().getId() == null)
- return employeeRepository.save(employee);
-
- Optional directionOpt = directionService.findById(employee.getDirection().getId());
- if (directionOpt.isEmpty() || employeeRepository.existsByDirectionId(employee.getDirection().getId())){
- employee.setDirection(null);
- return employeeRepository.save(employee);
- }
-
- Direction direction = directionOpt.get();
- direction.setStreet(StringUtils.hasLength(employee.getDirection().getStreet()) ? employee.getDirection().getStreet() : direction.getStreet());
- direction.setPostalCode(StringUtils.hasLength(employee.getDirection().getPostalCode()) ? employee.getDirection().getPostalCode() : direction.getPostalCode());
- direction.setCountry(StringUtils.hasLength(employee.getDirection().getCountry()) ? employee.getDirection().getCountry() : direction.getCountry());
- employee.setDirection(direction);
- return employeeRepository.save(employee);
- }
-
- @Override
- public boolean deleteById(Long id) {
- if(id == null || !employeeRepository.existsById(id))
- return false;
-
- // desasociar citas antes de borrar el empleado
- List appointmentsToUpdate = appointmentService.findAllByEmployeeId(id);
- appointmentsToUpdate.forEach(app -> app.setEmployee(null));
- appointmentService.saveAll(appointmentsToUpdate);
-
- employeeRepository.deleteById(id);
-
- return true;
- }
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/impl/HairAssistanceServiceImpl.java b/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/impl/HairAssistanceServiceImpl.java
deleted file mode 100644
index 10a85af..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/java/com/example/barbershop/service/impl/HairAssistanceServiceImpl.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.example.barbershop.service.impl;
-
-import com.example.barbershop.entities.Appointment;
-import com.example.barbershop.entities.HairAssistance;
-import com.example.barbershop.repository.HairAssistanceRepository;
-import com.example.barbershop.service.AppointmentService;
-import com.example.barbershop.service.HairAssistanceService;
-import org.springframework.stereotype.Service;
-import org.springframework.util.StringUtils;
-
-import java.util.List;
-import java.util.Optional;
-
-@Service
-public class HairAssistanceServiceImpl implements HairAssistanceService {
-
- private final HairAssistanceRepository hairAssistanceRepository;
- private final AppointmentService appointmentService;
-
- public HairAssistanceServiceImpl(HairAssistanceRepository hairAssistanceRepository, AppointmentService appointmentService) {
- this.hairAssistanceRepository = hairAssistanceRepository;
- this.appointmentService = appointmentService;
- }
-
- @Override
- public Optional findById(Long id) {
- if (id == null || id <= 0)
- return Optional.empty();
-
- return hairAssistanceRepository.findById(id);
- }
-
- @Override
- public List findAll() {
- return hairAssistanceRepository.findAll();
- }
-
- @Override
- public HairAssistance save(HairAssistance hairAssistance) {
- if(hairAssistance == null)
- throw new IllegalArgumentException("Servicio incorrecto");
-
- return hairAssistanceRepository.save(hairAssistance);
- }
-
- @Override
- public boolean deleteById(Long id) {
- if(id == null || !hairAssistanceRepository.existsById(id))
- return false;
-
- // desasociar citas antes de borrar el servicio de corte de pelo (Hair assistance)
- List appointmentsToUpdate = appointmentService.findAllByHairAssistanceId(id);
- appointmentsToUpdate.forEach(app -> app.setHairAssistance(null));
- appointmentService.saveAll(appointmentsToUpdate);
-
- hairAssistanceRepository.deleteById(id);
-
- return true;
- }
-}
diff --git a/tutoria_13_01_2021/barbershop/src/main/resources/application.properties b/tutoria_13_01_2021/barbershop/src/main/resources/application.properties
deleted file mode 100644
index a93d546..0000000
--- a/tutoria_13_01_2021/barbershop/src/main/resources/application.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-spring.datasource.url=jdbc:postgresql://localhost:5432/barbershop
-spring.datasource.username=postgres
-spring.datasource.password=admin
-spring.datasource.driver-class-name=org.postgresql.Driver
-spring.jpa.show-sql=true
-spring.jpa.hibernate.ddl-auto=create
-spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
-server.port=8081
-#spring.sql.init.mode=always
-spring.jpa.defer-datasource-initialization=true
diff --git a/tutoria_13_01_2021/barbershop/src/test/java/com/example/barbershop/BarbershopApplicationTests.java b/tutoria_13_01_2021/barbershop/src/test/java/com/example/barbershop/BarbershopApplicationTests.java
deleted file mode 100644
index d8cfd71..0000000
--- a/tutoria_13_01_2021/barbershop/src/test/java/com/example/barbershop/BarbershopApplicationTests.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.example.barbershop;
-
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-@SpringBootTest
-class BarbershopApplicationTests {
-
- @Test
- void contextLoads() {
- }
-
-}