Skip to content

Commit 7094d91

Browse files
committed
Cleanup API links
1 parent f5352de commit 7094d91

3 files changed

Lines changed: 10 additions & 15 deletions

File tree

broker/api/api-handler.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,9 @@ func (a *ApiHandler) Get(w http.ResponseWriter, r *http.Request) {
9595
index.Revision = vcs.GetCommit()
9696
index.Signature = vcs.GetSignature()
9797
index.Links.IllTransactionsLink = Link(r, Path(ILL_TRANSACTIONS_PATH), nil)
98-
index.Links.EventsLink = Link(r, Path(EVENTS_PATH), nil)
99-
index.Links.LocatedSuppliersLink = Link(r, Path(LOCATED_SUPPLIERS_PATH), nil)
10098
index.Links.PeersLink = Link(r, Path(PEERS_PATH), nil)
101-
index.Links.PatronRequestsLink = Link(r, Path(PATRON_REQUESTS_PATH), nil)
99+
index.Links.BorrowingRequestsLink = Link(r, Path(PATRON_REQUESTS_PATH), Query("side", "borrowing"))
100+
index.Links.LendingRequestsLink = Link(r, Path(PATRON_REQUESTS_PATH), Query("side", "lending"))
102101
WriteJsonResponse(w, index)
103102
}
104103

broker/oapi/open-api.yaml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,21 +130,17 @@ components:
130130
peersLink:
131131
type: string
132132
description: Link to peers
133-
eventsLink:
133+
borrowingRequestsLink:
134134
type: string
135-
description: Link to events
136-
locatedSuppliersLink:
135+
description: Link to borrowing requests
136+
lendingRequestsLink:
137137
type: string
138-
description: Link to located suppliers
139-
patronRequestsLink:
140-
type: string
141-
description: Link to patron request
138+
description: Link to lending requests
142139
required:
143-
- eventsLink
140+
- borrowingRequestsLink
144141
- illTransactionsLink
142+
- lendingRequestsLink
145143
- peersLink
146-
- locatedSuppliersLink
147-
- patronRequestsLink
148144
required:
149145
- revision
150146
- signature

broker/test/api/api-handler_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ func TestGetIndex(t *testing.T) {
9292
assert.Equal(t, vcs.GetCommit(), resp.Revision)
9393
assert.Equal(t, vcs.GetSignature(), resp.Signature)
9494
assert.Equal(t, getLocalhostWithPort()+api.ILL_TRANSACTIONS_PATH, resp.Links.IllTransactionsLink)
95-
assert.Equal(t, getLocalhostWithPort()+api.EVENTS_PATH, resp.Links.EventsLink)
9695
assert.Equal(t, getLocalhostWithPort()+api.PEERS_PATH, resp.Links.PeersLink)
97-
assert.Equal(t, getLocalhostWithPort()+api.LOCATED_SUPPLIERS_PATH, resp.Links.LocatedSuppliersLink)
96+
assert.Equal(t, getLocalhostWithPort()+api.PATRON_REQUESTS_PATH+"?side=borrowing", resp.Links.BorrowingRequestsLink)
97+
assert.Equal(t, getLocalhostWithPort()+api.PATRON_REQUESTS_PATH+"?side=lending", resp.Links.LendingRequestsLink)
9898
}
9999

100100
func TestGetEvents(t *testing.T) {

0 commit comments

Comments
 (0)