Skip to content

Commit

Permalink
upgrade common to deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
kundan59 committed Sep 13, 2023
2 parents a087e80 + e5c1506 commit 5c53d04
Show file tree
Hide file tree
Showing 112 changed files with 1,293 additions and 703 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
public class ApproveOrderCommand {
@TargetAggregateIdentifier
String orderId;
String paymentId;
String shipmentId;
OrderStatus orderStatus;

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ public class CancelShipmentCommand {
String productId;
Integer quantity;
Double price;
Double subTotal;
Double grandTotal;
Float tax;
String userId;
String firstName;
String lastName;
String address;
String reasonToFailed;
String paymentId;
ShipmentStatus shipmentStatus = ShipmentStatus.SHIPMENT_CANCELLED;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.nashtech.common.command;

import com.nashtech.common.model.User;
import lombok.Builder;
import lombok.Value;
import org.axonframework.modelling.command.TargetAggregateIdentifier;

@Value
@Builder
public class CreateShipmentCommand {
@TargetAggregateIdentifier
String shipmentId;
String paymentId;
String orderId;
User user;
String productId;
Double subTotal;
Double total;
Float tax;
Double basePrice;
Integer quantity;

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ public class CreatedShipmentCommand {
String productId;
Integer quantity;
Double price;
Double subTotal;
Double grandTotal;
Float tax;
String userId;
String firstName;
String lastName;
String address;
String paymentId;
ShipmentStatus shipmentStatus = ShipmentStatus.SHIPMENT_CREATED;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.nashtech.common.command;

import com.nashtech.common.model.PaymentDetails;
import com.nashtech.common.model.PaymentStatus;
import com.nashtech.common.model.User;
import lombok.Builder;
import lombok.Value;
import org.axonframework.modelling.command.TargetAggregateIdentifier;
Expand All @@ -13,12 +10,10 @@ public class ProcessPaymentCommand {
@TargetAggregateIdentifier
String paymentId;
String orderId;
Double price;
Integer quantity;
Float tax;
Double baseAmount;
String productId;
User userDetails;
PaymentDetails paymentDetails;
PaymentStatus paymentStatus = PaymentStatus.PAYMENT_APPROVED;

String userId;

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
public class ReserveProductCommand {
@TargetAggregateIdentifier
String productId;
String orderId;
String userId;
String title;
Double basePrice;
Integer quantity;
Float tax;
String orderId;
String userId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
@Builder
public class OrderShippedEvent {
String orderId;

String paymentId;
String shipmentId;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.nashtech.common.event;

import com.nashtech.common.model.PaymentStatus;
import com.nashtech.common.model.User;
import lombok.Builder;
import lombok.Value;

Expand All @@ -9,11 +9,12 @@
public class PaymentApprovedEvent {
String paymentId;
String orderId;
Double price;
String userId;
Integer quantity;
String productId;
PaymentStatus paymentStatus;

User user;
Integer quantity;
Double subTotal;
Double total;
Float tax;
Double basePrice;

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class PaymentCancelledEvent {
String orderId;
Integer quantity;
String userId;
String reason;
String reasonToFailed;
String productId;
PaymentStatus paymentStatus;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.nashtech.common.event;

import lombok.Builder;
import lombok.Value;

@Value
@Builder
public class ProductFailedEvent {
String orderId;
String productId;
Integer quantity;
String reasonToFailed;

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
@Value
@Builder
public class ProductReserveCancelledEvent {
String productId;
String orderId;
String reasonToFailed;
String userId;
Integer quantity;
String reasonToFailed;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.nashtech.common.event;

import lombok.Builder;
import lombok.Value;

@Value
@Builder
public class ProductReserveFailedEvent {
String orderId;
String userId;
String productId;
String reasonToFailed;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
@Value
@Builder
public class ProductReservedEvent {
String productId;
Double price;
Integer quantity;
String orderId;
String userId;
String productId;
String title;
Double baseAmount;
Float tax;
Integer quantity;

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ public class ShipmentCancelledEvent {
String productId;
Integer quantity;
Double price;
Double subTotal;
Double grandTotal;
Float tax;
String userId;
String firstName;
String lastName;
String address;
String reasonToFailed;
String paymentId;
ShipmentStatus shipmentStatus;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package com.nashtech.common.event;

import com.nashtech.common.model.ShipmentStatus;
import com.nashtech.common.model.User;
import lombok.Builder;
import lombok.Value;

@Value
@Builder
public class ShipmentCreatedEvent {
String shipmentId;
String paymentId;
String orderId;
User user;
String productId;
Double subTotal;
Double total;
Float tax;
Double basePrice;
Integer quantity;
Double price;
String userId;
String paymentId;
ShipmentStatus shipmentStatus;

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
@Value
@Builder
public class PaymentDetails {
String userId;
String bank;
String cardNumber;
Integer validUntilMonth;
Integer validUntilYear;
Integer cvv;
Double balanceAmount;

}
14 changes: 8 additions & 6 deletions common/src/main/java/com/nashtech/common/model/User.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package com.nashtech.common.model;

import lombok.Builder;
import lombok.Value;
import lombok.Data;

@Value
@Data
@Builder
public class User {
String firstName;
String lastName;
String userId;
String address;
private String userId;
private String firstName;
private String lastName;
private String address;
private String emailId;
private String mobileNumber;

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.nashtech.common.utils;

public enum OrderStatus {
ORDER_CREATED, ORDER_APPROVED, ORDER_REJECTED
ORDER_NOT_APPROVED,ORDER_PARTIALLY_APPROVED, ORDER_APPROVED, ORDER_PLACED

}
8 changes: 8 additions & 0 deletions inventory-service/app-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: inventory-configmap
data:
# Configuration values can be set as key-value properties
MYSQL_HOST: 35.231.178.113
AXON_HOST: 34.23.126.183:8124
16 changes: 16 additions & 0 deletions inventory-service/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,19 @@ spec:
- name: http
containerPort: 9091
protocol: TCP
env:
- name: MYSQL_DB_USERNAME
valueFrom:
secretKeyRef:
name: secret-to-be-created
key: mysql-db-username
optional: false
- name: MYSQL_DB_PASSWORD
valueFrom:
secretKeyRef:
name: secret-to-be-created
key: mysql-db-userpassword
optional: false
envFrom:
- configMapRef:
name: inventory-configmap
2 changes: 2 additions & 0 deletions inventory-service/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- secretstore.yaml
- app-config.yaml
- service.yaml
- deployment.yaml

8 changes: 1 addition & 7 deletions inventory-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
<groupId>com.nashtech.inventory</groupId>
<artifactId>inventory-service</artifactId>
<version>1.0.0</version>
<name>Inventory-Mircoservice</name>
<description>Demo project for Spring Boot</description>
<name>inventory-service</name>

<repositories>
<repository>
Expand Down Expand Up @@ -87,11 +86,6 @@
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.appsdeveloperblog.estore</groupId>-->
<!-- <artifactId>core</artifactId>-->
<!-- <version>0.0.1-SNAPSHOT</version>-->
<!-- </dependency>-->

<dependency>
<groupId>javax.validation</groupId>
Expand Down
42 changes: 42 additions & 0 deletions inventory-service/secretstore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: external-secrets.io/v1beta1
kind: SecretStore
metadata:
name: car-demo-inventory-secretstore
namespace: default
spec:
provider:
gcpsm:
auth:
secretRef:
secretAccessKeySecretRef:
name: gcpsm-secret
key: secret-access-credentials
projectID: boreal-gravity-396810
---
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: car-demo-externalsecret
namespace: default
spec:
secretStoreRef:
name: car-demo-inventory-secretstore
kind: SecretStore
target:
name: secret-to-be-created
data:
- secretKey: "mysql-db-username"
remoteRef:
key: car-demo-secret
version: latest
property: mysql-db-username
- secretKey: "mysql-db-userpassword"
remoteRef:
key: car-demo-secret
version: latest
property: mysql-db-userpassword

- secretKey: "MY_SQL_SECRETS"
remoteRef:
key: car-demo-secret
version: latest
Loading

0 comments on commit 5c53d04

Please sign in to comment.