Skip to content

Add bricks filter#335

Open
martacarbone wants to merge 3 commits intomainfrom
add-bricks-filter
Open

Add bricks filter#335
martacarbone wants to merge 3 commits intomainfrom
add-bricks-filter

Conversation

@martacarbone
Copy link
Copy Markdown
Contributor

Motivation

Add a filter to filter out bricks.
Add the list of the supported bricks to a brick.
Create a filter to filter out unsupported bricks.

Change description

Additional Notes

Reviewer checklist

  • PR addresses a single concern.
  • PR title and description are properly filled.
  • Changes will be merged in main.
  • Changes are covered by tests.
  • Logging is meaningful in case of troubleshooting.

Comment on lines +57 to 59
res := BrickListResult{Bricks: make([]BrickListItem, len(s.bricksIndex.ListBricks(nil)))}
for i, brick := range s.bricksIndex.ListBricks(filter) {
res.Bricks[i] = BrickListItem{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am not sure, but I guess s.bricksIndex.ListBricks(...) should have the same param?

Suggested change
res := BrickListResult{Bricks: make([]BrickListItem, len(s.bricksIndex.ListBricks(nil)))}
for i, brick := range s.bricksIndex.ListBricks(filter) {
res.Bricks[i] = BrickListItem{
bricks := s.bricksIndex.ListBricks(filter)
res := BrickListResult{Bricks: make([]BrickListItem, len(bricks))}
for i, brick := range bricks {

// act
got := b.ListBricks(tt.filter)
require.Equal(t, len(tt.wantBricks), len(got))
require.Equal(t, tt.wantBricks[0].ID, got[0].ID)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what about the this?

Suggested change
require.Equal(t, tt.wantBricks[0].ID, got[0].ID)
require.Equal(t, tt.wantBricks, got)

Comment on lines +802 to +808
parameters:
- description: If true, only returns bricks supported by the current board.
in: query
name: supported_only
schema:
description: If true, only returns bricks supported by the current board.
type: boolean
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

duplicated generation of the description.. something wrong with the docs.go??

@lucarin91
Copy link
Copy Markdown
Contributor

This is superseded by #343

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.

3 participants