Skip to content

Commit

Permalink
Added crossorigins
Browse files Browse the repository at this point in the history
  • Loading branch information
victorgrubio committed Aug 12, 2020
1 parent de26bb6 commit 7bffa06
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions scripts/02-create-products.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ USE `heroku_c0edb524a9c3c7d` ;
-- -----------------------------------------------------
-- Table `full-stack-ecommerce`.`product_category`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `heroku_c0edb524a9c3c7d`.`product_category` (
CREATE TABLE IF NOT EXISTS `mpvmweiv00pv3pt2`.`product_category` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`category_name` VARCHAR(255) NULL DEFAULT NULL,
PRIMARY KEY (`id`))
Expand All @@ -19,7 +19,7 @@ AUTO_INCREMENT = 1;
-- -----------------------------------------------------
-- Table `full-stack-ecommerce`.`product`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `heroku_c0edb524a9c3c7d`.`product` (
CREATE TABLE IF NOT EXISTS `mpvmweiv00pv3pt2`.`product` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`sku` VARCHAR(255) DEFAULT NULL,
`name` VARCHAR(255) DEFAULT NULL,
Expand Down
9 changes: 3 additions & 6 deletions scripts/03-refresh-database-with-100-products.sql
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
-- -----------------------------------------------------
-- Schema full-stack-ecommerce
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `full-stack-ecommerce`;

CREATE SCHEMA `full-stack-ecommerce`;
USE `full-stack-ecommerce` ;
USE `mpvmweiv00pv3pt2` ;

-- -----------------------------------------------------
-- Table `full-stack-ecommerce`.`product_category`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `full-stack-ecommerce`.`product_category` (
CREATE TABLE IF NOT EXISTS `mpvmweiv00pv3pt2`.`product_category` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`category_name` VARCHAR(255) NULL DEFAULT NULL,
PRIMARY KEY (`id`))
Expand All @@ -19,7 +16,7 @@ AUTO_INCREMENT = 1;
-- -----------------------------------------------------
-- Table `full-stack-ecommerce`.`product`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `full-stack-ecommerce`.`product` (
CREATE TABLE IF NOT EXISTS `mpvmweiv00pv3pt2`.`product` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`sku` VARCHAR(255) DEFAULT NULL,
`name` VARCHAR(255) DEFAULT NULL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.web.bind.annotation.CrossOrigin;

@CrossOrigin("http://localhost:4200")
@CrossOrigin(origins = {"https://ecommerce-app.victorgarciarubio.com", "https://frontend-ecommerce-angular.vercel.app"})
@RepositoryRestResource(collectionResourceRel = "countries", path="countries")
public interface CountryRepository extends JpaRepository<Country, Integer>{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.web.bind.annotation.CrossOrigin;

@CrossOrigin("http://localhost:4200")
@CrossOrigin(origins = {"https://ecommerce-app.victorgarciarubio.com", "https://frontend-ecommerce-angular.vercel.app"})
@RepositoryRestResource(collectionResourceRel = "productCategory", path = "product-category")
public interface ProductCategoryRepository extends JpaRepository<ProductCategory, Long>{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestParam;
@CrossOrigin("http://localhost:4200")
@CrossOrigin(origins = {"https://ecommerce-app.victorgarciarubio.com", "https://frontend-ecommerce-angular.vercel.app"})
@RepositoryRestResource(collectionResourceRel = "products", path = "products")
public interface ProductRepository extends JpaRepository<Product, Long>{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.web.bind.annotation.CrossOrigin;

@CrossOrigin("http://localhost:4200")
@CrossOrigin(origins = {"https://ecommerce-app.victorgarciarubio.com", "https://frontend-ecommerce-angular.vercel.app"})
@RepositoryRestResource(collectionResourceRel = "states", path="states")
public interface StateRepository extends JpaRepository<State, Integer>{

Expand Down

0 comments on commit 7bffa06

Please sign in to comment.