Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…va/workshopb2-group-4

# Conflicts:
#	kbazaar/src/main/java/com/kampus/kbazaar/cart/Cart.java
  • Loading branch information
patntp committed Mar 31, 2024
2 parents 392ac83 + e77ea53 commit 79e3065
Show file tree
Hide file tree
Showing 45 changed files with 1,702 additions and 1,630 deletions.
2 changes: 1 addition & 1 deletion infra/gitops/dev/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
spec:
containers:
- name: kbazaar-api
image: ghcr.io/kbtg-kampus-classnest-se-java/workshopb2-group-4:02b564fd4756157c7ca83761b863e2cfc16e0726
image: ghcr.io/kbtg-kampus-classnest-se-java/workshopb2-group-4:9c5aa03f180dd688190dc1cd8363acf36f0ebaf1
imagePullPolicy: Always
ports:
- containerPort: 8080
Expand Down
11 changes: 0 additions & 11 deletions kbazaar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@ jacocoTestReport {
}
}

spotless {
java {
importOrder()
removeUnusedImports()
googleJavaFormat().aosp()
trimTrailingWhitespace()
formatAnnotations()
endWithNewline()
}
}

group = 'com.kampus'
version = '0.0.1-SNAPSHOT'

Expand Down
3 changes: 3 additions & 0 deletions kbazaar/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ docker-build:

docker-run:
docker run -p 8080:8080 kbazaar

# test commit spotlessApply
# test commit spotlessApply
24 changes: 12 additions & 12 deletions kbazaar/src/main/java/com/kampus/kbazaar/KBazaarApplication.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.kampus.kbazaar;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class KBazaarApplication {

public static void main(String[] args) {
SpringApplication.run(KBazaarApplication.class, args);
}
}
package com.kampus.kbazaar;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class KBazaarApplication {

public static void main(String[] args) {
SpringApplication.run(KBazaarApplication.class, args);
}
}
2 changes: 1 addition & 1 deletion kbazaar/src/main/java/com/kampus/kbazaar/cart/Cart.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class Cart {
private String promotionCodes;

@Description("precisely reflect its pre-discount status")
@Column(name = "subtotal")
@Column(name = "sub_total")
private BigDecimal subtotal;

@Description("the final, all-inclusive amount to be paid.")
Expand Down
15 changes: 13 additions & 2 deletions kbazaar/src/main/java/com/kampus/kbazaar/cart/CartController.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
package com.kampus.kbazaar.cart;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/v1")
public class CartController {

private CartService cartService;

public CartController(CartService cartService) {
this.cartService = cartService;
}

@GetMapping("/carts")
public ResponseEntity getCart() { // NOSONAR
return ResponseEntity.ok().build();
public ResponseEntity<List<CartResponse>> getCart() { // NOSONAR
// return ResponseEntity.ok().build();

return new ResponseEntity<>(cartService.getAll(), HttpStatus.OK);
}
}
101 changes: 53 additions & 48 deletions kbazaar/src/main/java/com/kampus/kbazaar/cart/CartResponse.java
Original file line number Diff line number Diff line change
@@ -1,48 +1,53 @@
package com.kampus.kbazaar.cart;

import com.kampus.kbazaar.cartItem.CartItem;

import java.math.BigDecimal;
import java.util.List;

public class CartResponse {
private String username;
private List<CartItem> items;
private BigDecimal discount;
private BigDecimal totalDiscount;
private BigDecimal subtotal;
private BigDecimal grandTotal;

public CartResponse(String username, List<CartItem> items, BigDecimal discount, BigDecimal totalDiscount, BigDecimal subtotal, BigDecimal grandTotal) {
this.username = username;
this.items = items;
this.discount = discount;
this.totalDiscount = totalDiscount;
this.subtotal = subtotal;
this.grandTotal = grandTotal;
}

public String getUsername() {
return username;
}

public List<CartItem> getItems() {
return items;
}

public BigDecimal getDiscount() {
return discount;
}

public BigDecimal getTotalDiscount() {
return totalDiscount;
}

public BigDecimal getSubtotal() {
return subtotal;
}

public BigDecimal getGrandTotal() {
return grandTotal;
}
}
package com.kampus.kbazaar.cart;

import com.kampus.kbazaar.cartItem.CartItem;
import java.math.BigDecimal;
import java.util.List;

public class CartResponse {
private String username;
private List<CartItem> items;
private BigDecimal discount;
private BigDecimal totalDiscount;
private BigDecimal subtotal;
private BigDecimal grandTotal;

public CartResponse(
String username,
List<CartItem> items,
BigDecimal discount,
BigDecimal totalDiscount,
BigDecimal subtotal,
BigDecimal grandTotal) {
this.username = username;
this.items = items;
this.discount = discount;
this.totalDiscount = totalDiscount;
this.subtotal = subtotal;
this.grandTotal = grandTotal;
}

public String getUsername() {
return username;
}

public List<CartItem> getItems() {
return items;
}

public BigDecimal getDiscount() {
return discount;
}

public BigDecimal getTotalDiscount() {
return totalDiscount;
}

public BigDecimal getSubtotal() {
return subtotal;
}

public BigDecimal getGrandTotal() {
return grandTotal;
}
}
Loading

0 comments on commit 79e3065

Please sign in to comment.