chore(api)!: refactored grpc API
This commit is contained in:
+51
-27
@@ -1,34 +1,39 @@
|
||||
syntax = "proto3";
|
||||
package competition;
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
option go_package = "pkg/api/competition";
|
||||
|
||||
service CompetitionService {
|
||||
rpc GetCompetition(GetCompetitionRequest) returns (GetCompetitionResponse);
|
||||
rpc GetCompetition(GetCompetitionRequest) returns (Competition);
|
||||
rpc ListCompetitions(ListCompetitionsRequest) returns (ListCompetitionsResponse);
|
||||
rpc ChangeCompetitionState(ChangeCompetitionStateRequest) returns (ChangeCompetitionStateResponse);
|
||||
rpc CreateCompetition(CreateCompetitionRequest) returns (Competition);
|
||||
rpc UpdateCompetition(UpdateCompetitionRequest) returns (Competition);
|
||||
rpc DeleteCompetition(DeleteCompetitionRequest) returns (google.protobuf.Empty);
|
||||
rpc ChangeCompetitionState(ChangeCompetitionStateRequest) returns (Competition);
|
||||
}
|
||||
|
||||
message GetCompetitionRequest {
|
||||
string competition_id = 1;
|
||||
}
|
||||
message GetCompetitionResponse {
|
||||
Competition competition = 1;
|
||||
enum CompetitionState {
|
||||
COMPETITION_STATE_UNSPECIFIED = 0;
|
||||
COMPETITION_STATE_DRAFT = 1;
|
||||
COMPETITION_STATE_NOT_STARTED = 2;
|
||||
COMPETITION_STATE_STARTED = 3;
|
||||
COMPETITION_STATE_FINISHED = 4;
|
||||
COMPETITION_STATE_ARCHIVED = 5;
|
||||
}
|
||||
|
||||
message ListCompetitionsRequest {
|
||||
bool is_participating = 1;
|
||||
}
|
||||
message ListCompetitionsResponse {
|
||||
repeated Competition competitions = 1;
|
||||
enum ParticipationType {
|
||||
PARTICIPATION_TYPE_UNSPECIFIED = 0;
|
||||
PARTICIPATION_TYPE_INDIVIDUAL = 1;
|
||||
PARTICIPATION_TYPE_TEAM = 2;
|
||||
}
|
||||
|
||||
message ChangeCompetitionStateRequest {
|
||||
string competition_id = 1;
|
||||
CompetitionState state = 2;
|
||||
}
|
||||
message ChangeCompetitionStateResponse {
|
||||
CompetitionState state = 1;
|
||||
enum CompetitionType {
|
||||
COMPETITION_TYPE_UNSPECIFIED = 0;
|
||||
COMPETITION_TYPE_EDUCATIVE = 1;
|
||||
COMPETITION_TYPE_COMPETETIVE = 2;
|
||||
}
|
||||
|
||||
message Competition {
|
||||
@@ -37,16 +42,35 @@ message Competition {
|
||||
string title = 3;
|
||||
string description = 4;
|
||||
optional string image_url = 5;
|
||||
optional string end_date = 6;
|
||||
optional string start_date = 7;
|
||||
string type = 8;
|
||||
string participation_type = 9;
|
||||
google.protobuf.Timestamp start_time = 6;
|
||||
google.protobuf.Timestamp end_time = 7;
|
||||
CompetitionType type = 8;
|
||||
ParticipationType participation_type = 9;
|
||||
google.protobuf.Timestamp created_at = 10;
|
||||
google.protobuf.Timestamp updated_at = 11;
|
||||
}
|
||||
|
||||
enum CompetitionState {
|
||||
COMPETITION_STATE_UNSPECIFIED = 0;
|
||||
COMPETITION_STATE_NOT_STARTED = 1;
|
||||
COMPETITION_STATE_STARTED = 2;
|
||||
COMPETITION_STATE_FINISHED = 3;
|
||||
message GetCompetitionRequest {
|
||||
string competition_id = 1;
|
||||
}
|
||||
|
||||
message ListCompetitionsRequest {
|
||||
int32 page_size = 1;
|
||||
int32 page_token = 2;
|
||||
|
||||
optional CompetitionState state = 3;
|
||||
optional bool is_participating = 4;
|
||||
optional string search_query = 5;
|
||||
}
|
||||
|
||||
message ListCompetitionsResponse {
|
||||
int32 total_count = 2;
|
||||
int32 next_page_token = 3;
|
||||
|
||||
repeated Competition competitions = 1;
|
||||
}
|
||||
|
||||
message ChangeCompetitionStateRequest {
|
||||
string competition_id = 1;
|
||||
CompetitionState state = 2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user