Skip to content

Commit

Permalink
V2: Updated CONTRIBUTING.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ighoshsubho authored Jun 29, 2023
1 parent be8440a commit e21dbd4
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ fintect-api
└───📂helpers
│ │ { Python functions for different calculations }
└───📂tasks
│ │ { Python functions for different tasks }
└───📂validators
│ │ { Pydantic Models for different validations }
📄.gitignore
📄CONTRIBUTING.md
Expand Down Expand Up @@ -112,14 +118,18 @@ def simple_interest_rate(amount_paid:float, principle_amount:float, months:int):
```
+ Cross-validate your endpoint output from some online calculators available or even manually.

+ Once the function is ready, create an endpoint in the `main.py` file following all the good practices of Fast API.
+ After completing with creating the function, create the request validation in `validators/request_validation.py` like this -

```python
class SimpleInterestRateRequest(BaseModel):
amount_paid: float
principle_amount: float
months: int
```

+ Once the validation is done, create a task called `simple_interest.py` in `./tasks` and the task like this -

```python
@app.get(
"/simple_interest_rate",
tags=["simple_interest_rate"],
description="Calculate simple interest rates",
)
def simple_interest_rate(amount_paid: float, principle_amount: float, months: int):
try:
rate = functions.simple_interest_rate(amount_paid, principle_amount, months)
Expand All @@ -134,6 +144,18 @@ def simple_interest_rate(amount_paid: float, principle_amount: float, months: in
return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR)
```

+ Once the task is ready, create an endpoint in the `main.py` file following all the good practices of Fast API.

```python
@app.get(
"/simple_interest_rate",
tags=["simple_interest_rate"],
description="Calculate simple interest rates",
)
def simple_interest_rate(request: SimpleInterestRateRequest):
return simple_interest_rate_task(request.amount_paid, request.principle_amount, request.months)
```

+Also add your funtion in `ENDPOINTS.md`.
```
**GET** `/simple_interest_rate`
Expand Down

0 comments on commit e21dbd4

Please sign in to comment.