-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
138 changed files
with
8,407 additions
and
545 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ on: | |
- release | ||
paths: | ||
- 'src/**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-deploy: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: tests-validate | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- 'src/*' | ||
- 'tests/*' | ||
|
||
jobs: | ||
tests-validate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
|
||
- name: Install dependencies | ||
run: yarn install --ignore-scripts | ||
|
||
- name: Run tests | ||
run: yarn test:cov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,49 +35,37 @@ This project use lot's of tools to be as efficient as possible, here's the list | |
- [API](https://wise-bulldog-88.redoc.ly/) | ||
- [Database](https://dbdocs.io/henriqueleite42/Econominhas?view=relationships) | ||
|
||
## Third party Urls | ||
|
||
### Dev | ||
|
||
- [Google](https://accounts.google.com/o/oauth2/v2/auth/oauthchooseaccount?response_type=code&client_id=489785083174-0rqt9bc7l9t09luor3fc16h21kdf57q7.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A8081&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&access_type=offline&state=1234_purpleGoogle&prompt=consent&authuser=1&service=lso&o2v=2&theme=glif&flowName=GeneralOAuthFlow) | ||
|
||
## Useful commands | ||
|
||
| Command | Description | | ||
| --------------- | --------------------------------------------------------------------------------------------- | | ||
| `start:dev` | Run the project with all it's dependencies locally | | ||
| `openapi:serve` | Serve the API docs locally so you can validate your changes | | ||
| `db:prisma` | Update the ORM types (You need to run this every time that you change `prisma/schema.prisma`) | | ||
|
||
## Manual Deploy | ||
|
||
1. Connect to the EC2 instance trough [the console](https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#InstanceDetails:instanceId=i-058e2ca9b6b405219) | ||
2. [EC2] Stop the current execution: | ||
|
||
```sh | ||
pm2 stop econominhas | ||
pm2 delete econominhas | ||
``` | ||
|
||
3. [EC2] Delete the old files: | ||
|
||
``` | ||
rm -rf dist | ||
``` | ||
|
||
4. [Locally] Send the files to the EC2: | ||
|
||
```sh | ||
scp -i ~/Desktop/default.pem -r dist [email protected]:/home/ubuntu | ||
``` | ||
|
||
5. [EC2] Execute the API: | ||
|
||
```sh | ||
cd dist | ||
yarn | ||
pm2 start main.js --name econominhas | ||
``` | ||
| Command | Description | | ||
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | | ||
| `start:dev` | Run the project with all it's dependencies locally | | ||
| `openapi:serve` | Serve the API docs locally so you can validate your changes | | ||
| `openapi:postman` | Generate Postman json file (at `openapi/postman.json`) | | ||
| `lint:prisma` | Lint prisma schema | | ||
| `db:prisma` | Update the ORM types (You need to run this every time that you change `prisma/schema.prisma`) | | ||
| `test` | Run tests | | ||
| `test:cov` | Run tests and collect coverage | | ||
| `db:migrate` | Run the migrations | | ||
| `db:gen-migration <name>` | Generates a new migration based on the schema-database difference (you must run `start:dev` and `db:migrate` before run this!) | | ||
|
||
## How to create a migration | ||
|
||
- Run `yarn start:db` | ||
- In another tab, run `yarn db:gen-migration <migration name>` | ||
|
||
## Teams | ||
|
||
The teams names are based on different currencies around the world, but the countries that they are used don't have any influence on the things that the teams works on. | ||
|
||
| Team | Responsible for | Full list | | ||
| ----- | --------------- | ------------------------------------------------------------------- | | ||
| Real | Auth | Accounts, SignInProvider, MagicLink, RefreshToken, TermsAndPolicies | | ||
| Franc | Profile | Configs, Salary | | ||
| Yuan | Transactions | Transactions, Recurrent transactions | | ||
| Peso | Cards | Cards, Card Providers, Cards Bills | | ||
| Rand | Bank Accounts | Bank Accounts, Bank Providers, Subscriptions | | ||
| Rupee | Budgets | Budgets, Categories | | ||
|
||
## Process to develop a new feature | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
{ | ||
"moduleFileExtensions": ["js", "json", "ts"], | ||
"rootDir": "src", | ||
"rootDir": ".", | ||
"testRegex": ".*\\.spec\\.ts$", | ||
"transform": { | ||
"^.+\\.(t|j)s$": "ts-jest" | ||
}, | ||
"collectCoverageFrom": ["**/*.(t|j)s"], | ||
"coverageDirectory": "../coverage", | ||
"testEnvironment": "node" | ||
"collectCoverageFrom": [ | ||
"src/**/*.(t|j)s", | ||
"!src/app.module.ts", | ||
"!src/config.ts", | ||
"!src/main.ts", | ||
"!src/models/*.ts", | ||
"!src/adapters/*.ts", | ||
"!src/adapters/implementations/s3/*.ts", | ||
"!src/adapters/implementations/ses/*.ts", | ||
"!src/adapters/implementations/sns/*.ts", | ||
"!src/repositories/postgres/*.ts", | ||
"!src/types/**/*.ts" | ||
], | ||
"coverageDirectory": "./coverage", | ||
"testEnvironment": "node", | ||
"moduleDirectories": ["node_modules", "src"], | ||
"setupFiles": ["./tests/setup.ts"], | ||
"resetMocks": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
description: | | ||
Transaction name | ||
type: string | ||
minLength: 1 | ||
maxLength: 30 | ||
examples: | ||
- "Foo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
patch: | ||
tags: | ||
- Account | ||
summary: Update user's onboarding progress | ||
description: | | ||
Update user's onboarding progress | ||
operationId: account-update-onboarding | ||
security: | ||
- bearer: [] | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
title: Update user's onboarding progress | ||
properties: | ||
name: | ||
type: boolean | ||
categories: | ||
type: boolean | ||
bankAccounts: | ||
type: boolean | ||
creditCards: | ||
type: boolean | ||
budget: | ||
type: boolean | ||
salary: | ||
type: boolean | ||
required: true | ||
responses: | ||
"204": | ||
description: | | ||
Onboarding progress updated | ||
"400": | ||
description: | | ||
Invalid name | ||
"401": | ||
description: | | ||
Unauthorized |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
post: | ||
tags: | ||
- Transaction | ||
summary: Create CREDIT transaction | ||
description: | | ||
Create a CREDIT transaction, to add or remove money from | ||
one of the user's bank accounts only when the card bill | ||
is paid | ||
operationId: transaction-credit | ||
security: | ||
- bearer: [] | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
required: | ||
- name | ||
- description | ||
- amount | ||
- installments | ||
- categoryId | ||
- cardId | ||
- budgetDateId | ||
- createdAt | ||
properties: | ||
name: | ||
$ref: ../../components/fields/transaction-name.yaml | ||
description: | ||
$ref: ../../components/fields/description.yaml | ||
amount: | ||
$ref: ../../components/fields/amount.yaml | ||
installments: | ||
description: | | ||
Amount of installments for the transaction | ||
type: integer | ||
minimum: 1 | ||
examples: | ||
- 1 | ||
- 12 | ||
- 420 | ||
cardId: | ||
description: ID of the card used to pay the transaction | ||
type: string | ||
format: uuid | ||
categoryId: | ||
description: Category ID | ||
type: string | ||
format: uuid | ||
budgetDateId: | ||
description: BudgetDate ID | ||
type: string | ||
format: uuid | ||
createdAt: | ||
$ref: ../../components/fields/created-at.yaml | ||
required: true | ||
responses: | ||
"201": | ||
description: | | ||
Transaction created | ||
"400": | ||
$ref: ../../components/responses/bad-request.yaml | ||
"401": | ||
$ref: ../../components/responses/unauthorized.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
post: | ||
tags: | ||
- Transaction | ||
summary: Create IN or OUT transaction | ||
description: | | ||
Create a IN or OUT transaction, to add or remove money from | ||
one of the user's bank accounts | ||
operationId: transaction-in-out | ||
security: | ||
- bearer: [] | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
required: | ||
- type | ||
- name | ||
- amount | ||
- bankAccountId | ||
- budgetDateId | ||
- categoryId | ||
- description | ||
- createdAt | ||
properties: | ||
type: | ||
description: | | ||
Transaction type | ||
type: string | ||
enum: | ||
- IN | ||
- OUT | ||
name: | ||
$ref: ../../components/fields/transaction-name.yaml | ||
description: | ||
$ref: ../../components/fields/description.yaml | ||
amount: | ||
$ref: ../../components/fields/amount.yaml | ||
bankAccountId: | ||
description: ID of the bank account to add/remove money | ||
type: string | ||
format: uuid | ||
categoryId: | ||
description: Category ID | ||
type: string | ||
format: uuid | ||
budgetDateId: | ||
description: BudgetDate ID | ||
type: string | ||
format: uuid | ||
createdAt: | ||
$ref: ../../components/fields/created-at.yaml | ||
required: true | ||
responses: | ||
"201": | ||
description: | | ||
Transaction created | ||
"400": | ||
$ref: ../../components/responses/bad-request.yaml | ||
"401": | ||
$ref: ../../components/responses/unauthorized.yaml |
Oops, something went wrong.