docs: Readme
This commit is contained in:
parent
c43aacc60b
commit
476410fba8
1 changed files with 174 additions and 0 deletions
174
readme.md
Normal file
174
readme.md
Normal file
|
@ -0,0 +1,174 @@
|
|||
# Wymiana walut
|
||||
|
||||
Prosty mikroserwis stworzony na potrzeby rekrutacji
|
||||
|
||||
## Założenia
|
||||
|
||||
- PESEL jedynym identyfikatorem
|
||||
- Jedno konto na PESEL
|
||||
- Użytkownik pełnoletni
|
||||
- Wymiana walut na podstawie tabeli NBP
|
||||
- Baza danych in-memory
|
||||
|
||||
## Interfejsy
|
||||
|
||||
- stworzenie konta
|
||||
|
||||
⇒ POST `/api/user`
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"surname": {
|
||||
"type": "string"
|
||||
},
|
||||
"pesel": {
|
||||
"type": "string"
|
||||
},
|
||||
"pln": {
|
||||
"type": "number",
|
||||
"description": "początkowy stan konta w złotówkach"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"surname",
|
||||
"pesel",
|
||||
"pln"
|
||||
]
|
||||
}
|
||||
```
|
||||
⇐ 204/400/409/500
|
||||
|
||||
- pobranie informacji o koncie
|
||||
|
||||
⇒ GET `/api/user/{pesel}`
|
||||
|
||||
⇐ 200/400/404/500
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"def": {
|
||||
"currency": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"symbol": {
|
||||
"type": "string"
|
||||
},
|
||||
"amount": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"symbol",
|
||||
"amount"
|
||||
]
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"surname": {
|
||||
"type": "string"
|
||||
},
|
||||
"pesel": {
|
||||
"type": "string"
|
||||
},
|
||||
"currencies": {
|
||||
"$comment": "TODO: Map -> List",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/def/currency"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"surname",
|
||||
"pesel",
|
||||
"currencies"
|
||||
]
|
||||
}
|
||||
```
|
||||
- zlecenie wymiany walut
|
||||
|
||||
⇒ POST `/api/exchange/{pesel}`
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pesel": {
|
||||
"type": "string"
|
||||
},
|
||||
"from": {
|
||||
"type": "string",
|
||||
"description": "waluta źródłowa"
|
||||
},
|
||||
"to": {
|
||||
"type": "string",
|
||||
"description": "waluta docelowa"
|
||||
},
|
||||
"toBuy": {
|
||||
"type": "number",
|
||||
"description": "ilość do zakupu"
|
||||
},
|
||||
"toSell": {
|
||||
"type": "number",
|
||||
"description": "ilość do sprzedaży"
|
||||
}
|
||||
},
|
||||
"oneOf": [
|
||||
{
|
||||
"required": [
|
||||
"pesel",
|
||||
"from",
|
||||
"to",
|
||||
"toBuy"
|
||||
]
|
||||
},
|
||||
{
|
||||
"required": [
|
||||
"pesel",
|
||||
"from",
|
||||
"to",
|
||||
"toSell"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
⇐ 200/400/404/500
|
||||
|
||||
patrz: pobranie informacji o koncie
|
||||
|
||||
## Architektura
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
actor["fa:fa-person"]
|
||||
subgraph NBP
|
||||
tabC["Tabela C"]
|
||||
end
|
||||
subgraph proces
|
||||
subgraph spring-boot
|
||||
core
|
||||
subgraph endpoint
|
||||
user
|
||||
exchange
|
||||
end
|
||||
end
|
||||
hsqldb
|
||||
end
|
||||
|
||||
actor <--> user
|
||||
actor <--> exchange
|
||||
endpoint <--> core
|
||||
core <--> tabC
|
||||
core <-- ${hsql.port} --> hsqldb
|
||||
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue