Skip to content

Commit

Permalink
Merge pull request #47 from moevm/back-29
Browse files Browse the repository at this point in the history
create buying system and getting plant
  • Loading branch information
AnjeZenda authored Dec 1, 2024
2 parents 46c7192 + 1e1d127 commit 6c4a0f4
Show file tree
Hide file tree
Showing 11 changed files with 1,260 additions and 366 deletions.
64 changes: 52 additions & 12 deletions server/api/plants/v1/plants.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";

service PlantsAPI {
rpc GetExampleV1 (GetExampleV1Request) returns (GetExampleV1Response) {
option (google.api.http) = {
get: "/example"
};
};

rpc GetPlantsWithCareRulesV1 (GetPlantsWithCareRulesV1Request) returns (GetPlantsWithCareRulesV1Response) {
option (google.api.http) = {
get: "/api/care"
Expand All @@ -27,6 +21,11 @@ service PlantsAPI {
};
};

rpc GetPlantByIdV1 (GetPlantByIdV1Request) returns (GetPlantByIdV1Response) {
option (google.api.http) = {
get: "/api/palnts/{id}"
};
};
rpc GetCareRuleV1 (GetCareRuleV1Request) returns (GetCareRuleV1Response) {
option (google.api.http) = {
get: "/api/care/{species}"
Expand All @@ -52,6 +51,13 @@ service PlantsAPI {
body: "*"
};
};

rpc BuyPlantV1 (BuyPlantV1Request) returns (BuyPlantV1Response) {
option (google.api.http) = {
post: "/api/plants/buy"
body: "*"
};
};
}

message CreatePlantV1Request {
Expand Down Expand Up @@ -82,10 +88,10 @@ message GetFilteredPlantsV1Request{
string species = 1;
string type = 2;
repeated string size = 3;
repeated string light_condition = 4;
repeated string watering_frequency = 5;
repeated string temperature_regime = 6;
repeated string care_complexity = 7;
repeated string lightCondition = 4;
repeated string wateringFrequency = 5;
repeated string temperatureRegime = 6;
repeated string careComplexity = 7;
string description = 8;
string place = 9;
float priceFrom = 10;
Expand Down Expand Up @@ -164,6 +170,40 @@ message GetPlantsWithCareRulesV1Response {
repeated Plant plants = 1;
}

message GetExampleV1Request {}
message GetPlantByIdV1Request{
string id = 1;
}
message GetPlantByIdV1Response{
message Plant {
string species = 1;
string type = 2;
string size = 3;
string lightCondition = 4;
string wateringFrequency = 5;
string temperatureRegime = 6;
string careComplexity = 7;
string description = 8;
string place = 9;
string image = 10;
float price = 11;
}
message User {
string photo = 1;
string name = 2;
string surname = 3;
string fatherName = 4;
}
Plant plant = 1;
User user = 2;
}

message BuyPlantV1Request{
string sellerId = 1;
string buyerId = 2;
string plantId = 3;
string species = 4;
float price = 5;
}
message BuyPlantV1Response{

message GetExampleV1Response {}
}
214 changes: 171 additions & 43 deletions server/gen/docs/plants/v1/plants.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,36 @@
]
}
},
"/api/palnts/{id}": {
"get": {
"operationId": "PlantsAPI_GetPlantByIdV1",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v1GetPlantByIdV1Response"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"PlantsAPI"
]
}
},
"/api/palnts/{page}/{size}/{sort}": {
"post": {
"operationId": "PlantsAPI_GetFilteredPlantsV1",
Expand Down Expand Up @@ -184,6 +214,38 @@
]
}
},
"/api/plants/buy": {
"post": {
"operationId": "PlantsAPI_BuyPlantV1",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v1BuyPlantV1Response"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1BuyPlantV1Request"
}
}
],
"tags": [
"PlantsAPI"
]
}
},
"/api/plants/{page}/{size}/{sort}": {
"get": {
"operationId": "PlantsAPI_GetPlantsV1",
Expand Down Expand Up @@ -233,48 +295,9 @@
"PlantsAPI"
]
}
},
"/example": {
"get": {
"operationId": "PlantsAPI_GetExampleV1",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v1GetExampleV1Response"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"tags": [
"PlantsAPI"
]
}
}
},
"definitions": {
"CareRuleUser": {
"type": "object",
"properties": {
"userId": {
"type": "string"
},
"userName": {
"type": "string"
},
"userSurname": {
"type": "string"
},
"userFatherName": {
"type": "string"
}
}
},
"GetFilteredPlantsV1RequestFilter": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -369,11 +392,35 @@
}
}
},
"v1BuyPlantV1Request": {
"type": "object",
"properties": {
"sellerId": {
"type": "string"
},
"buyerId": {
"type": "string"
},
"plantId": {
"type": "string"
},
"species": {
"type": "string"
},
"price": {
"type": "number",
"format": "float"
}
}
},
"v1BuyPlantV1Response": {
"type": "object"
},
"v1CareRule": {
"type": "object",
"properties": {
"user": {
"$ref": "#/definitions/CareRuleUser"
"$ref": "#/definitions/v1CareRuleUser"
},
"description": {
"type": "string"
Expand All @@ -384,6 +431,23 @@
}
}
},
"v1CareRuleUser": {
"type": "object",
"properties": {
"userId": {
"type": "string"
},
"userName": {
"type": "string"
},
"userSurname": {
"type": "string"
},
"userFatherName": {
"type": "string"
}
}
},
"v1CreateNewCareRuleV1Request": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -465,9 +529,6 @@
}
}
},
"v1GetExampleV1Response": {
"type": "object"
},
"v1GetFilteredPlantsV1Response": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -505,6 +566,73 @@
}
}
},
"v1GetPlantByIdV1Response": {
"type": "object",
"properties": {
"plant": {
"$ref": "#/definitions/v1GetPlantByIdV1ResponsePlant"
},
"user": {
"$ref": "#/definitions/v1GetPlantByIdV1ResponseUser"
}
}
},
"v1GetPlantByIdV1ResponsePlant": {
"type": "object",
"properties": {
"species": {
"type": "string"
},
"type": {
"type": "string"
},
"size": {
"type": "string"
},
"lightCondition": {
"type": "string"
},
"wateringFrequency": {
"type": "string"
},
"temperatureRegime": {
"type": "string"
},
"careComplexity": {
"type": "string"
},
"description": {
"type": "string"
},
"place": {
"type": "string"
},
"image": {
"type": "string"
},
"price": {
"type": "number",
"format": "float"
}
}
},
"v1GetPlantByIdV1ResponseUser": {
"type": "object",
"properties": {
"photo": {
"type": "string"
},
"name": {
"type": "string"
},
"surname": {
"type": "string"
},
"fatherName": {
"type": "string"
}
}
},
"v1GetPlantsV1Response": {
"type": "object",
"properties": {
Expand Down
Loading

0 comments on commit 6c4a0f4

Please sign in to comment.