Skip to content
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

feat : add run feature for trello provider #592

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

AbdelkarimBENGRINE
Copy link

@AbdelkarimBENGRINE AbdelkarimBENGRINE commented Oct 31, 2022

┆Issue is synchronized with this Trello card

@trafico-bot trafico-bot bot added the 🔍 Ready for Review Pull Request is not reviewed yet label Oct 31, 2022
internal/trelloprovider/model.go Show resolved Hide resolved
internal/trelloprovider/trello.go Outdated Show resolved Hide resolved
internal/trelloprovider/trello.go Outdated Show resolved Hide resolved
internal/trelloprovider/trello.go Outdated Show resolved Hide resolved
internal/trelloprovider/trello.go Outdated Show resolved Hide resolved
api/dvmodel.proto Outdated Show resolved Hide resolved
if err != nil {
return nil, fmt.Errorf("pull: %w", err)
}
tasks, err = dvstore.LoadTasks(s.h, s.schema, filters, s.opts.Logger)
tasks, err = dvstore.LoadTasks(s.h, s.schema, s.opts.TrelloToken, s.opts.TrelloApiKey, filters, s.opts.Logger)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you need Token & API KEY for loading from the cayley store ?

Copy link
Owner

Choose a reason for hiding this comment

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

Yup, this should not happen.

But maybe it's due to a bad design decision I made earlier?

@AbdelkarimBENGRINE can you tell us more?

Copy link
Author

Choose a reason for hiding this comment

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

this also surprised me but when I read Trello Api Doc
It is said that you have to provide both an api key and token unlike classic Oauth provider. I will look for implementation alternative if it causes too much problem in Depviz

if err != nil {
return nil, fmt.Errorf("pull: %w", err)
}
}

var tasks dvmodel.Tasks
tasks, err = dvstore.LoadTasks(s.h, s.schema, filters, s.opts.Logger)
tasks, err = dvstore.LoadTasks(s.h, s.schema, s.opts.TrelloToken, s.opts.TrelloApiKey, filters, s.opts.Logger)
Copy link
Collaborator

@MikaelVallenet MikaelVallenet Nov 2, 2022

Choose a reason for hiding this comment

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

Same as above

Copy link
Author

Choose a reason for hiding this comment

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

same answer as above :)

paths = append(paths, p)

case multipmuri.TrelloProvider:
cardsId, err := trello.GetCardsId(target.LocalID()[1:], trelloToken, trelloApiKey)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seem's weird to me to use Trello API to get informations for retrieve data on local store.
Is it the only way ?

Copy link
Owner

Choose a reason for hiding this comment

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

Yep same, but once again, it may come from a design limitation that I introduced before.

Maybe it makes sense to support lazy fetches at some points.

internal/trelloprovider/trello.go Outdated Show resolved Hide resolved
internal/dvcore/run.go Outdated Show resolved Hide resolved
case multipmuri.TrelloProvider:
go func(board multipmuri.Entity) {
defer wg.Done()
trelloprovider.FetchCard(ctx, board, trelloToken, trelloApiKey, target.LocalID()[1:], out)
Copy link
Owner

Choose a reason for hiding this comment

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

you should check target.LocalID() before calling [1:] in case it's empty.

I think it deserves a dedicated helper.

case multipmuri.TrelloProvider:
go func(board multipmuri.Entity) {
defer wg.Done()
trelloprovider.FetchCard(ctx, board, trelloToken, trelloApiKey, target.LocalID()[1:], out)
Copy link
Owner

Choose a reason for hiding this comment

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

Btw, from pullBatches, I expect my drivers to fetch not only Trello Card but also Trello Board.

The helper here should be named trelloprovider.FetchTarget or something more flexible I guess.

}

card := dvmodel.Task{
ID: quad.IRI(entity.String()),
Copy link
Owner

Choose a reason for hiding this comment

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

I'm not sure that entity.String is always unique. Maybe we can point to the same trello item with two different URLs.

Can you check in the input if there is no official URL instead maybe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔍 Ready for Review Pull Request is not reviewed yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants