Skip to content
This repository has been archived by the owner on May 28, 2023. It is now read-only.

Adiciona endpoint para publicar datasets #45

Merged
merged 19 commits into from
Sep 8, 2019

Conversation

lucasaarcoverde
Copy link
Contributor

Resolve #43
Adiciona endpoint para publicar datasets e salva os JSON em memória

Forma de testar:
Fazer um post no endpoint http://localhost:8080/datasets/publish com um exemplo de metadata no body.

Para testar o que está sendo salvo basta fazer um get para o endpoint http://localhost:8080/datasets/metadata

@lucasmedeiros lucasmedeiros added melhoria Nova funcionalidade ou sugestão novo endpoint Sugestão de novo endpoint novo laguinho Issues relacionadas à reformulação do laguinho labels Sep 6, 2019
laguinho/routes/datasets.py Outdated Show resolved Hide resolved
laguinho/routes/datasets.py Outdated Show resolved Hide resolved
laguinho/routes/datasets.py Outdated Show resolved Hide resolved
laguinho/models/metadata.py Outdated Show resolved Hide resolved
laguinho/models/metadata.py Outdated Show resolved Hide resolved
Copy link
Contributor

@lucasmedeiros lucasmedeiros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muito obrigado pelo interesse no projeto, ficou ótimo! Tô mandando algumas correçõeszinhas pequenas, algumas @JoseRenan até já tinha comentado. No mais, ficou muito bom mesmo.

laguinho/models/metadata.py Outdated Show resolved Hide resolved
laguinho/models/metadata.py Outdated Show resolved Hide resolved
laguinho/routes/datasets.py Outdated Show resolved Hide resolved
laguinho/routes/datasets.py Outdated Show resolved Hide resolved
@lucasmedeiros lucasmedeiros added the em andamento Tem alguém trabalhando nisso! label Sep 6, 2019
@@ -0,0 +1,21 @@
from marshmallow import Schema, fields, pprint, validate

def get_required_error(attribute):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seria bom colocar isso em outro arquivo dentro do models/, porque outros schemas podem usar

validate=validate.OneOf(["json", "csv"]),
required=True,
error_messages=get_required_error("format"))
contributable = fields.Bool()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Poderia inicializar o schema logo aqui depois da classe:

dataset_metadata = DatasetMetadataSchema()

pra não precisar ficar instanciando quando for usar, é OK ter o schema como um singleton

@@ -0,0 +1,17 @@
from flask import Blueprint, request, jsonify
from laguinho.models.metadata import DatasetMetadataSchema
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

já importar a instancia do schema, invés da classe como sugerido na outra issue


@datasets.route("/datasets", methods=['GET'])
def get_datasets():
return jsonify(datasets_metadata)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

não dá pra usar o schema aqui também? pra gente padronizar uma forma só de parse pra JSON?

Copy link
Member

@JoseRenan JoseRenan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Topppp meu patrão, mto bom msm!!! Valeu ❤️

Copy link
Contributor

@lucasmedeiros lucasmedeiros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Show de bola!

@lucasmedeiros lucasmedeiros merged commit dbf416c into OpenDevUFCG:development Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
em andamento Tem alguém trabalhando nisso! melhoria Nova funcionalidade ou sugestão novo endpoint Sugestão de novo endpoint novo laguinho Issues relacionadas à reformulação do laguinho
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants