Skip to content

Commit

Permalink
Merge pull request #10 from micheltlutz/feature/challenges
Browse files Browse the repository at this point in the history
New Challenges for back-end and front-end
  • Loading branch information
micheltlutz authored Jan 2, 2024
2 parents 0a74177 + da0604d commit 027271e
Show file tree
Hide file tree
Showing 10 changed files with 323 additions and 6 deletions.
Binary file modified .DS_Store
Binary file not shown.
12 changes: 6 additions & 6 deletions app/balance/balance_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ def get_db():


@router.get("/balance/", response_model=Balance, description="""
Esta rota retorna o saldo calculado de todas as transações de um usuário.
This route returns the calculated balance of all transactions for a user.
- Regra para **Depósito**: Se o usuário depositar from_user == to_user, o valor é somado ao saldo.
- Regra para **Depósito**: Se o usuário depositar from_user != to_user, o valor é somado ao saldo.
- Regra para **Saque**: Se o usuário sacar da sua própria conta, o valor é subtraído do saldo.
- Regra para **Transferência**: Se o usuário transferir para sua própria conta (to_user == from_user), o valor é somado ao saldo.
- Regra para **Transferência**: Se o usuário transferir para outra conta (to_user != from_user), o valor é subtraído do saldo.
- Rule for **Deposit**: If the user deposits from_user == to_user, the amount is added to the balance.
- Rule for **Deposit**: If the user deposits from_user != to_user, the amount is added to the balance.
- Rule for **Withdrawal**: If the user withdraws from their own account, the amount is subtracted from the balance.
- Rule for **Transfer**: If the user transfers to their own account (to_user == from_user), the amount is added to the balance.
- Rule for **Transfer**: If the user transfers to another account (to_user != from_user), the amount is subtracted from the balance.
""")
def get_calculated_balance(db: Session = Depends(get_db), _: str = Depends(get_current_user)):
statements = db.query(Statement).all()
Expand Down
73 changes: 73 additions & 0 deletions readme_files/challenge_backend4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Back-end Developer Technical Challenge 4 - Pagination Statements

## Objective:

Its main objective is to design and implement the back-end logic to support the front-end interface for bank statement paging. This includes configuring the required API routes, handling data, and ensuring that the authentication process works as expected.


### Pagination:

The route should receive two parameters, `limit` and `offset`, the `limit` parameter will be the number of statements to be returned and the `offset` parameter will be the number of statements to be skipped.

**GET:** `/statements/{limit}/{offset}`

### Response:

- After successfully processing the input data and check the auth information, the endpoint should return a status code of 200 OK. With JSON Statement list:

```json
[
{
"type": "Deposit",
"amount": "15000.00",
"description": "Payment from Freela",
"from_user": "John Doe",
"authentication": "45d064afbd6cf24613daed52133320b84ece0e2cc751995a4d0b94fca84823dd",
"id": 1,
"created_at": "2023-09-21T18:46:45.478966",
"to_user": "John Doe",
"bank_name": "Adams LLC"
},
{
"type": "Deposit",
"amount": "88.81",
"description": "Trip authority window myself hour.",
"from_user": "Holly Bailey",
"authentication": "0ef6dc8284c7908ce7af354b10b6f354ff355a201f8f54e22bd60d928a6670c8",
"id": 2,
"created_at": "2020-09-07T00:00:00",
"to_user": "Caitlin Bennett",
"bank_name": "Williams-Norris"
}, ....
]
```

## Validations:

- The Route shoul be authenticated if not user should receive a status code of 401 unauthorized, with the following message:

```json
{
"detail": "Not authenticated"
}
```

### API Documentation

- As a bonus, provide Swagger documentation for the `/statements/{limit}/{offset}` route, offering insights into its expected input, output, and behavior.

### Unit Testing:

- Integrate unit tests to ensure the reliability of the route under various scenarios. Tests should cover, at a minimum:
- Successful user login.
- Validation failures (incorrect email format, invalid date, etc.).
- Proper password hashing and retrieval.


## Final Considerations:

- Prioritize best practices concerning code structure, error handling, security, and scalability.
- Make sure to handle potential database errors or conflicts, such as duplicate email addresses.

Embarking on challenges like this offers a unique opportunity to showcase your skills. We wish you the best and eagerly await your innovative solution!

57 changes: 57 additions & 0 deletions readme_files/challenge_backend5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Back-end Developer Technical Challenge 5 - Balance (Amout Value)

## Objective:

Its main objective is to design and implement back-end logic to support the front-end interface presenting the bank balance(amount) following the specific business rules below. This includes configuring API routes, manipulating data, and ensuring the authentication process works as expected. Easily add and configure API routes, manipulate data, and ensure the authentication process works as expected.


## Business rules from statements values:

> You should consider the following rules for the values of the statements to build amount:
- Rule for **Deposit**: If the user deposits from_user == to_user, the amount is added to the balance.
- Rule for **Deposit**: If the user deposits from_user != to_user, the amount is added to the balance.
- Rule for **Withdrawal**: If the user withdraws from their own account, the amount is subtracted from the balance.
- Rule for **Transfer**: If the user transfers to their own account (to_user == from_user), the amount is added to the balance.
- Rule for **Transfer**: If the user transfers to another account (to_user != from_user), the amount is subtracted from the balance.


**GET:** `/balance/`

## Response:

```json
{
"amount": 13512.590000000002
}
```

## Validations:

- The Route shoul be authenticated if not user should receive a status code of 401 unauthorized, with the following message:

```json
{
"detail": "Not authenticated"
}
```

### API Documentation

- As a bonus, provide Swagger documentation for the `balance` route, offering insights into its expected input, output, and behavior.

### Unit Testing:

- Integrate unit tests to ensure the reliability of the route under various scenarios. Tests should cover, at a minimum:
- Successful user login.
- Validation failures (incorrect email format, invalid date, etc.).
- Proper password hashing and retrieval.


## Final Considerations:

- Prioritize best practices concerning code structure, error handling, security, and scalability.
- Make sure to handle potential database errors or conflicts, such as duplicate email addresses.

Embarking on challenges like this offers a unique opportunity to showcase your skills. We wish you the best and eagerly await your innovative solution!

54 changes: 54 additions & 0 deletions readme_files/challenge_backend6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Back-end Developer Technical Challenge 6 - Profile edit

## Objective:

Its main objective is to design and implement a logical back-end to support a front-end interface that presents user registration data and allows editing and saving of this data. Easily add and configure API routes, manipulate data, and ensure the authentication process works as expected.

You are expected to create this backend in your preferred language/framework.


## Specifications:

**PUT**: `/users/{user_id}`

### Edit User Profile:

- The route should expect a PUT request with a JSON body formatted as:

```json
{
"password": "string",
"fullname": "string",
"birthdate": "2024-01-02"
}
```

## Validations:

- The Route shoul be authenticated if not user should receive a status code of 401 unauthorized, with the following message:

```json
{
"detail": "Not authenticated"
}
```

### API Documentation

- As a bonus, provide Swagger documentation for the `/users/{user_id}` route, offering insights into its expected input, output, and behavior.

### Unit Testing:

- Integrate unit tests to ensure the reliability of the route under various scenarios. Tests should cover, at a minimum:
- Successful user login.
- Validation failures (incorrect email format, invalid date, etc.).
- Proper password hashing and retrieval.


## Final Considerations:

- Prioritize best practices concerning code structure, error handling, security, and scalability.
- Make sure to handle potential database errors or conflicts, such as duplicate email addresses.

Embarking on challenges like this offers a unique opportunity to showcase your skills. We wish you the best and eagerly await your innovative solution!

81 changes: 81 additions & 0 deletions readme_files/challenge_frontend5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Front-end Developer Technical Challenge 5 - Statement List and Amount

Its main mission is to design and implement a screen that displays the user's balance and their list of bank transactions with pagination, hiding the display of values.

You are expected to create this interface in your preferred language/framework.

# Example:

![Example](images/STATEMENT_WIRE.png "Example")

### Pagination:

The route should receive two parameters, `limit` and `offset`, the `limit` parameter will be the number of statements to be returned and the `offset` parameter will be the number of statements to be skipped.

**GET:** `/statements/{limit}/{offset}`

### Response:

- After successfully processing the input data and CHECK the auth information, the endpoint should return a status code of 200 OK. With JSON Statement list:

```json
[
{
"type": "Deposit",
"amount": "15000.00",
"description": "Payment from Freela",
"from_user": "John Doe",
"authentication": "45d064afbd6cf24613daed52133320b84ece0e2cc751995a4d0b94fca84823dd",
"id": 1,
"created_at": "2023-09-21T18:46:45.478966",
"to_user": "John Doe",
"bank_name": "Adams LLC"
},
{
"type": "Deposit",
"amount": "88.81",
"description": "Trip authority window myself hour.",
"from_user": "Holly Bailey",
"authentication": "0ef6dc8284c7908ce7af354b10b6f354ff355a201f8f54e22bd60d928a6670c8",
"id": 2,
"created_at": "2020-09-07T00:00:00",
"to_user": "Caitlin Bennett",
"bank_name": "Williams-Norris"
}, ....
]
```

## Validations:

- The Route is authenticated, so it is necessary to send the token, otherwise the user will receive a 401 unauthorized status code, with the following message:

```json
{
"detail": "Not authenticated"
}
```

### Bonus:

- Unit Testing: As an added advantage, we'd be highly impressed if you can integrate unit tests for the designed interface. It will provide us with a clear understanding of your proficiency in ensuring the robustness and reliability of your implementations.

## Final Considerations:

- Your user interface should not only be functional but also intuitive and user-friendly.
- The design should take into account both aesthetics and usability.
- Be sure to write a good README guiding how to run your project, dependencies and what you think is necessary to install and run the project.

Challenges like this offer a unique opportunity to showcase your skills. We wish you the best and eagerly await your innovative solution!


### Bonus:

- Unit Testing: As an added advantage, we'd be highly impressed if you can integrate unit tests for the designed interface. It will provide us with a clear understanding of your proficiency in ensuring the robustness and reliability of your implementations.

## Final Considerations:

- Your user interface should not only be functional but also intuitive and user-friendly.
- The design should take into account both aesthetics and usability.
- Be sure to write a good README guiding how to run your project, dependencies and what you think is necessary to install and run the project.

Challenges like this offer a unique opportunity to showcase your skills. We wish you the best and eagerly await your innovative solution!
47 changes: 47 additions & 0 deletions readme_files/challenge_frontend6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Front-end Developer Technical Challenge 6 - Edit Profile information

Its main mission is to design and implement a screen that displays user registration data and allows editing and saving this data.

You are expected to create this interface in your preferred language/framework.

# Example:

![Example](images/user_details.png "Example")

## Specifications:

**PUT**: `/users/{user_id}`

### Edit User Profile:

- The route should expect a PUT request with a JSON body formatted as:

```json
{
"password": "string",
"fullname": "string",
"birthdate": "2024-01-02"
}
```

## Validations:

- The Route is authenticated, so it is necessary to send the token, otherwise the user will receive a 401 unauthorized status code, with the following message:

```json
{
"detail": "Not authenticated"
}
```

### Bonus:

- Unit Testing: As an added advantage, we'd be highly impressed if you can integrate unit tests for the designed interface. It will provide us with a clear understanding of your proficiency in ensuring the robustness and reliability of your implementations.

## Final Considerations:

- Your user interface should not only be functional but also intuitive and user-friendly.
- The design should take into account both aesthetics and usability.
- Be sure to write a good README guiding how to run your project, dependencies and what you think is necessary to install and run the project.

Challenges like this offer a unique opportunity to showcase your skills. We wish you the best and eagerly await your innovative solution!
5 changes: 5 additions & 0 deletions readme_files/challenged.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ For front-end developers, we provide a ready-to-use API set up to run in a Docke
- [Challenge 2. Create User Form](challenge_frontend2.md)
- [Challenge 3. Login Form](challenge_frontend3.md)
- [Challenge 4. Dashboard](challenge_frontend4.md)
- [Challenge 5. Show Amount and Pagination Statent](challenge_frontend5.md)
- [Challenge 6. Profile Edit](challenge_frontend6.md)

### Back-End

Expand All @@ -88,3 +90,6 @@ The challenge set for back-end developers is to replicate the already developed
- [Challenge 1. Contact Route](challenge_backend1.md)
- [Challenge 2. Create User Route](challenge_backend2.md)
- [Challenge 3. Login Route](challenge_backend3.md)
- [Challenge 4. Statements](challenge_backend4.md)
- [Challenge 5. Amount](challenge_backend5.md)
- [Challenge 6. Profile Edit](challenge_backend6.md)
Binary file added readme_files/images/STATEMENT_WIRE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme_files/images/user_details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 027271e

Please sign in to comment.