Add the following code to your project's shard.yml under:
dependencies
to use in production
- OR -
development_dependencies
to use in development
aius-salesd
— Une micro-caisse pour une grande associationCaisse pour l’AIUS écrite en Crystal.
crystal deps build
;Pour compiler :
crystal deps build
Pour exécuter :
$ ./bin/aius_caisse --help
-b HOST, --bind HOST Host to bind (defaults to 0.0.0.0)
-p PORT, --port PORT Port to listen for connections (defaults to 3000)
-s, --ssl Enables SSL
--ssl-key-file FILE SSL key file
--ssl-cert-file FILE SSL certificate file
-h, --help Shows this help
$ ./bin/aius_caisse
[development] Kemal is ready to lead at http://0.0.0.0:3000
Kemal is going to take a rest!
POST /products
{
"id": "<Int32>",
"name": "<String>",
"category"?: "<Int32> | Nil"
"price": "<Float64>"
}
{
"id": "<Int32>",
"name": "<String>",
"category"?: "<Int32> | Nil"
"price": "<Float64>"
}
GET /products
[{
"id": "<Int32>",
"name": "<String>",
"category"?: "<Int32> | Nil"
"price": "<Float64>"
},
...
]
GET /product/:id
{
"id": "<Int32>",
"name": "<String>",
"category"?: "<Int32> | Nil"
"price": "<Float64>"
}
{
"status": "error",
"message": "product not found"}
DELETE /product/:id
{
"status": ok
}
{
"status": "error",
"message": "product not found"
}
PUT /product/:id
{
"id"?: "<Int32>",
"name"?: "<String>",
"category"?: "<Int32> | Nil"
"price"?: "<Float64>"
}
{
"id": "<Int32>",
"name": "<String>",
"category"?: "<Int32> | Nil"
"price": "<Float64>"
}
POST /categories
{
"name": "<String>"
}
{
"id": "<Int32>",
"name": "<String>"
}
GET /categories
[{
"id": "<Int32>",
"name": "<String>"
},
...
]
GET /category/:id
{
"id": "<Int32>",
"name": "<String>"
}
{
"status": "error",
"message": "category not found"
}
DELETE /category/:id
{
"status": "ok"
}
{
"status": "error",
"message": "category not found"
}
PUT /category/:id
{
"name": "<String>",
}
{
"id": "<Int32>",
"name": "<String>"
}
GET /sale?begin="%Y-%m-%d"&end="%Y-%m-%d"
Renvoie la liste des vente entre deux date.
Entrée :
Sortie :
[
{
"id": "<id>",
"seller": "<uuid>",
"sale_products": [
{
"product": "<id>",
"quantity": "<Int32>"
},
...
],
"date": "<date>"
},
...
]
POST /sale
Enregistre une vente dans la base de donnée.
Entrée :
{
"data" :
[
{
"id": "<id>",
"quantity": "<Int32>"
},
...
]
}
Sortie
{
"status": "OK"
}
ou s'il y a une erreur
{
"status": "error",
"message": "<String>"
}
DELETE /sale/:id
Supprime une vente.
Sortie :
{
"status": "OK"
}
ou s'il y a une erreur
{
"status": "error",
"message": "No row affected"
}
XXX: Fill me