Commit c3d43574 authored by Sumaiyya Burney's avatar Sumaiyya Burney

Adds Product model/controller/repo/service skeletons

parent e7eb18d4
package controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import service.ProductService;
@RestController
public class ProductController {
@Autowired
ProductService productService;
}
package model;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
@Getter
@Setter
@Document
public class Product {
@Id
private String id;
@Indexed(unique=true)
private String sku;
private String upc;
private String prodName;
private String prodDesc;
private float price;
private int availableStock;
private int blockedStock;
private String prodImgUrl;
private String brand;
private String category;
public Product(String sku, String upc, String prodName, String prodDesc, float price, int availableStock,
String prodImgUrl, String brand, String category) {
this.sku = sku;
this.upc = upc;
this.prodName = prodName;
this.prodDesc = prodDesc;
this.price = price;
this.availableStock = availableStock;
this.blockedStock = 0;
this.prodImgUrl = prodImgUrl;
this.brand = brand;
this.category = category;
}
}
package repository;
import model.Product;
import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface ProductRepository extends ReactiveMongoRepository<Product, String> {
}
package service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import repository.ProductRepository;
@Service
public class ProductService {
@Autowired
ProductRepository productRepository;
}
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