From 83495e1e79f2db9f14ba28683c995cf6a3a9546a Mon Sep 17 00:00:00 2001 From: Andrey Ivanov Date: Sun, 27 Sep 2020 19:09:01 +0300 Subject: [PATCH] HW13 WIP --- hw12_13_14_15_calendar/api/EventService.proto | 44 ++++++++++++++++++- hw12_13_14_15_calendar/go.mod | 2 + 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/hw12_13_14_15_calendar/api/EventService.proto b/hw12_13_14_15_calendar/api/EventService.proto index d188eff..0a3f23d 100644 --- a/hw12_13_14_15_calendar/api/EventService.proto +++ b/hw12_13_14_15_calendar/api/EventService.proto @@ -2,6 +2,46 @@ syntax = "proto3"; package event; -message Event { - // TODO +option go_package = "event"; + +import "google/protobuf/timestamp.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; + +service CalendarRPC { + rpc Create(event) returns (eventID); + rpc Update(eventWithID) returns (google.protobuf.Empty); + rpc Delete(eventID) returns (google.protobuf.Empty); + rpc List(google.protobuf.Empty) returns (eventList); + rpc GetByID(eventID) returns (eventList); + rpc GetByDay(date) returns (eventList); + rpc GetByWeek(date) returns (eventList); + rpc GetByMonth(date) returns (eventList); +} + +message event { + string ID = 1; + string title = 2; + google.protobuf.Timestamp date = 3; + google.protobuf.Duration latency = 4; + string note = 5; + string UserID = 6; + google.protobuf.Duration notyfyTime = 7; +} + +message eventList { + repeated event events = 1; +} + +message eventID { + string ID = 1; +} + +message eventWithID { + string ID = 1; + event event = 2; +} + +message date { + google.protobuf.Timestamp date = 1; } diff --git a/hw12_13_14_15_calendar/go.mod b/hw12_13_14_15_calendar/go.mod index 60e7d9b..3dd9c48 100644 --- a/hw12_13_14_15_calendar/go.mod +++ b/hw12_13_14_15_calendar/go.mod @@ -6,8 +6,10 @@ require ( github.com/BurntSushi/toml v0.3.1 github.com/amitrai48/logger v0.0.0-20190214092904-448001c055ec github.com/go-sql-driver/mysql v1.5.0 + github.com/golang/protobuf v1.4.2 // indirect github.com/mattn/go-shellwords v1.0.10 // indirect github.com/stretchr/testify v1.4.0 go.uber.org/zap v1.15.0 // indirect + google.golang.org/protobuf v1.25.0 // indirect gopkg.in/yaml.v2 v2.3.0 // indirect )