Skip to content

Commit 87d910b

Browse files
ivanfurlanmveronesimcanoveseftroleMichele Veronesi
authored
Rilascio (#4)
Co-authored-by: Michele Veronesi <micheleveronesi0@gmail.com> Co-authored-by: Michele Veronesi <39095702+micheleveronesi@users.noreply.github.com> Co-authored-by: Marco <marco.canovese@studenti.unipd.it> Co-authored-by: Trolese Francesco <francesco.trolese.1@studenti.unipd.it> Co-authored-by: mcanovese <mcanovese@users.noreply.github.com> Co-authored-by: Michele Veronesi <micheleveronesi@users.noreply.github.com> Co-authored-by: Francesco Trolese <50705762+ftrole@users.noreply.github.com>
1 parent 727d368 commit 87d910b

27 files changed

+618
-33
lines changed

.env.example

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
# COPIARE questo file chiamandolo .env
2-
STRIPE_TOKEN=
3-
4-
# Da impostare AWS_USER_POOL_ID se si vuole usare "serverles offline", sennò non è necessario per il deploy
5-
AWS_USER_POOL_ID=
2+
SERVICES=

.github/workflows/node.js.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
name: Tests
3+
4+
on:
5+
push:
6+
branches: [ develop ]
7+
pull_request:
8+
branches: [ develop ]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Use Node.js
18+
uses: actions/setup-node@v2
19+
with:
20+
node-version: 'v14.15.5'
21+
- run: npm install
22+
- run: npm run test

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
# Emporio Lambda - taxes
1+
# Emporio Lambda - taxes
2+
3+
## Main
4+
5+
[![Build Status](https://travis-ci.com/SWException/taxes.svg?branch=main)](https://travis-ci.com/SWException/taxes)
6+
7+
## Develop
8+
[![Build Status](https://travis-ci.com/SWException/taxes.svg?branch=develop)](https://travis-ci.com/SWException/taxes)
9+
10+
[![Tests](https://github.com/SWException/taxes/actions/workflows/node.js.yml/badge.svg)](https://github.com/SWException/taxes/actions/workflows/node.js.yml)
11+
12+
# Info
13+
14+
Microservice for tax management.
15+
16+
Project proposed by <a href="http://redbabel.com/">Red Babel</a>

openapi/openapi.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
openapi: 3.0.3
22
info:
33
title: EmporioLambda BE
4-
description: Queste sono le OpenAPI per il microservizio designato alla gestione delle tasse
4+
description: OpenAPI for taxes management
55
version: 0.1.0
66

77
servers:
8-
# Added by API Auto Mocking Plugin
98
- description: SwaggerHub API Auto Mocking
109
url: https://virtserver.swaggerhub.com/swexception4/OpenAPI/0.1.0/taxes
1110
- description: serverless offline

openapi/taxes.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
get: # questo serve anche ai prodotti quando deve rispondere al carrello
2-
summary: Richiesta lista aliquote IVA
3-
description: Ritorna l'elenco di tutte le aliquote IVA presenti
2+
summary: Get VAT taxes
3+
description: Return the list of all taxes in the system
44
tags:
55
- taxes
66
operationId: getTaxes
77
responses:
88
200:
9-
description: "elenco di tutte le aliquote IVA"
9+
description: "taxes list"
1010
content:
1111
application/json:
1212
schema:
@@ -23,7 +23,7 @@ get: # questo serve anche ai prodotti quando deve rispondere al carrello
2323
],
2424
}
2525
400:
26-
description: "Errore o nessuna aliquota presente"
26+
description: "request error"
2727
content:
2828
application/json:
2929
schema:
@@ -35,8 +35,8 @@ get: # questo serve anche ai prodotti quando deve rispondere al carrello
3535
}
3636

3737
post:
38-
summary: Inserisci nuova aliquota IVA
39-
description: Crea una nuova aliquota IVa definendo automaticamente l'ID, viene richiesto il valore e la descrizione
38+
summary: "Create a new VAT tax"
39+
description: "Create a new VAT tax passing the value in percentage and the description"
4040
tags:
4141
- taxes
4242
operationId: createTax
@@ -56,14 +56,14 @@ post:
5656
example: { value: 100, description: "IVA da pazzi" }
5757
responses:
5858
200:
59-
description: "Aliquota IVA Inserita"
59+
description: "Tax created"
6060
content:
6161
application/json:
6262
schema:
6363
$ref: "../schemas/response.json#/response"
6464
example: { status: "success", message: "aliquota IVA inserita " }
6565
400:
66-
description: "Aliquota IVA non inserita"
66+
description: "request error"
6767
content:
6868
application/json:
6969
schema:

openapi/taxesByID.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
get:
2-
summary: ritorna l'aliquota con ID
3-
description: Ritorna l'aliquota richiesta con ID passato via path param
2+
summary: Get the VAT tax by ID
3+
description: Return info about the tax associated with the passed ID
44
tags:
55
- taxes
66
parameters:
@@ -12,7 +12,7 @@ get:
1212
operationId: getTax
1313
responses:
1414
200:
15-
description: "Aliquota IVA con ID"
15+
description: "Tax returned"
1616
content:
1717
application/json:
1818
schema:
@@ -23,7 +23,7 @@ get:
2323
data: { id: "1", value: 4, description: "IVA Beni Essenziali" },
2424
}
2525
400:
26-
description: "Aliquota IVA con ID non presente"
26+
description: "Tax ID not present"
2727
content:
2828
application/json:
2929
schema:
@@ -35,8 +35,8 @@ get:
3535
}
3636

3737
patch:
38-
summary: Aggiorna il valore percentuale o la descrizione dell'aliquota
39-
description: Aggiorna percentuale o descrizione aliquota IVA tramite ID
38+
summary: Update tax
39+
description: Update value or description of the taxes associated with the passed ID
4040
tags:
4141
- taxes
4242
operationId: updateTax
@@ -61,14 +61,14 @@ patch:
6161
example: { id: "3", value: 22.5 }
6262
responses:
6363
200:
64-
description: "Aliquota IVA Aggiornata"
64+
description: "Update successful"
6565
content:
6666
application/json:
6767
schema:
6868
$ref: "../schemas/response.json#/response"
6969
example: { status: "success", message: "Aliquota IVA aggiornata" }
7070
400:
71-
description: "Aliquota IVA non aggiornata"
71+
description: "request error"
7272
content:
7373
application/json:
7474
schema:
@@ -80,8 +80,8 @@ patch:
8080
}
8181

8282
delete:
83-
summary: Rimuove l'aliquota IVA identificata dall'ID passato
84-
description: Rimuove l'aliquota IVA identificata dall'ID passato
83+
summary: Delete tax
84+
description: Remove the tax associated with the passed ID
8585
tags:
8686
- taxes
8787
operationId: removeTax
@@ -103,14 +103,14 @@ delete:
103103
type: boolean
104104
responses:
105105
200:
106-
description: "Aliquota IVA rimossa"
106+
description: "Tax deleted"
107107
content:
108108
application/json:
109109
schema:
110110
$ref: "../schemas/response.json#/response"
111111
example: { status: "success", message: "Aliquota IVA rimossa" }
112112
400:
113-
description: "Aliquota IVA non rimossa"
113+
description: "request error"
114114
content:
115115
application/json:
116116
schema:

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"babel-jest": "^26.6.3",
2222
"eslint-ts-naming-convention": "^1.2.1",
2323
"file-type": "^16.3.0",
24+
"immutable": "^4.0.0-rc.12",
2425
"json-schema-to-typescript": "^10.1.3",
2526
"jwk-to-pem": "^2.0.4",
2627
"node-fetch": "^2.6.1",

schemas/response.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
],
3333
"minimum": 100
3434
},
35+
"headers":{
36+
},
3537
"body": {
3638
"$ref": "#/response"
3739
}

