-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add endpoint to expose service ids with assigned block ids (#24)
- Loading branch information
Showing
7 changed files
with
126 additions
and
2 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
app/src/main/java/org/transitclock/api/data/ApiServiceId.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* (C)2023 */ | ||
package org.transitclock.api.data; | ||
|
||
import java.util.List; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Data; | ||
|
||
/** | ||
* A short description of a serviceId. For when outputting list of block IDs for service. | ||
*/ | ||
@Data | ||
public class ApiServiceId { | ||
|
||
@JsonProperty | ||
private String id; | ||
|
||
@JsonProperty | ||
private List<String> blockIds; | ||
|
||
public ApiServiceId(String serviceId, List<String> blockIds) { | ||
this.id = serviceId; | ||
this.blockIds = blockIds; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
app/src/main/java/org/transitclock/api/data/ApiServiceIdResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* (C)2023 */ | ||
package org.transitclock.api.data; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Data; | ||
|
||
/** | ||
* For outputting simple list of unsorted service IDs with lists of sorted block IDs | ||
*/ | ||
@Data | ||
public class ApiServiceIdResponse { | ||
|
||
@JsonProperty | ||
private List<ApiServiceId> serviceIds; | ||
|
||
/** | ||
* Creates the API unsorted version of list of IDs. | ||
* | ||
* @param services | ||
*/ | ||
public ApiServiceIdResponse(Map<String, List<String>> services) { | ||
serviceIds = services.entrySet() | ||
.stream() | ||
.map(entry -> new ApiServiceId(entry.getKey(), entry.getValue())) | ||
.collect(Collectors.toList()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters