Skip to content

api: list repository sources - #2298

Open
ousamabenyounes wants to merge 1 commit into
PlakarKorp:mainfrom
ousamabenyounes:fix/issue-1223-repository-sources
Open

api: list repository sources#2298
ousamabenyounes wants to merge 1 commit into
PlakarKorp:mainfrom
ousamabenyounes:fix/issue-1223-repository-sources

Conversation

@ousamabenyounes

Copy link
Copy Markdown
Contributor

Summary

  • Add GET /api/repository/sources.
  • Return distinct snapshot source triplets as {type, origin, directory} entries.
  • Keep the response shape consistent with other repository list endpoints: total plus items.
Q A
Issues Fix #1223
Tests go test ./api -run TestRepositorySourcesDeduplicatesSnapshotSources -count=1; go test ./api -count=1; ./run-ci.sh

Test verification (RED -> GREEN)

RED on upstream-base behavior with only the new test:

--- FAIL: TestRepositorySourcesDeduplicatesSnapshotSources (0.25s)
    api_repository_test.go:272:
        Error:       Not equal:
                    expected: 200
                    actual  : 404
        Messages:    body={"error":{"code":"not-found","message":"API endpoint not found"}}
FAIL
FAIL    github.com/PlakarKorp/plakar/api  0.271s

GREEN after the implementation:

ok      github.com/PlakarKorp/plakar/api  0.314s
ok      github.com/PlakarKorp/plakar/api  12.570s

Local CI replay on the final commit:

ok      github.com/PlakarKorp/plakar/api  15.298s  coverage: 73.3% of statements
ok      github.com/PlakarKorp/plakar/utils        0.026s  coverage: 71.4% of statements

The local CI runner also completed go build -v ./..., the full go test -p 4 -coverprofile=coverage.out -covermode=atomic ./..., and GOOS=windows GOARCH=amd64 go build -v . successfully.

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.

Create an API endpoint listing the distinct sources in a Kloset

1 participant