Skip to content

Instantly share code, notes, and snippets.

@gusflopes
Last active March 8, 2022 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gusflopes/fc9e55193f1ca1b6e5a8c764f555e37d to your computer and use it in GitHub Desktop.
Save gusflopes/fc9e55193f1ca1b6e5a8c764f555e37d to your computer and use it in GitHub Desktop.
## Chamadas à API
Endereço do servidor atual: http://159.223.96.204:3333/health
### Fluxo de Autenticação
1. Criar usuário chamando a rota POST /auth/register
2. Fazer login chamando a rota POST /auth/login (email, password)
3. Criar "Tenant" chamando a rota POST /auth/tenants (name)
4. Listar "Tenant chamando a rota GET /auth/tenants
5. Fazer Login no "Tenant" chamando a rota POST /auth/tenants/login (passndo como querystring => select=<tenant_id>)
** Após isso, as rotas vão precisar que seja enviado o tenant_token **
** As rotas de Tenant utilizam apenas o `user_token` **
### Routes
❯ node ace list:routes
┌────────────┬─────────────────────────────────────┬─────────────────────────────────────────┬──────────────────────┬───────────────────────────┐
│ Method │ Route │ Handler │ Middleware │ Name │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /uploads/* │ Closure │ │ drive.local.serve │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ POST │ /auth/login │ AuthController.login │ │ │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ POST │ /auth/register │ AuthController.register │ │ │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ POST │ /auth/tenants │ TenantsController.store │ auth │ │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /auth/tenants │ TenantsController.index │ auth │ │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ POST │ /auth/tenants/login │ AuthController.selectTenant │ auth │ │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /v1/profile │ profile/ProfileController.index │ auth,uuid,permission │ profile.index │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ POST │ /v1/profile │ profile/ProfileController.store │ auth,uuid,permission │ profile.store │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /v1/profile/tax │ profile/TaxProfileController.index │ auth,uuid,permission │ profile_tax.index │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ POST │ /v1/profile/tax │ profile/TaxProfileController.store │ auth,uuid,permission │ profile_tax.store │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /v1/customers │ PartiesController.index │ auth,uuid,permission │ customers.index │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ POST │ /v1/customers │ PartiesController.store │ auth,uuid,permission │ customers.store │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /v1/customers/:id │ PartiesController.show │ auth,uuid,permission │ customers.show │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ PUT, PATCH │ /v1/customers/:id │ PartiesController.update │ auth,uuid,permission │ customers.update │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ DELETE │ /v1/customers/:id │ PartiesController.destroy │ auth,uuid,permission │ customers.destroy │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /v1/services │ ServicesController.index │ auth,uuid,permission │ services.index │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ POST │ /v1/services │ ServicesController.store │ auth,uuid,permission │ services.store │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /v1/services/:id │ ServicesController.show │ auth,uuid,permission │ services.show │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ PUT, PATCH │ /v1/services/:id │ ServicesController.update │ auth,uuid,permission │ services.update │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ DELETE │ /v1/services/:id │ ServicesController.destroy │ auth,uuid,permission │ services.destroy │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /v1/sales │ SalesController.index │ auth,uuid,permission │ sales.index │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ POST │ /v1/sales │ SalesController.store │ auth,uuid,permission │ sales.store │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /v1/sales/:id │ SalesController.show │ auth,uuid,permission │ sales.show │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ PUT, PATCH │ /v1/sales/:id │ SalesController.update │ auth,uuid,permission │ sales.update │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ DELETE │ /v1/sales/:id │ SalesController.destroy │ auth,uuid,permission │ sales.destroy │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /v1/sales/:sale_id/installments │ sales/SaleInstallmentsController.index │ auth,uuid,permission │ sales.installments.index │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /v1/sales/:sale_id/installments/:id │ sales/SaleInstallmentsController.show │ auth,uuid,permission │ sales.installments.show │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ PUT, PATCH │ /v1/sales/:sale_id/installments/:id │ sales/SaleInstallmentsController.update │ auth,uuid,permission │ sales.installments.update │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /v1/invoices │ ServiceInvoicesController.index │ auth │ invoices.index │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ POST │ /v1/invoices │ ServiceInvoicesController.store │ auth │ invoices.store │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /v1/invoices/:id │ ServiceInvoicesController.show │ auth │ invoices.show │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ PUT, PATCH │ /v1/invoices/:id │ ServiceInvoicesController.update │ auth │ invoices.update │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ DELETE │ /v1/invoices/:id │ ServiceInvoicesController.destroy │ auth │ invoices.destroy │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ POST │ /v1/plugnotas │ PlugNotasController.store │ auth │ │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /v1/plugnotas/:id │ PlugNotasController.get │ auth │ │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /v1/plugnotas/:id/full │ PlugNotasController.getFull │ auth │ │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ POST │ /v1/plugnotas/:id/email │ PlugNotasController.sendEmail │ auth │ │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /v1/plugnotas/:id/pdf │ PlugNotasController.getPdf │ auth │ │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /v1/plugnotas/:id/xml │ PlugNotasController.getXml │ auth │ │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ POST │ /v1/invoices/:id/certificate │ ServiceInvoicesController.certificate │ auth │ │
├────────────┼─────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────┼───────────────────────────┤
│ HEAD, GET │ /health │ Closure │ │ │
└────────────┴─────────────────────────────────────┴─────────────────────────────────────────┴──────────────────────┴───────────────────────────┘
gusflopes in hl_sales on  master [?]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment