diff --git a/.docker/db/scripts/init_db.sql b/.docker/db/scripts/init_db.sql new file mode 100644 index 0000000000000000000000000000000000000000..20e2ca1f69e67ba22936485bf3a88a262cd5ef36 --- /dev/null +++ b/.docker/db/scripts/init_db.sql @@ -0,0 +1,21 @@ +CREATE SCHEMA IF NOT EXISTS bank_user; +CREATE USER "ACC_USER" WITH PASSWORD 'userAccPasswd'; +REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA public FROM "ACC_USER"; +REVOKE ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public FROM "ACC_USER"; +ALTER ROLE "ACC_USER" SET SEARCH_PATH TO bank_user; +GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA bank_user TO "ACC_USER"; + +CREATE SCHEMA IF NOT EXISTS bank_account; +CREATE USER "ACC_ACCOUNT" WITH PASSWORD 'accountAccPasswd'; +REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA public FROM "ACC_ACCOUNT"; +REVOKE ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public FROM "ACC_ACCOUNT"; +ALTER ROLE "ACC_ACCOUNT" SET SEARCH_PATH TO bank_account; +GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA bank_account TO "ACC_ACCOUNT"; + +CREATE SCHEMA IF NOT EXISTS bank_transaction; +CREATE USER "ACC_TRANSACTION" WITH PASSWORD 'transactionAccPasswd'; +REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA public FROM "ACC_TRANSACTION"; +REVOKE ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public FROM "ACC_TRANSACTION"; +ALTER ROLE "ACC_TRANSACTION" SET SEARCH_PATH TO bank_transaction; +GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA bank_transaction TO "ACC_TRANSACTION"; + diff --git a/.docker/dummyFile b/.docker/dummyFile deleted file mode 100644 index bf3a7bd18762bb2140729d6dcd7efd2461c47761..0000000000000000000000000000000000000000 --- a/.docker/dummyFile +++ /dev/null @@ -1,2 +0,0 @@ -created just to commit the '.docker' directory. -Remove after other files have been added into the directory. \ No newline at end of file diff --git a/README.md b/README.md index 69ad99b78c1315ddbadadacce7b0e8a76f1fed29..2d8cbf5fce63307f75d6d00102164b3b97d9a5fe 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ which can report total and average (per account) transactions (deposits, withdra ## Use case diagram <img src="./useCaseDiagram.png" width="800"> -## Artefact Structure +## Artifact Structure | Service | Specification | |-----------------------------|-----------------------------------------------------------------------------------------------------------------------| @@ -25,7 +25,7 @@ which can report total and average (per account) transactions (deposits, withdra ## Module Architecture Each service is implemented as a separate maven artifact consisting of a Spring-boot application. Within each project -we used the principles of `Hexagonal architecture` and `DDD`, where the domain itself consists of only pure Java classes, +we used the principles of `Hexagonal architecture`, where the domain itself consists of only pure Java classes, with no technological dependencies. By using such separation, we nicely created an extra separated layer on top of the traditional `Controller, Facade, Service and Repository` layers. The main benefit of such separation is visible mainly when extending new features, implementation of tests and usage of custom abstractions with ease. diff --git a/docker-compose.yaml b/docker-compose.yaml index c5fab8298d891fa0bcdeea873a11d1b00274b4be..a6a6ad027ee3c35fb91c375f2e4e2b0b1622765d 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,2 +1,16 @@ -version: "3.8" +version: "3.9" +name: online-banking +services: + + banking-db: + image: "postgres:16.2" + ports: + - "5432:5432" + environment: + - POSTGRES_USER=root + - POSTGRES_PASSWORD=passwd + - POSTGRES_DB=banking + volumes: + - ./.docker/db/scripts:/docker-entrypoint-initdb.d + \ No newline at end of file