Skip to content

[datasources] Organize repositories into projects #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

evamillan
Copy link
Contributor

This PR splits repository data into repository and dataset. A repository consists of a datasource type and a URI, while a dataset consists of a related project, a category, a task and a repository.

The PR removes the /datasources/add_repository and /datasources/repositories views and replaces them with REST endpoints to list and manage datasets:

  • List a project's datasets: GET /ecosystems/<name>/project/<name>/datasets/. Can be filtered by datasource, category and URI.
  • Create a dataset (also creates the repository if it does not exist): POST /ecosystems/<name>/project/<name>/datasets/
  • Get a single dataset: GET /ecosystems/<name>/project/<name>/datasets/<id>/
  • Delete a dataset (also cancels task and deletes the repository if it does not have any other datasets): DELETE /ecosystems/<name>/project/<name>/datasets/<id>/
  • List a project's children (subprojects and datasets): GET /ecosystems/<name>/project/<name>/children/. Can be filtered by term.

Copy link
Member

@sduenas sduenas left a comment

Choose a reason for hiding this comment

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

Datasets should be only for internal representation. Users shouldn't have to deal with that. I think it's better if the have access to the repositories with endpoint such as:

/ecosystems/<eco>/projects/<project>/repos/
/ecosystems/<eco>/projects/<project>/repos/<id>
/ecosystems/<eco>/projects/<project>/repos/<id>/categories/<category>

Where <id> should be either a or numerical id build from the repository url + ecosystem name. This will make easier to indentify a repository inside the same ecosystem. The categories can be something like issues, commits, etc.

I understand this is more complicated to implement but it will make users life easier. If our internal representation is too complicated for representing this, we can change it to find something better.

Removes the 'category' and 'task' fields from the 'Repository'
model and adds them to a new 'DataSet' model. DataSets also
have a related project and repository.

Signed-off-by: Eva Millán <[email protected]>
List a project's repositories:
GET /ecosystems/<name>/project/<name>/repos/

Create a dataset (also creates the repository if it does not exist):
POST /ecosystems/<name>/project/<name>/repos/
data = { uri, datasource_type, category, scheduler }

Get a single repository:
GET /ecosystems/<name>/project/<name>/repos/<uuid>/

Get a dataset from a repository:
GET /ecosystems/<name>/project/<name>/repos/<uuid>/categories/<category>

Delete a dataset (also cancels task):
DELETE /ecosystems/<name>/project/<name>/repos/<uuid>/categories/<category>

List a project's children (subprojects and repositories):
GET /ecosystems/<name>/project/<name>/children/

Signed-off-by: Eva Millán <[email protected]>
@evamillan
Copy link
Contributor Author

I updated the PR to add a uuid field to the repositories and replace the endpoints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants