Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions TransactionsDB.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
CREATE DATABASE transactionDB;

CREATE TABLE transactions (
transaction_external_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
account_external_id_debit UUID NOT NULL,
account_external_id_credit UUID NOT NULL,
transfer_type_id INT NOT NULL,
value DECIMAL(10, 2) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
status VARCHAR(50) NOT NULL
) PARTITION BY RANGE (created_at);

CREATE TABLE transactions_2024 PARTITION OF transactions
FOR VALUES FROM ('2024-01-01') TO ('2025-01-01');


CREATE TABLE transfer_types (
id SERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL
);

INSERT INTO transfer_types (name) VALUES ('Type1'), ('Type2'), ('Type3');


CREATE INDEX idx_account_external_id_debit ON transactions (account_external_id_debit);
CREATE INDEX idx_account_external_id_credit ON transactions (account_external_id_credit);
CREATE INDEX idx_created_at ON transactions (created_at);

13 changes: 6 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
version: "3.7"
services:
postgres:
image: postgres:14
image: postgres:latest
ports:
- "5432:5432"
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_USER=root
- POSTGRES_PASSWORD=root
zookeeper:
image: confluentinc/cp-zookeeper:5.5.3
environment:
ZOOKEEPER_CLIENT_PORT: 2181
kafka:
image: confluentinc/cp-enterprise-kafka:5.5.3
depends_on: [zookeeper]
ports:
- 9092:9092
environment:
KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_BROKER_ID: 1
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_JMX_PORT: 9991
ports:
- 9092:9092
KAFKA_JMX_PORT: 9991
33 changes: 33 additions & 0 deletions ms-transaction/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
19 changes: 19 additions & 0 deletions ms-transaction/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.7/apache-maven-3.9.7-bin.zip
259 changes: 259 additions & 0 deletions ms-transaction/mvnw

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading