Skip to content

Commit 140d2ec

Browse files
authored
Merge pull request #15 from souovan/python-flask
Adding endpoints and insomnia data export
2 parents b8fe659 + 598088d commit 140d2ec

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"_type":"export","__export_format":4,"__export_date":"2021-12-13T19:51:36.861Z","__export_source":"insomnia.desktop.app:v2021.6.0","resources":[{"_id":"req_262fa49d3e654cb796e5eaec81ff72a7","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424995597,"created":1637702811989,"url":"http://localhost:5000/usuarios","name":"usuarios","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424838149,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_32b768ff73bf41619251b605a04191d7","parentId":"wrk_fcb452a8f24b46e2ab183d1c243f80ec","modified":1639424837749,"created":1639424837749,"name":"read","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1639424837749,"_type":"request_group"},{"_id":"wrk_fcb452a8f24b46e2ab183d1c243f80ec","parentId":null,"modified":1637700392347,"created":1637700392347,"name":"python-flask","description":"","scope":"collection","_type":"workspace"},{"_id":"req_a38dabe64dd64f188cf304fe473beacd","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424997534,"created":1638130019791,"url":"http://localhost:5000/usuario/919d64e6-c102-47b8-81e2-47d18fded04b","name":"usuario/<id>","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424838124,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_d3c26699e49b47da9549c835c42c7d88","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424942475,"created":1639424570818,"url":"http://localhost:5000/categoria_usuarios","name":"categoria usuarios","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424838099,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_646356132304469590d97a4f102c5565","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424878067,"created":1639424610568,"url":"http://localhost:5000/permissao_acesso","name":"permissao acesso","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424838049,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_d15d65ecbb5a4cd68003905e0ab65ba0","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424880318,"created":1639424557015,"url":"http://localhost:5000/categoria_fornecedores","name":"categoria fornecedores","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424838024,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_855a68c5655047ba86881e14a2703967","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424873265,"created":1639424583153,"url":"http://localhost:5000/condicao_pagamento","name":"condicao pagamentos","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424837949,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_1bb21ccd7d534db89af28c97caafe0a7","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424871696,"created":1639424594029,"url":"http://localhost:5000/cotacao_compra","name":"cotacao compra","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424837899,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_60d0262d9167460f90875c35ab779a98","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424882070,"created":1639424529038,"url":"http://localhost:5000/categoria_clientes","name":"categoria clientes","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424837874,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_58d380ef0c274d269705c5f34f345d9d","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424884820,"created":1638042558608,"url":"http://localhost:5000/vendedores","name":"vendedores","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424837855.25,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_8b7755abd86f4eaa9107b4ebdc563785","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424870134,"created":1639424602646,"url":"http://localhost:5000/item_orcamento","name":"item orcamento","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424837849,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_d02a1e1efde8434f82ee1ac8ad7f574d","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424894425,"created":1638042200864,"url":"http://localhost:5000/titulos_a_pagar","name":"titulos a pagar","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424837824,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_559d9d5fb12d42fb920013a6cfe0d3ab","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424892670,"created":1638042418142,"url":"http://localhost:5000/vendas","name":"vendas","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424837799,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_3dc68aae01a14f4c9b6377e83139daed","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424896104,"created":1638041873389,"url":"http://localhost:5000/produtos","name":"produtos","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424837749,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_3048994f23534e63a1787d9246fdff02","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424898780,"created":1638041585640,"url":"http://localhost:5000/orcamentos","name":"orcamentos","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424837699,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_c972d6b0681b4c988b5a0903e5f61f4b","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424902349,"created":1638040985759,"url":"http://localhost:5000/fornecedores","name":"fornecedores","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424837649,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_70091688e44f496cbe51b28c029b4775","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424904779,"created":1638040639721,"url":"http://localhost:5000/estoque","name":"estoque","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424837599,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_eb962bc1ac9f4418bb320f203232d370","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424906735,"created":1638026927976,"url":"http://localhost:5000/compras","name":"compras","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424837549,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_8f66e0605a4d40c7a893a3a128346830","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424917343,"created":1638026068717,"url":"http://localhost:5000/agendamentos","name":"agendamentos","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424837524,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_629d38fa831244fa863e8362f644d094","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424908330,"created":1638026610780,"url":"http://localhost:5000/clientes","name":"clientes","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424837499,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_ef07bd1fcf454ad69a333b2ca3640612","parentId":"fld_32b768ff73bf41619251b605a04191d7","modified":1639424981402,"created":1637700685124,"url":"http://localhost:5000/test","name":"test","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1639424837449,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"env_1a3772eaa2c4ec3516f1870b5232e61a4e064276","parentId":"wrk_fcb452a8f24b46e2ab183d1c243f80ec","modified":1639425011327,"created":1637700392375,"name":"Base Environment","data":{},"dataPropertyOrder":{},"color":null,"isPrivate":false,"metaSortKey":1637700392375,"_type":"environment"},{"_id":"jar_1a3772eaa2c4ec3516f1870b5232e61a4e064276","parentId":"wrk_fcb452a8f24b46e2ab183d1c243f80ec","modified":1637700392378,"created":1637700392378,"name":"Default Jar","cookies":[],"_type":"cookie_jar"},{"_id":"spc_341f292becf94aaca897be39522fa6a8","parentId":"wrk_fcb452a8f24b46e2ab183d1c243f80ec","modified":1637700392360,"created":1637700392360,"fileName":"python-flask","contents":"","contentType":"yaml","_type":"api_spec"}]}

python-flask/src/app.py

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,4 +464,86 @@ def all_sellers():
464464
current_sellers['login'] = sellers.login
465465
current_sellers['senha'] = sellers.senha
466466
output.append(current_sellers)
467+
return jsonify(output), 200
468+
469+
@app.route('/categoria_clientes', methods=['GET'])
470+
def all_client_categories():
471+
all_client_categories = Client_category.query.all()
472+
output = []
473+
for categories in all_client_categories:
474+
current_categories = {}
475+
current_categories['id_categoria_cliente'] = categories.id_categoria_cliente
476+
current_categories['nome_categoria_cliente'] = categories.nome_categoria_cliente
477+
output.append(current_categories)
478+
return jsonify(output), 200
479+
480+
@app.route('/categoria_fornecedores', methods=['GET'])
481+
def all_providers_categories():
482+
all_providers_categories = Provider_category.query.all()
483+
output = []
484+
for providers in all_providers_categories:
485+
current_providers = {}
486+
current_providers['id_categoria_fornecedor'] = providers.id_categoria_fornecedor
487+
current_providers['nome_categoria_fornecedor'] = providers.nome_categoria_fornecedor
488+
output.append(current_providers)
489+
return jsonify(output), 200
490+
491+
@app.route('/categoria_usuarios', methods=['GET'])
492+
def all_users_categories():
493+
all_users_categories = User_category.query.all()
494+
output = []
495+
for users in all_users_categories:
496+
current_users = {}
497+
current_users['id_categoria_usuario'] = users.id_categoria_usuario
498+
current_users['nome_categoria_usuario'] = users.nome_categoria_usuario
499+
current_users['fk_id_permissao_acesso'] = users.fk_id_permissao_acesso
500+
output.append(current_users)
501+
return jsonify(output), 200
502+
503+
@app.route('/condicao_pagamento', methods=['GET'])
504+
def all_payment_terms():
505+
all_payment_terms = Payment_terms.query.all()
506+
output = []
507+
for terms in all_payment_terms:
508+
current_terms = {}
509+
current_terms['id_condicao_pagamento'] = terms.id_condicao_pagamento
510+
current_terms['nome_condicao_pagamento'] = terms.nome_condicao_pagamento
511+
output.append(current_terms)
512+
return jsonify(output), 200
513+
514+
@app.route('/cotacao_compra', methods=['GET'])
515+
def all_purchase_quotations():
516+
all_purchase_quotations = Purchase_quotation.query.all()
517+
output = []
518+
for quotations in all_purchase_quotations:
519+
current_quotations = {}
520+
current_quotations['id_cotacao_compra'] = quotations.id_cotacao_compra
521+
current_quotations['fk_id_fornecedor'] = quotations.fk_id_fornecedor
522+
current_quotations['fk_id_usuario'] = quotations.fk_id_usuario
523+
current_quotations['valor_total'] = quotations.valor_total
524+
current_quotations['data_cotacao'] = quotations.data_cotacao
525+
output.append(current_quotations)
526+
return jsonify(output), 200
527+
528+
@app.route('/item_orcamento', methods=['GET'])
529+
def all_budget_itens():
530+
all_budget_itens = Budget_item.query.all()
531+
output = []
532+
for items in all_budget_itens:
533+
current_items = {}
534+
current_items['id_item_orcamento'] = items.id_item_orcamento
535+
current_items['fk_id_cotacao_compra'] = items.fk_id_cotacao_compra
536+
current_items['fk_id_produto'] = items.fk_id_produto
537+
output.append(current_items)
538+
return jsonify(output), 200
539+
540+
@app.route('/permissao_acesso', methods=['GET'])
541+
def all_access_permissions():
542+
all_access_permissions = Access_permissions.query.all()
543+
output = []
544+
for permissions in all_access_permissions:
545+
current_permissions = {}
546+
current_permissions['id_permissao_acesso'] = permissions.id_permissao_acesso
547+
current_permissions['nome_permissao'] = permissions.nome_permissao
548+
output.append(current_permissions)
467549
return jsonify(output), 200

0 commit comments

Comments
 (0)