From e6de2af416b636ffc84d2bedccdc3c79592af1b9 Mon Sep 17 00:00:00 2001 From: Vyacheslav1557 Date: Sun, 13 Oct 2024 19:03:03 +0500 Subject: [PATCH] feat: --- contest/v1/contest.proto | 67 ++++++++++++++++++++++++++++++++++++++++ problem/v1/problem.proto | 40 +++++------------------- session/v1/session.proto | 8 ----- 3 files changed, 75 insertions(+), 40 deletions(-) create mode 100644 contest/v1/contest.proto diff --git a/contest/v1/contest.proto b/contest/v1/contest.proto new file mode 100644 index 0000000..09c53b4 --- /dev/null +++ b/contest/v1/contest.proto @@ -0,0 +1,67 @@ +syntax = "proto3"; + +package contest.v1; +option go_package = "/contest/v1;contestv1"; + +import "google/protobuf/timestamp.proto"; +import "google/protobuf/empty.proto"; + +service ContestService { + rpc CreateContest (CreateContestRequest) returns (CreateContestResponse); + rpc ReadContest (ReadContestRequest) returns (ReadContestResponse); + rpc DeleteContest (DeleteContestRequest) returns (google.protobuf.Empty); + + rpc AddTask (AddTaskRequest) returns (AddTaskResponse); + rpc DeleteTask (DeleteTaskRequest) returns (google.protobuf.Empty); + + rpc AddParticipant (AddParticipantRequest) returns (AddParticipantResponse); + rpc DeleteParticipant (DeleteParticipantRequest) returns (google.protobuf.Empty); +} + +message CreateContestRequest { + string title = 1; +} +message CreateContestResponse { + int32 id = 1; +} + +message ReadContestRequest { + int32 id = 1; +} +message ReadContestResponse { + message Contest { + int32 id = 1; + string title = 2; + google.protobuf.Timestamp created_at = 3; + google.protobuf.Timestamp updated_at = 4; + } + Contest contest = 1; +} + +message DeleteContestRequest { + int32 id = 1; +} + +message AddTaskRequest { + int32 contest_id = 1; + int32 problem_id = 2; +} +message AddTaskResponse { + int32 id = 1; +} + +message DeleteTaskRequest { + int32 task_id = 1; +} + +message AddParticipantRequest { + int32 contest_id = 1; + int32 user_id = 2; +} +message AddParticipantResponse { + int32 id = 1; +} + +message DeleteParticipantRequest { + int32 participant_id = 1; +} \ No newline at end of file diff --git a/problem/v1/problem.proto b/problem/v1/problem.proto index 9de9642..467d6d9 100644 --- a/problem/v1/problem.proto +++ b/problem/v1/problem.proto @@ -7,27 +7,13 @@ import "google/protobuf/timestamp.proto"; import "google/protobuf/empty.proto"; service ProblemService { - rpc CreateProblem (stream CreateProblemRequest) returns (CreateProblemResponse); + rpc CreateProblem (CreateProblemRequest) returns (CreateProblemResponse); rpc ReadProblem (ReadProblemRequest) returns (ReadProblemResponse); - // rpc UpdateProblem (UpdateProblemRequest) returns (google.protobuf.Empty); rpc DeleteProblem (DeleteProblemRequest) returns (google.protobuf.Empty); } message CreateProblemRequest { - message Problem { - string name = 1; - string description = 2; - int32 time_limit = 3; - int32 memory_limit = 4; - } - message Test { - bytes chunk = 1; - } - - oneof msg { - Problem problem = 1; - Test test = 2; - } + string title = 1; } message CreateProblemResponse { int32 id = 1; @@ -39,28 +25,18 @@ message ReadProblemRequest { message ReadProblemResponse { message Problem { int32 id = 1; - string name = 2; - string description = 3; + string title = 2; + string content = 3; int32 time_limit = 4; int32 memory_limit = 5; - google.protobuf.Timestamp created_at = 6; - google.protobuf.Timestamp updated_at = 7; + int32 testing_strategy = 6; + string testing_order = 7; + google.protobuf.Timestamp created_at = 8; + google.protobuf.Timestamp updated_at = 9; } Problem problem = 1; } -//message UpdateProblemRequest { -// message Problem { -// int32 id = 1; -// optional string name = 2; -// optional string description = 3; -// optional int32 time_limit = 4; -// optional int32 memory_limit = 5; -// } -// string token = 1; -// Problem problem = 2; -//} - message DeleteProblemRequest { int32 id = 1; } \ No newline at end of file diff --git a/session/v1/session.proto b/session/v1/session.proto index 516c442..e689754 100644 --- a/session/v1/session.proto +++ b/session/v1/session.proto @@ -7,7 +7,6 @@ import "google/protobuf/empty.proto"; service SessionService { rpc Create (CreateSessionRequest) returns (CreateSessionResponse); - rpc Read (ReadSessionRequest) returns (ReadSessionResponse); rpc Update (UpdateSessionRequest) returns (google.protobuf.Empty); rpc Delete (DeleteSessionRequest) returns (google.protobuf.Empty); } @@ -20,13 +19,6 @@ message CreateSessionResponse { string token = 1; } -message ReadSessionRequest { - string token = 1; -} -message ReadSessionResponse { - int32 user_id = 2; -} - message UpdateSessionRequest { string token = 1; }