Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include external task instructions #24

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
322 changes: 322 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,338 @@
<!--TASK_INSTRUCTIONS_START-->
# Transaction Management Backend - Level 1

Your task is to build a backend app that allows the recording of financial transactions and viewing the transaction history.

It should implement the [Transaction Management API specification](https://infra.devskills.app/transaction-management/api/3.1.0), which is defined in the [Open API](https://www.openapis.org/) format.

<details>
<summary>Transaction Management API Specification</summary>

```json
{
"openapi": "3.0.0",
"info": {
"title": "Transaction Management API",
"version": "3.1.0"
},
"components": {
"schemas": {
"TransactionRequest": {
"type": "object",
"properties": {
"account_id": {
"type": "string",
"format": "uuid"
},
"amount": {
"type": "integer"
}
},
"required": [
"transaction_id",
"account_id",
"amount"
]
},
"Transaction": {
"type": "object",
"properties": {
"transaction_id": {
"type": "string",
"format": "uuid"
},
"account_id": {
"type": "string",
"format": "uuid"
},
"amount": {
"type": "integer"
},
"created_at": {
"type": "string",
"format": "date-time"
}
},
"required": [
"transaction_id",
"account_id",
"amount",
"created_at"
]
},
"ArrayOfTransactions": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Transaction"
}
},
"Account": {
"type": "object",
"properties": {
"account_id": {
"type": "string",
"format": "uuid"
},
"balance": {
"type": "integer"
}
},
"required": [
"account_id",
"balance"
]
}
},
"examples": {
"TransactionRequestWithPositiveAmount": {
"value": {
"account_id": "0afd02d3-6c59-46e7-b7bc-893c5e0b7ac2",
"amount": 7
}
},
"TransactionRequestWithNegativeAmount": {
"value": {
"account_id": "5ae0ef78-e902-4c40-9f53-8cf910587312",
"amount": -4
}
},
"TransactionWithPositiveAmount": {
"value": {
"transaction_id": "4bcc3959-6fe1-406e-9f04-cad2637b47d5",
"account_id": "0afd02d3-6c59-46e7-b7bc-893c5e0b7ac2",
"amount": 7,
"created_at": "2021-05-12T18:29:40.206924+00:00"
}
},
"TransactionWithNegativeAmount": {
"value": {
"transaction_id": "050a75f6-8df1-4ad1-8f5b-54e821e98581",
"account_id": "5ae0ef78-e902-4c40-9f53-8cf910587312",
"amount": -4,
"created_at": "2021-05-18T21:33:47.203136+00:00"
}
},
"ArrayOfTransactionsExample": {
"value": [
{
"transaction_id": "4bcc3959-6fe1-406e-9f04-cad2637b47d5",
"account_id": "0afd02d3-6c59-46e7-b7bc-893c5e0b7ac2",
"amount": 7,
"created_at": "2021-05-12T18:29:40.206924+00:00"
},
{
"transaction_id": "050a75f6-8df1-4ad1-8f5b-54e821e98581",
"account_id": "5ae0ef78-e902-4c40-9f53-8cf910587312",
"amount": -4,
"created_at": "2021-05-18T21:33:47.203136+00:00"
}
]
},
"PositiveAccount": {
"value": {
"account_id": "fbf4a552-2418-46c5-b308-6094ddc493a1",
"balance": 10
}
},
"NegativeAccount": {
"value": {
"account_id": "9c3cd9a8-65c4-4d26-8488-ef9a40f57c37",
"balance": -7
}
},
"MaxTransactionVolumeExample": {
"value": {
"maxVolume": 4,
"accountIds": [
"44a92331-a533-4dd3-82e3-3ff75219e33b",
"7c9be9e8-a6df-4f43-9a44-38c10ad0de4a"
]
}
}
}
},
"paths": {
"/ping": {
"get": {
"summary": "Healhcheck to make sure the service is up.",
"responses": {
"200": {
"description": "The service is up and running."
}
}
}
},
"/transactions": {
"post": {
"summary": "Creates a new transaction.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TransactionRequest"
},
"examples": {
"TransactionRequestWithPositiveAmount": {
"$ref": "#/components/examples/TransactionRequestWithPositiveAmount"
},
"TransactionRequestWithNegativeAmount": {
"$ref": "#/components/examples/TransactionRequestWithNegativeAmount"
}
}
}
}
},
"responses": {
"201": {
"description": "Transaction created.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Transaction"
},
"examples": {
"TransactionWithPositiveAmount": {
"$ref": "#/components/examples/TransactionWithPositiveAmount"
}
}
}
}
},
"400": {
"description": "Mandatory body parameters missing or have incorrect type."
},
"405": {
"description": "Specified HTTP method not allowed."
},
"415": {
"description": "Specified content type not allowed."
}
}
},
"get": {
"summary": "Get transactions",
"responses": {
"200": {
"description": "Returns all previously created transactions.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ArrayOfTransactions"
},
"examples": {
"ArrayOfTransactionsExample": {
"$ref": "#/components/examples/ArrayOfTransactionsExample"
}
}
}
}
}
}
}
},
"/transactions/{transaction_id}": {
"get": {
"summary": "Returns the transaction by id.",
"parameters": [
{
"name": "transaction_id",
"in": "path",
"required": true,
"description": "Transaction ID",
"schema": {
"type": "string",
"format": "uuid"
},
"example": "023d2024-24bc-42c9-ab24-689eef6ea0f9"
}
],
"responses": {
"200": {
"description": "Transaction details.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Transaction"
},
"examples": {
"TransactionWithPositiveAmount": {
"$ref": "#/components/examples/TransactionWithPositiveAmount"
},
"TransactionWithNegativeAmount": {
"$ref": "#/components/examples/TransactionWithNegativeAmount"
}
}
}
}
},
"400": {
"description": "transaction_id missing or has incorrect type."
},
"404": {
"description": "Transaction not found"
}
}
}
},
"/accounts/{account_id}": {
"get": {
"summary": "Returns the account data.",
"parameters": [
{
"name": "account_id",
"in": "path",
"required": true,
"description": "Account ID.",
"schema": {
"type": "string",
"format": "uuid"
},
"example": "5ba6e1b0-e3e7-483a-919a-a2fc17629a90"
}
],
"responses": {
"200": {
"description": "Account data.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Account"
},
"examples": {
"PositiveAccount": {
"$ref": "#/components/examples/PositiveAccount"
},
"NegativeAccount": {
"$ref": "#/components/examples/NegativeAccount"
}
}
}
}
},
"400": {
"description": "account_id missing or has incorrect type."
},
"404": {
"description": "Account not found."
}
}
}
}
}
}
```
</details>

Please agree with your hiring team regarding the tech stack choice.

## Additional requirements

- Do your best to make the [provided E2E tests](cypress/e2e/test.cy.js) pass.
- Keep server data in a [SQLite](https://www.sqlite.org/index.html) database. We want to see how you design the database schema and SQL queries.

<!--TASK_INSTRUCTIONS_END-->

## Getting started

<details>
Expand Down
Loading