Commit 448064c7 authored by Ben Anderson's avatar Ben Anderson

Integrated secrets.propeties into application.properties and resolved project structure isssues

parent 1270fc1d
......@@ -6,7 +6,7 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.5</version>
<relativePath/> <!-- lookup parent from repository -->
<relativePath/> <!-- lookup parent from com.nisum.ascend.inventory.repository -->
</parent>
<groupId>com.nisum.ascend</groupId>
<artifactId>inventory</artifactId>
......
package controller;
package com.nisum.ascend.inventory.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import service.ProductService;
import com.nisum.ascend.inventory.service.ProductService;
@RestController
public class ProductController {
......
package dto;
package com.nisum.ascend.inventory.dto;
import lombok.AllArgsConstructor;
import lombok.Getter;
import model.Product;
import com.nisum.ascend.inventory.model.Product;
@Getter
@AllArgsConstructor
......@@ -20,7 +20,7 @@ public class ProductDto {
public static ProductDto generateDtoFromProduct(Product product) {
// TODO: Fetch the product's promotion from the Promotions service
// TODO: Fetch the product's promotion from the Promotions com.nisum.ascend.inventory.service
PromotionDto promotion = new PromotionDto();
return new ProductDto(product.getSku(), product.getUpc(), product.getProdName(), product.getProdDesc(), product.getPrice(), product.getProdImgUrl(), product.getBrand(), product.getCategory(), product.getAvailableStock(), promotion);
......
package dto;
package com.nisum.ascend.inventory.dto;
import lombok.AllArgsConstructor;
import lombok.Getter;
......
package model;
package com.nisum.ascend.inventory.model;
import lombok.Getter;
import lombok.Setter;
......
package repository;
package com.nisum.ascend.inventory.repository;
import model.Product;
import com.nisum.ascend.inventory.model.Product;
import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
import org.springframework.stereotype.Repository;
......
package service;
package com.nisum.ascend.inventory.service;
import dto.ProductDto;
import com.nisum.ascend.inventory.dto.ProductDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Flux;
import repository.ProductRepository;
import com.nisum.ascend.inventory.repository.ProductRepository;
@Service
public class ProductService {
@Autowired
ProductRepository productRepository;
public Flux<ProductDto> testDto() {
return productRepository.findAll()
.map(ProductDto::generateDtoFromProduct)
.flatMap(Flux::just);
}
}
spring.config.import=classpath:secret.properties
server.port=8080
spring.data.mongodb.uri=mongodb+srv://admin:${db.password}@inventory-promotions.d4nfz.mongodb\
.net/${spring.data.mongodb.database}?retryWrites=true&w=majority
spring.data.mongodb.database=products-promotions-db
spring.data.mongodb.database=products-promotions-DB
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment