removing Customer2

This commit is contained in:
Ulisses Lima 2022-06-19 16:35:36 -03:00
parent e0a7591f9d
commit 3ae97db187
3 changed files with 0 additions and 65 deletions

View File

@ -1,8 +0,0 @@
package com.baeldung.boot.unique.field.dao;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.baeldung.boot.unique.field.data.Customer2;
public interface Customer2Repository extends MongoRepository<Customer2, Long> {
}

View File

@ -1,47 +0,0 @@
package com.baeldung.boot.unique.field.data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.mapping.Document;
@Document
@CompoundIndex(def = "{ 'storeId': 1, 'number': 1 }", unique = true)
public class Customer2 {
@Id
private Long storeId;
private Long number;
private String name;
public Customer2() {
}
public Customer2(String name) {
this.name = name;
}
public Long getStoreId() {
return storeId;
}
public void setStoreId(Long storeId) {
this.storeId = storeId;
}
public Long getNumber() {
return number;
}
public void setNumber(Long number) {
this.number = number;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@ -13,13 +13,11 @@ import org.springframework.web.bind.annotation.RestController;
import com.baeldung.boot.unique.field.dao.AssetRepository;
import com.baeldung.boot.unique.field.dao.CompanyRepository;
import com.baeldung.boot.unique.field.dao.Customer2Repository;
import com.baeldung.boot.unique.field.dao.CustomerRepository;
import com.baeldung.boot.unique.field.dao.SaleRepository;
import com.baeldung.boot.unique.field.data.Asset;
import com.baeldung.boot.unique.field.data.Company;
import com.baeldung.boot.unique.field.data.Customer;
import com.baeldung.boot.unique.field.data.Customer2;
import com.baeldung.boot.unique.field.data.Sale;
import com.baeldung.boot.unique.field.data.SaleId;
@ -35,9 +33,6 @@ public class UniqueFieldController {
@Autowired
private CustomerRepository customerRepo;
@Autowired
private Customer2Repository customer2Repo;
@Autowired
private AssetRepository assetRepo;
@ -71,11 +66,6 @@ public class UniqueFieldController {
return customerRepo.insert(customer);
}
@PostMapping("/customer2")
public Customer2 post(@RequestBody Customer2 customer) {
return customer2Repo.insert(customer);
}
@GetMapping("/customer/{id}")
public Optional<Customer> getCustomer(@PathVariable String id) {
return customerRepo.findById(id);