diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c3f32f9..2472bc8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,11 +5,21 @@ "dockerComposeFile": "docker-compose.yml", "service": "app", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + "forwardPorts": [4200, 8090 ,5432], "features": { "ghcr.io/devcontainers/features/node:1": {}, "ghcr.io/devcontainers-contrib/features/angular-cli:2": {} + + }, + //"customizations": { + //"vscode": { + //"extensions": [ + //"vscjava.vscode-java-pack" + // Puedes añadir más extensiones si es necesario, separándolas por comas + // ] + //} + //} - } // Features to add to the dev container. More info: https://containers.dev/features. // "features": {} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 5d29116..c2c7524 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -43,7 +43,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -54,7 +54,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v2 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -68,4 +68,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 diff --git a/clientes-app/angular.json b/clientes-app/angular.json index 7513ce1..7f0485e 100644 --- a/clientes-app/angular.json +++ b/clientes-app/angular.json @@ -63,6 +63,28 @@ "extractLicenses": false, "sourceMap": true, "namedChunks": true + }, + "codespace": { + "buildOptimizer": false, + "optimization": false, + "vendorChunk": true, + "extractLicenses": false, + "sourceMap": true, + "namedChunks": true, + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.codespace.ts" + } + ] + }, + "staging": { + "buildOptimizer": false, + "optimization": false, + "vendorChunk": true, + "extractLicenses": false, + "sourceMap": true, + "namedChunks": true } }, "defaultConfiguration": "production" @@ -75,6 +97,12 @@ }, "development": { "browserTarget": "clientes-app:build:development" + }, + "codespace": { + "browserTarget": "clientes-app:build:codespace" + }, + "staging": { + "browserTarget": "clientes-app:build:staging" } }, "defaultConfiguration": "development" diff --git a/clientes-app/src/app/altapersona/altapersona.service.ts b/clientes-app/src/app/altapersona/altapersona.service.ts index bf7c041..2eac842 100644 --- a/clientes-app/src/app/altapersona/altapersona.service.ts +++ b/clientes-app/src/app/altapersona/altapersona.service.ts @@ -1,8 +1,8 @@ -import { AltaPersona } from './altapersona.model'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable, OnInit } from "@angular/core"; import { Observable } from "rxjs"; import { Usuario } from "../login/usuario.model"; +import { AltaPersona } from './altapersona.model'; @Injectable({ providedIn: "root" @@ -11,7 +11,7 @@ export class AltaPersonaService implements OnInit{ private altaPersona: AltaPersona; private httpHeaders = new HttpHeaders({ 'Content-Type': 'application/json' }); - private urlAltaCliente="http://localhost:8090/api/personas/crea-cliente" + private urlAltaCliente="http://https://psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev/api/personas/crea-cliente" constructor(private httpClient: HttpClient){} ngOnInit(): void { diff --git a/clientes-app/src/app/app.component.ts b/clientes-app/src/app/app.component.ts index a19a5a2..727be62 100644 --- a/clientes-app/src/app/app.component.ts +++ b/clientes-app/src/app/app.component.ts @@ -1,4 +1,5 @@ import { Component } from '@angular/core'; +import { environment } from './../environments/environment'; @Component({ selector: 'app-root', @@ -6,8 +7,13 @@ import { Component } from '@angular/core'; styleUrls: ['./app.component.css'] }) export class AppComponent { + constructor() { + console.log(environment.production); + console.log(environment.backEndURL); + + } + title = 'EN CONSTRUCCIÓN'; - nombre_tienda: string = 'CHRISTMASZOM' autor: string = 'Rubén Puig Moreno' } diff --git a/clientes-app/src/app/cesta/cesta.component.ts b/clientes-app/src/app/cesta/cesta.component.ts index d795a1e..a872f28 100644 --- a/clientes-app/src/app/cesta/cesta.component.ts +++ b/clientes-app/src/app/cesta/cesta.component.ts @@ -1,14 +1,14 @@ -import { ProductoCantidad } from './productoCantidad.model'; -import { ProductosPedido } from './../pedido/ProductosPedido'; -import { ProductoService } from './../producto/producto.service'; -import { PersonaServices } from './../persona/persona.service'; -import { CestaService } from './cesta.service'; -import { ActivatedRoute, Router } from '@angular/router'; import { Component, OnInit } from '@angular/core'; -import { Cesta } from './cesta.model'; -import { Producto } from '../producto/producto.model'; +import { ActivatedRoute, Router } from '@angular/router'; import { Pedido } from '../pedido/pedido.model'; import { PedidoService } from '../pedido/pedido.service'; +import { Producto } from '../producto/producto.model'; +import { ProductosPedido } from './../pedido/ProductosPedido'; +import { PersonaServices } from './../persona/persona.service'; +import { ProductoService } from './../producto/producto.service'; +import { Cesta } from './cesta.model'; +import { CestaService } from './cesta.service'; +import { ProductoCantidad } from './productoCantidad.model'; @Component({ selector: 'app-cesta', @@ -58,7 +58,7 @@ export class CestaComponent implements OnInit { this.total + producto.precio * this.cesta.productoCantidad[index].cantidad; producto.productoCaracteristicas.imagenesProducto[0].imagen = - 'http://localhost:8090/api/productos/producto/imagen/' + + 'http://https://psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev/api/productos/producto/imagen/' + item.productoCaracteristicas?.imagenesProducto[0]?.imagen; this.productos.push(item); console.log('itemnombre ' + item.nombre); diff --git a/clientes-app/src/app/cesta/cesta.service.ts b/clientes-app/src/app/cesta/cesta.service.ts index b885979..b3c5b75 100644 --- a/clientes-app/src/app/cesta/cesta.service.ts +++ b/clientes-app/src/app/cesta/cesta.service.ts @@ -1,12 +1,12 @@ -import { ProductoCantidad } from './productoCantidad.model'; -import { ProductoService } from './../producto/producto.service'; -import { PersonaServices } from './../persona/persona.service'; import { HttpClient, HttpHeaders } from '@angular/common/http'; -import { Observable, throwError } from 'rxjs'; import { Injectable, OnInit } from '@angular/core'; -import { Cesta } from './cesta.model'; -import { catchError, map } from 'rxjs/operators'; +import { Observable, throwError } from 'rxjs'; +import { catchError } from 'rxjs/operators'; import swal from 'sweetalert2'; +import { PersonaServices } from './../persona/persona.service'; +import { ProductoService } from './../producto/producto.service'; +import { Cesta } from './cesta.model'; +import { ProductoCantidad } from './productoCantidad.model'; @Injectable({ providedIn: 'root', @@ -14,11 +14,11 @@ import swal from 'sweetalert2'; export class CestaService implements OnInit { private httpHeaders = new HttpHeaders({ 'Content-Type': 'application/json' }); private urlRecuperaCesta: string = - 'http://localhost:8090/api/productos/cesta/recupera-cesta'; + 'http://https://psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev/api/productos/cesta/recupera-cesta'; private urlIncluye: string = - 'http://localhost:8090/api/productos/cesta/actualiza-cesta'; + 'http://https://psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev/api/productos/cesta/actualiza-cesta'; private urlElimina: string = - 'http://localhost:8090/api/productos/cesta/elimina-cesta'; + 'http://https://psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev/api/productos/cesta/elimina-cesta'; constructor( private httpClient: HttpClient, diff --git a/clientes-app/src/app/detalleproducto/detalleproducto.component.html b/clientes-app/src/app/detalleproducto/detalleproducto.component.html index 1bb1bdb..af7eedd 100644 --- a/clientes-app/src/app/detalleproducto/detalleproducto.component.html +++ b/clientes-app/src/app/detalleproducto/detalleproducto.component.html @@ -12,7 +12,7 @@ > { this.producto = producto; this.imagenPrincipal = - 'http://localhost:8090/api/productos/producto/imagen/' + + 'http://https://psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev/api/productos/producto/imagen/' + this.producto?.productoCaracteristicas.imagenesProducto[0].imagen; }); } diff --git a/clientes-app/src/app/empleados/empleado.service.ts b/clientes-app/src/app/empleados/empleado.service.ts index 3b3fa31..07e40f6 100644 --- a/clientes-app/src/app/empleados/empleado.service.ts +++ b/clientes-app/src/app/empleados/empleado.service.ts @@ -1,12 +1,10 @@ -import { catchError } from 'rxjs/operators'; -import { PersonaServices } from './../persona/persona.service'; import { HttpClient, HttpHeaders } from '@angular/common/http'; -import { Observable, throwError } from 'rxjs'; -import { Injectable, Input } from '@angular/core'; +import { Injectable } from '@angular/core'; import { Router } from '@angular/router'; +import { Observable } from 'rxjs'; import { Usuario } from '../login/usuario.model'; import { ProductoService } from '../producto/producto.service'; -import swal from 'sweetalert2'; +import { PersonaServices } from './../persona/persona.service'; @Injectable({ providedIn: 'root' @@ -16,8 +14,8 @@ export class EmpleadoService{ private httpHeaders = new HttpHeaders({ 'Content-Type': 'application/json' }); - private urlUsuarioActualizar="http://localhost:8090/api/personas/actualiza-usuario" - private urlUsuarioPorUsername="http://localhost:8090/api/personas/usuarios/search/buscar-username?username=" + private urlUsuarioActualizar="http://https://psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev/api/personas/actualiza-usuario" + private urlUsuarioPorUsername="http://https://psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev/api/personas/usuarios/search/buscar-username?username=" constructor(private httpClient:HttpClient, private router: Router, private productoService: ProductoService, private personaServices: PersonaServices){} diff --git a/clientes-app/src/app/pedido/pedido.service.ts b/clientes-app/src/app/pedido/pedido.service.ts index 35a6f60..2676870 100644 --- a/clientes-app/src/app/pedido/pedido.service.ts +++ b/clientes-app/src/app/pedido/pedido.service.ts @@ -13,17 +13,17 @@ import { Pedido } from './pedido.model'; }) export class PedidoService { private urlProductosLista: string = - 'http://localhost:8090/api/productos/lista'; + 'http://https://psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev/api/productos/lista'; private urlActualizaPedido: string = - 'http://localhost:8090/api/productos/pedidos/actualiza-pedido'; + 'http://https://psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev/api/productos/pedidos/actualiza-pedido'; private urlRecuperaPedido: string = - 'http://localhost:8090/api/productos/pedidos/recupera-pedido'; + 'http://https://psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev/api/productos/pedidos/recupera-pedido'; private urlRecuperaPedidoIdUsuario: string = - 'http://localhost:8090/api/productos/pedidos/recupera-pedidos-usuario'; + 'http://https://psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev/api/productos/pedidos/recupera-pedidos-usuario'; private urlRecuperaPedidos: string = - 'http://localhost:8090/api/productos/pedidos/lista'; + 'http://https://psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev/api/productos/pedidos/lista'; private urlEliminaPedido: string = - 'http://localhost:8090/api/productos/pedidos/borra-pedido'; + 'http://https://psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev/api/productos/pedidos/borra-pedido'; private httpHeaders = new HttpHeaders({ 'Content-Type': 'application/json' }); diff --git a/clientes-app/src/app/persona/persona.service.ts b/clientes-app/src/app/persona/persona.service.ts index 0dd68c4..722fd88 100644 --- a/clientes-app/src/app/persona/persona.service.ts +++ b/clientes-app/src/app/persona/persona.service.ts @@ -1,8 +1,7 @@ -import { Usuario } from './../login/usuario.model'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable, OnInit } from '@angular/core'; import { Observable } from 'rxjs'; -import { Persona } from './persona.model'; +import { Usuario } from './../login/usuario.model'; @Injectable({ providedIn: 'root', @@ -10,8 +9,8 @@ import { Persona } from './persona.model'; export class PersonaServices implements OnInit { private _usuario: Usuario; private _token: any; - urlToken: string = 'http://localhost:8090/api/security/oauth/token'; - private httpHeaders = new HttpHeaders({ 'Content-Type': 'application/json' }); + urlToken: string = 'http://https://psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev/api/security/oauth/token'; + private httpHeaders = new HttpHeaders({ 'Content-Type': 'application/json', 'X-Github-Token':'ghu_CPMN4vJ3Tl4E6OlhqVXd3cSOwvvQWW4HIwib' }); constructor(private httpClient: HttpClient) {} @@ -20,7 +19,7 @@ export class PersonaServices implements OnInit { } login(usuario: Usuario): Observable { - const urlEndpoint = 'http://localhost:8090/api/security/oauth/token'; + const urlEndpoint = 'http://https://psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev/api/security/oauth/token'; const credenciales = btoa('frontendapp' + ':' + '12345'); diff --git a/clientes-app/src/app/producto-cesta/producto-cesta.component.ts b/clientes-app/src/app/producto-cesta/producto-cesta.component.ts index 96bf432..ab49624 100644 --- a/clientes-app/src/app/producto-cesta/producto-cesta.component.ts +++ b/clientes-app/src/app/producto-cesta/producto-cesta.component.ts @@ -36,7 +36,7 @@ export class ProductoCestaComponent implements OnInit { getImagenEscaparate(): void { if (this.producto?.productoCaracteristicas?.imagenesProducto?.length > 0) this.imagenEscaparate = - 'http://localhost:8090/api/productos/producto/imagen/' + + 'http://https://psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev/api/productos/producto/imagen/' + this.producto.productoCaracteristicas.imagenesProducto[0].imagen; } diff --git a/clientes-app/src/app/producto-item/producto-item.component.html b/clientes-app/src/app/producto-item/producto-item.component.html index 58a5571..9af8d26 100644 --- a/clientes-app/src/app/producto-item/producto-item.component.html +++ b/clientes-app/src/app/producto-item/producto-item.component.html @@ -58,7 +58,7 @@ >
0) this.imagenEscaparate = - 'http://localhost:8090/api/productos/producto/imagen/' + + 'http://https://psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev/api/productos/producto/imagen/' + this.producto.productoCaracteristicas.imagenesProducto[0].imagen; } diff --git a/clientes-app/src/app/producto/producto.service.ts b/clientes-app/src/app/producto/producto.service.ts index 80279bd..f896016 100644 --- a/clientes-app/src/app/producto/producto.service.ts +++ b/clientes-app/src/app/producto/producto.service.ts @@ -1,12 +1,13 @@ -import { PersonaServices } from './../persona/persona.service'; -import { Router } from '@angular/router'; -import { Observable, of, throwError } from 'rxjs'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { Producto } from './producto.model'; -import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http'; -import { catchError, map, switchAll } from 'rxjs/operators'; +import { Router } from '@angular/router'; +import { Observable, throwError } from 'rxjs'; +import { catchError, map } from 'rxjs/operators'; +import { environment } from 'src/environments/environment'; import swal from 'sweetalert2'; import { Tienda } from '../configuracion/tienda.model'; +import { PersonaServices } from './../persona/persona.service'; +import { Producto } from './producto.model'; @Injectable({ providedIn: 'root' }) export class ServiceNameService { @@ -17,21 +18,18 @@ export class ServiceNameService { providedIn: 'root', }) export class ProductoService { - private urlProductosLista: string = - 'http://localhost:8090/api/productos/lista'; - private urlProductoNuevo: string = - 'http://localhost:8090/api/productos/producto/nuevo'; - private urlEndPoint: string = 'http://localhost:8090/api/productos/producto'; - private urlEliminarProducto: string = - 'http://localhost:8090/api/productos/producto/borrar'; - private urlEliminarImagen: string = - 'http://localhost:8090/api/productos/producto/borrar-imagen'; - private urlCambiarNombre: string = - 'http://localhost:8090/api/productos/tienda/cambia-tienda'; - private urlNombre: string = - 'http://localhost:8090/api/productos/tienda/nombre'; - - private httpHeaders = new HttpHeaders({ 'Content-Type': 'application/json' }); + + // private urlRoot: string = '//psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev' + private urlRoot= environment.backEndURL; + private urlProductosLista: string = this.urlRoot + '/api/productos/lista'; + private urlProductoNuevo: string = this.urlRoot + '/api/productos/producto/nuevo'; + private urlEndPoint: string = this.urlRoot + '/api/productos/producto'; + private urlEliminarProducto: string = this.urlRoot + '/api/productos/producto/borrar'; + private urlEliminarImagen: string = this.urlRoot + '/api/productos/producto/borrar-imagen'; + private urlCambiarNombre: string = this.urlRoot + '/api/productos/tienda/cambia-tienda'; + private urlNombre: string = this.urlRoot + '/api/productos/tienda/nombre'; + + private httpHeaders = new HttpHeaders({ 'Content-Type': 'application/json'}); busqueda: string; diff --git a/clientes-app/src/environments/environment.codespace.ts b/clientes-app/src/environments/environment.codespace.ts new file mode 100644 index 0000000..b9bbd56 --- /dev/null +++ b/clientes-app/src/environments/environment.codespace.ts @@ -0,0 +1,4 @@ +export const environment = { + production: false, + backEndURL: '//psychic-succotash-5x944xv45qjh4wxr-8090.app.github.dev' + }; \ No newline at end of file diff --git a/clientes-app/src/environments/environment.development.ts b/clientes-app/src/environments/environment.development.ts new file mode 100644 index 0000000..91802b7 --- /dev/null +++ b/clientes-app/src/environments/environment.development.ts @@ -0,0 +1,4 @@ +export const environment = { + production: false, + backEndURL: '//localhost:8090' + }; \ No newline at end of file diff --git a/clientes-app/src/environments/environment.prod.ts b/clientes-app/src/environments/environment.prod.ts index 3612073..a00e1c9 100644 --- a/clientes-app/src/environments/environment.prod.ts +++ b/clientes-app/src/environments/environment.prod.ts @@ -1,3 +1,4 @@ export const environment = { - production: true + production: true, + backEndURL: '//localhost:8090' }; diff --git a/clientes-app/src/environments/environment.ts b/clientes-app/src/environments/environment.ts index f56ff47..b9f7252 100644 --- a/clientes-app/src/environments/environment.ts +++ b/clientes-app/src/environments/environment.ts @@ -3,7 +3,8 @@ // The list of file replacements can be found in `angular.json`. export const environment = { - production: false + production: false, + backEndURL: '//localhost:8090' }; /*