schemas/taxes.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@
2323
},
2424
"editTax": {
2525
"allOf" : [
26-
{ "$ref": "#/tax" },
27-
{
28-
"required": ["id"]
29-
}
26+
{ "$ref": "#/tax" }
3027
]
3128
},
3229
"responseTaxes": {

serverless.yml

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ custom:
2626
provider:
2727
name: aws
2828
region: eu-central-1
29-
# profile: swexception
3029
runtime: nodejs12.x
3130
lambdaHashingVersion: "20201221"
3231
stage: ${opt:stage, 'dev'}
@@ -37,6 +36,7 @@ provider:
3736

3837
environment:
3938
AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
39+
SERVICES: ${env:SERVICES}
4040
REGION: ${self:provider.region}
4141

4242
iam:
@@ -49,16 +49,55 @@ provider:
4949
Resource: "*"
5050

5151
functions:
52+
getTaxes:
53+
handler: "src/handlers/getTaxes.HANDLER"
54+
events:
55+
- http:
56+
path: /taxes/
57+
method: GET
58+
cors: true
59+
createTax:
60+
handler: "src/handlers/createTax.HANDLER"
61+
events:
62+
- http:
63+
path: /taxes/
64+
method: POST
65+
cors: true
66+
getTax:
67+
handler: "src/handlers/getTax.HANDLER"
68+
events:
69+
- http:
70+
path: /taxes/{id}
71+
method: GET
72+
cors: true
73+
updateTax:
74+
handler: "src/handlers/updateTax.HANDLER"
75+
events:
76+
- http:
77+
path: /taxes/{id}
78+
method: PATCH
79+
cors: true
80+
removeTax:
81+
handler: "src/handlers/removeTax.HANDLER"
82+
events:
83+
- http:
84+
path: /taxes/{id}
85+
method: DELETE
86+
cors: true
5287

5388
resources:
5489
Resources:
5590
CategoriesTable:
5691
Type: AWS::DynamoDB::Table
5792
Properties:
58-
TableName: categories
93+
TableName: taxes
5994
AttributeDefinitions:
6095
- AttributeName: id
6196
AttributeType: "S"
97+
- AttributeName: value
98+
AttributeType: "S"
99+
- AttributeName: description
100+
AttributeType: "S"
62101
KeySchema:
63102
- AttributeName: id
64103
KeyType: HASH

0 commit comments

Comments
 (0)