ORDER
Historico de pedidos
POST /order/
Adiciona historico dos pedidos
{
"user" : "5aecc1e68c879d2adf444db6",
"supplier" : "5ab94945d0032b2d949634d8"
}
GET /order/all?populate=true
?populate=true => facultativo, retorna, apenas sem isso retorna historico dos pedidos `
SUPPLIER
POST /supplier/
Adiciona supplier
{
name: {type: String, required: true},
phone: {type: String, required: true},
}
GET /supplier/all?lat=1&long=1&dist=10000
retorna json com todos os fornecedores
POST /supplier/
Adiciona supplier
{
name: {type: String, required: true},
phone: {type: String, required: true},
}
USER
POST /user/
Adiciona user
{
name: {type: String, required: true},
email: {type: String, required: true, unique: true},
password: {type: String, required: true }
}
POST /user/fav
Adiciona supplier favortos
{
"supplierId": "5ab94945d0032b2d949634d8" //objectID
}
DELETE /user/fav
remove supplier favortos
{
"supplierId": "5ab94945d0032b2d949634d8"
}
GET /user/fav
retorna supplier favortos
LOGIN
POST /login/
Efetua login
{
email: {type: String, required: true },
password: {type: String, required: true }
}
retorna
return res.json({
success: true,
token: token,
user: user
});
PADRÕES DE RETORNO
SUCESSO
-> STATUS 200
-> NÂO CASO ESPECIFICADO SUCESSO RETORNA {} OBJETO VAZIO
ERROS / INSUCESSOS
-> STATUS 500 erro interno do servidor
-> STATUS 404 ROTA NAO ENCONTRADA