diff --git a/.gitignore b/.gitignore
index 67045665db..9ec62f44da 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,13 +1,62 @@
+# compiled output
+/dist
+/node_modules
+/build
+/postgres
+**/node_modules
+**/dist
+**/build
+**/logs
+**/coverage
+**/.nyc_output
+**/.idea
+**/.project
+**/.classpath
+transaction-ms/postgres
+antifraud-ms/postgres
+
# Logs
logs
*.log
npm-debug.log*
+pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
-# Diagnostic reports (https://nodejs.org/api/report.html)
-report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
+# OS
+.DS_Store
+
+# Tests
+/coverage
+/.nyc_output
+
+# IDEs and editors
+/.idea
+.project
+.classpath
+.c9/
+*.launch
+.settings/
+*.sublime-workspace
+
+# IDE - VSCode
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+
+# dotenv environment variable files
+.env
+.env.development.local
+.env.test.local
+.env.production.local
+.env.local
+
+# temp directory
+.temp
+.tmp
# Runtime data
pids
@@ -15,90 +64,5 @@ pids
*.seed
*.pid.lock
-# Directory for instrumented libs generated by jscoverage/JSCover
-lib-cov
-
-# Coverage directory used by tools like istanbul
-coverage
-*.lcov
-
-# nyc test coverage
-.nyc_output
-
-# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
-.grunt
-
-# Bower dependency directory (https://bower.io/)
-bower_components
-
-# node-waf configuration
-.lock-wscript
-
-# Compiled binary addons (https://nodejs.org/api/addons.html)
-build/Release
-
-# Dependency directories
-node_modules/
-jspm_packages/
-
-# TypeScript v1 declaration files
-typings/
-
-# TypeScript cache
-*.tsbuildinfo
-
-# Optional npm cache directory
-.npm
-
-# Optional eslint cache
-.eslintcache
-
-# Microbundle cache
-.rpt2_cache/
-.rts2_cache_cjs/
-.rts2_cache_es/
-.rts2_cache_umd/
-
-# Optional REPL history
-.node_repl_history
-
-# Output of 'npm pack'
-*.tgz
-
-# Yarn Integrity file
-.yarn-integrity
-
-# dotenv environment variables file
-.env
-.env.test
-
-# parcel-bundler cache (https://parceljs.org/)
-.cache
-
-# Next.js build output
-.next
-
-# Nuxt.js build / generate output
-.nuxt
-dist
-
-# Gatsby files
-.cache/
-# Comment in the public line in if your project uses Gatsby and *not* Next.js
-# https://nextjs.org/blog/next-9-1#public-directory-support
-# public
-
-# vuepress build output
-.vuepress/dist
-
-# Serverless directories
-.serverless/
-
-# FuseBox cache
-.fusebox/
-
-# DynamoDB Local files
-.dynamodb/
-
-# TernJS port file
-.tern-port
+# Diagnostic reports (https://nodejs.org/api/report.html)
+report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
diff --git a/README.md b/README.md
index b067a71026..79945f5e51 100644
--- a/README.md
+++ b/README.md
@@ -1,82 +1,136 @@
-# Yape Code Challenge :rocket:
+# Yape Reto - Transaction & Antifraud Microservices
-Our code challenge will let you marvel us with your Jedi coding skills :smile:.
+This project consists of two microservices: Transaction Management and Antifraud Detection.
-Don't forget that the proper way to submit your work is to fork the repo and create a PR :wink: ... have fun !!
+## Prerequisites
-- [Problem](#problem)
-- [Tech Stack](#tech_stack)
-- [Send us your challenge](#send_us_your_challenge)
+- Node.js (LTS version recommended)
+- pnpm package manager
+- Docker and Docker Compose
-# Problem
+## Installation
-Every time a financial transaction is created it must be validated by our anti-fraud microservice and then the same service sends a message back to update the transaction status.
-For now, we have only three transaction statuses:
+### 1. Install Antifraud Microservice
-
- - pending
- - approved
- - rejected
-
+```bash
+cd antifraud-ms
+pnpm install
+```
+
+### 2. Install Transaction Microservice
+
+```bash
+cd transaction-ms
+pnpm install
+```
+
+### 3. Start Docker Services
+
+From the root directory, start the required Docker containers:
+
+```bash
+docker-compose up -d
+```
+
+### 4. Configure Environment Variables
+
+Copy the environment template file to create your local configuration:
+
+```bash
+cd transaction-ms
+cp .env.template .env
+```
+
+## Running the Application
+
+Start both microservices in development mode:
-Every transaction with a value greater than 1000 should be rejected.
+### Terminal 1 - Antifraud Microservice
+```bash
+cd antifraud-ms
+pnpm run start:dev
+```
-```mermaid
- flowchart LR
- Transaction -- Save Transaction with pending Status --> transactionDatabase[(Database)]
- Transaction --Send transaction Created event--> Anti-Fraud
- Anti-Fraud -- Send transaction Status Approved event--> Transaction
- Anti-Fraud -- Send transaction Status Rejected event--> Transaction
- Transaction -- Update transaction Status event--> transactionDatabase[(Database)]
+### Terminal 2 - Transaction Microservice
+```bash
+cd transaction-ms
+pnpm run start:dev
```
-# Tech Stack
+## Testing the API
+
+Once both services are running, navigate to the GraphQL playground:
-
- - Node. You can use any framework you want (i.e. Nestjs with an ORM like TypeOrm or Prisma)
- - Any database
- - Kafka
-
+```
+http://localhost:3000/graphql
+```
-We do provide a `Dockerfile` to help you get started with a dev environment.
+### Available Operations
-You must have two resources:
+#### 1. Create Transaction Mutation
-1. Resource to create a transaction that must containt:
+First, use this mutation to create a new transaction:
+
+```graphql
+mutation Mutation($createTransactionInput: CreateTransactionInput!) {
+ createTransaction(createTransactionInput: $createTransactionInput) {
+ accountExternalIdCredit
+ accountExternalIdDebit
+ createdAt
+ status
+ transactionExternalId
+ value
+ }
+}
+```
+**Variables:**
```json
{
- "accountExternalIdDebit": "Guid",
- "accountExternalIdCredit": "Guid",
- "tranferTypeId": 1,
- "value": 120
+ "createTransactionInput": {
+ "accountExternalIdDebit": "550e8400-e29b-41d4-a716-446655440000",
+ "accountExternalIdCredit": "9f1a8a23-3c7b-4b9f-9e29-17d1f8e41e76",
+ "value": 999,
+ "transferTypeId": 1
+ }
}
```
-2. Resource to retrieve a transaction
+> **Note:** Copy the `transactionExternalId` from the response, you'll need it for the next query.
+#### 2. Query Transaction
+
+Use this query to retrieve the transaction details using the `transactionExternalId` obtained from the create mutation:
+
+```graphql
+query Transaction($transactionExternalId: String!) {
+ transaction(transactionExternalId: $transactionExternalId) {
+ status
+ accountExternalIdCredit
+ accountExternalIdDebit
+ status
+ transactionExternalId
+ }
+}
+```
+
+**Variables:**
```json
{
- "transactionExternalId": "Guid",
- "transactionType": {
- "name": ""
- },
- "transactionStatus": {
- "name": ""
- },
- "value": 120,
- "createdAt": "Date"
+ "transactionExternalId": "