Skip to content

Commit

Permalink
change(proto): clean response + naming & use stream
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgechato committed Nov 1, 2023
1 parent 2cbba4e commit 4380270
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions proto/api/v1/mobile.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import "google/protobuf/empty.proto";

// Internal service
service Internal {
rpc GetAnimals(AnimalsRequest) returns (AnimalsResponse) {};
rpc GetArea(AreaRequest) returns (AreaResponse) {};
rpc GetAnimals(AnimalsRequest) returns (stream Animal) {};
rpc GetCoast(CoastRequest) returns (CoastResponse) {};
rpc GetLocation(LocationRequest) returns (LocationResponse) {};
}

Expand All @@ -25,7 +25,7 @@ service Bff {
}

// Location
message Location {
message LocationResponse {
int32 longitude = 1;
int32 latitude = 2;
string name = 3;
Expand All @@ -35,11 +35,7 @@ message LocationRequest {
string ip = 1;
}

message LocationResponse {
Location location = 1;
}

// Area
// Coast
enum Condition {
GOOD = 0;
MODERATE = 1;
Expand All @@ -50,11 +46,11 @@ enum Condition {
PROTECTED = 6;
}

message AreaRequest {
Location location = 1;
message CoastRequest {
LocationResponse location = 1;
}

message AreaResponse {
message CoastResponse {
string name = 1;
Condition condition = 2;
float temperature = 3;
Expand All @@ -69,16 +65,12 @@ message Animal {
}

message AnimalsRequest {
Location location = 1;
}

message AnimalsResponse {
repeated Animal animals = 1;
LocationResponse location = 1;
}

// BFF
message V1Response {
Location location = 1;
AreaResponse nearest_aquatic_location = 2;
LocationResponse location = 1;
CoastResponse nearest_aquatic_location = 2;
repeated Animal animals = 3;
}

0 comments on commit 4380270

Please sign in to comment.