From e1b342d12caf885186e8204b4c27a344e99f511d Mon Sep 17 00:00:00 2001 From: Fedorov Vladimir Date: Sat, 17 May 2025 12:08:44 +0700 Subject: [PATCH] add actions and auth --- .gitignore | 2 + .vscode/settings.json | 3 +- api/main.proto | 19 +- api/requests.http | 21 +- cmd/evening_detective/main.go | 22 +- internal/models/action.go | 6 +- internal/services/mappers.go | 7 + internal/services/repository.go | 61 +++++ internal/services/services.go | 78 +++++- internal/services/story_service/service.go | 41 +++ proto/main.pb.go | 276 ++++++++++++--------- proto/main.pb.gw.go | 60 +---- proto/main.swagger.json | 124 ++++----- story/story.json | 13 + 14 files changed, 487 insertions(+), 246 deletions(-) create mode 100644 internal/services/story_service/service.go create mode 100644 story/story.json diff --git a/.gitignore b/.gitignore index 111f379..bfc22dc 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ go.work .idea go.sum + +store.db diff --git a/.vscode/settings.json b/.vscode/settings.json index 4fee38b..f46554e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,7 @@ { "cSpell.words": [ "AUTOINCREMENT", - "gwmux" + "gwmux", + "palces" ] } \ No newline at end of file diff --git a/api/main.proto b/api/main.proto index a5f8c6c..825f633 100644 --- a/api/main.proto +++ b/api/main.proto @@ -34,7 +34,7 @@ service EveningDetective { rpc GetTeam(GetTeamReq) returns (GetTeamRsp) { option (google.api.http) = { - get: "/teams/{id}" + get: "/team" }; } @@ -46,7 +46,8 @@ service EveningDetective { rpc AddAction(AddActionReq) returns (AddActionRsp) { option (google.api.http) = { - post: "/actions" + post: "/team/actions", + body: "*" }; } @@ -117,12 +118,10 @@ message Application { string name = 1; } -message GetTeamReq { - int64 id = 1; -} +message GetTeamReq {} message GetTeamRsp { - repeated AddActionRsp actions = 1; + repeated Action actions = 1; } message DeleteTeamsReq {} @@ -130,12 +129,14 @@ message DeleteTeamsReq {} message DeleteTeamsRsp {} message AddActionReq { - string to = 1; + string place = 1; } -message AddActionRsp { +message AddActionRsp {} + +message Action { int64 id = 1; - string to = 2; + string place = 2; string text = 3; repeated Application applications = 4; } diff --git a/api/requests.http b/api/requests.http index 9550e2b..eba85a7 100644 --- a/api/requests.http +++ b/api/requests.http @@ -1,6 +1,8 @@ +### Получение списка комад + GET http://localhost:8090/teams -### +### Добавление команд POST http://localhost:8090/teams @@ -14,3 +16,20 @@ POST http://localhost:8090/teams } ] } + +### Получение команды + +GET http://localhost:8090/team +X-Id: 1 +X-Password: pass + + +### Ход команды + +POST http://localhost:8090/team/actions +X-Id: 1 +X-Password: pass + +{ + "place": "A-1" +} diff --git a/cmd/evening_detective/main.go b/cmd/evening_detective/main.go index 67e4294..cf48021 100644 --- a/cmd/evening_detective/main.go +++ b/cmd/evening_detective/main.go @@ -4,6 +4,7 @@ import ( "context" "evening_detective/internal/app" "evening_detective/internal/services" + "evening_detective/internal/services/story_service" proto "evening_detective/proto" "log" "net" @@ -12,6 +13,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/metadata" ) func main() { @@ -28,10 +30,17 @@ func main() { if err != nil { panic(err) } + storyService, err := story_service.NewStoryService() + if err != nil { + panic(err) + } proto.RegisterEveningDetectiveServer( s, app.NewServer( - services.NewServices(repository), + services.NewServices( + repository, + storyService, + ), ), ) // Serve gRPC server @@ -50,7 +59,16 @@ func main() { log.Fatalln("Failed to dial server:", err) } - gwmux := runtime.NewServeMux() + gwmux := runtime.NewServeMux( + runtime.WithMetadata(func(ctx context.Context, request *http.Request) metadata.MD { + teamId := request.Header.Get("X-Id") + return metadata.Pairs("team-id", teamId) + }), + runtime.WithMetadata(func(ctx context.Context, request *http.Request) metadata.MD { + password := request.Header.Get("X-Password") + return metadata.Pairs("password", password) + }), + ) // Register Greeter err = proto.RegisterEveningDetectiveHandler(context.Background(), gwmux, conn) if err != nil { diff --git a/internal/models/action.go b/internal/models/action.go index 3084f8f..d1f0739 100644 --- a/internal/models/action.go +++ b/internal/models/action.go @@ -1,7 +1,7 @@ package models type Action struct { - ID string - To string - Time int64 + ID int64 + Place string + TeamID int64 } diff --git a/internal/services/mappers.go b/internal/services/mappers.go index 209d255..6c66cf5 100644 --- a/internal/services/mappers.go +++ b/internal/services/mappers.go @@ -25,3 +25,10 @@ func mapProtoTeamsToTeam(team *proto.Team) *models.Team { Name: team.Name, } } + +func mapActionToProtoAction(action *models.Action) *proto.Action { + return &proto.Action{ + Id: action.ID, + Place: action.Place, + } +} diff --git a/internal/services/repository.go b/internal/services/repository.go index 17b7bd6..0236d8a 100644 --- a/internal/services/repository.go +++ b/internal/services/repository.go @@ -3,6 +3,7 @@ package services import ( "context" "database/sql" + "errors" "evening_detective/internal/models" _ "github.com/mattn/go-sqlite3" @@ -21,6 +22,15 @@ func NewRepository() (*Repository, error) { if err != nil { return nil, err } + _, err = db.Exec("CREATE TABLE IF NOT EXISTS actions (id INTEGER PRIMARY KEY AUTOINCREMENT, place TEXT, teamId INTEGER);") + if err != nil { + return nil, err + } + // for tests + // _, err = db.Exec("insert into teams (id, name, password) values (1, \"name\", \"pass\");") + // if err != nil { + // return nil, err + // } return &Repository{db: db}, nil } @@ -56,3 +66,54 @@ func (r *Repository) AddTeams(ctx context.Context, teams []*models.Team) ([]*mod } return teams, nil } + +func (r *Repository) GetActions(ctx context.Context, teamId int64) ([]*models.Action, error) { + rows, err := r.db.Query("select id, place from actions where teamId = $1", teamId) + if err != nil { + panic(err) + } + defer rows.Close() + actions := []*models.Action{} + + for rows.Next() { + team := &models.Action{} + err := rows.Scan(&team.ID, &team.Place) + if err != nil { + return nil, err + } + actions = append(actions, team) + } + return actions, nil +} + +func (r *Repository) AddActions(ctx context.Context, actions []*models.Action) error { + for _, action := range actions { + _, err := r.db.Exec("insert into actions (place, teamId) values ($1, $2)", action.Place, action.TeamID) + if err != nil { + return err + } + } + return nil +} + +func (r *Repository) GetTeam(ctx context.Context, teamId any, password any) (*models.Team, error) { + rows, err := r.db.Query("select id, name from teams where id = $1 and password = $2", teamId, password) + if err != nil { + return nil, err + } + defer rows.Close() + teams := []*models.Team{} + + for rows.Next() { + team := &models.Team{} + err := rows.Scan(&team.ID, &team.Name) + if err != nil { + return nil, err + } + teams = append(teams, team) + } + if len(teams) != 1 { + return nil, errors.New("bad result") + } + return teams[0], nil +} diff --git a/internal/services/services.go b/internal/services/services.go index 20ea8af..0f4cfb5 100644 --- a/internal/services/services.go +++ b/internal/services/services.go @@ -4,19 +4,27 @@ import ( "context" "evening_detective/internal/models" "evening_detective/internal/modules/password" + "evening_detective/internal/services/story_service" "evening_detective/proto" + "strconv" "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) type Services struct { - repository *Repository + repository *Repository + storyService *story_service.StoryService } -func NewServices(repository *Repository) *Services { +func NewServices( + repository *Repository, + storyService *story_service.StoryService, +) *Services { return &Services{ - repository: repository, + repository: repository, + storyService: storyService, } } @@ -33,7 +41,20 @@ func (s *Services) GameStart(ctx context.Context, req *proto.GameStartReq) (*pro } func (s *Services) AddAction(ctx context.Context, req *proto.AddActionReq) (*proto.AddActionRsp, error) { - panic("unimplemented") + team, err := s.getTeam(ctx) + if err != nil { + return nil, err + } + actions := []*models.Action{ + { + Place: req.Place, + TeamID: team.ID, + }, + } + if err := s.repository.AddActions(ctx, actions); err != nil { + return nil, status.Errorf(codes.Internal, err.Error()) + } + return &proto.AddActionRsp{}, nil } func (s *Services) DeleteTeams(ctx context.Context, req *proto.DeleteTeamsReq) (*proto.DeleteTeamsRsp, error) { @@ -41,7 +62,26 @@ func (s *Services) DeleteTeams(ctx context.Context, req *proto.DeleteTeamsReq) ( } func (s *Services) GetTeam(ctx context.Context, req *proto.GetTeamReq) (*proto.GetTeamRsp, error) { - panic("unimplemented") + team, err := s.getTeam(ctx) + if err != nil { + return nil, err + } + + actions, err := s.repository.GetActions(ctx, team.ID) + if err != nil { + return nil, status.Errorf(codes.Internal, err.Error()) + } + res := make([]*proto.Action, 0, len(actions)) + for _, action := range actions { + newAction := mapActionToProtoAction(action) + place, err := s.storyService.GetPlace(action.Place) + if err != nil { + return nil, err + } + newAction.Text = place.Text + res = append(res, newAction) + } + return &proto.GetTeamRsp{Actions: res}, err } func (s *Services) GetTeamsCSV(ctx context.Context, req *proto.GetTeamsCSVReq) (*proto.GetTeamsCSVRsp, error) { @@ -77,3 +117,31 @@ func (s *Services) AddTeams(ctx context.Context, req *proto.AddTeamsReq) (*proto } return &proto.AddTeamsRsp{Teams: res}, err } + +func (s *Services) getTeam(ctx context.Context) (*models.Team, error) { + md, ok := metadata.FromIncomingContext(ctx) + if !ok { + return nil, status.Errorf(codes.Unauthenticated, "error creds") + } + + teamIdArr, ok := md["team-id"] + if !ok { + return nil, status.Errorf(codes.Unauthenticated, "error creds") + } + teamId, err := strconv.Atoi(teamIdArr[0]) + if err != nil { + return nil, status.Errorf(codes.Unauthenticated, "error creds") + } + + passwordArr, ok := md["password"] + if !ok { + return nil, status.Errorf(codes.Unauthenticated, "error creds") + } + password := passwordArr[0] + + team, err := s.repository.GetTeam(ctx, teamId, password) + if err != nil { + return nil, status.Errorf(codes.Unauthenticated, err.Error()) + } + return team, nil +} diff --git a/internal/services/story_service/service.go b/internal/services/story_service/service.go new file mode 100644 index 0000000..8089960 --- /dev/null +++ b/internal/services/story_service/service.go @@ -0,0 +1,41 @@ +package story_service + +import ( + "encoding/json" + "errors" + "os" +) + +type Story struct { + Places []*Place `json:"places"` +} + +type Place struct { + Code string `json:"code"` + Text string `json:"text"` +} + +type StoryService struct { + story *Story +} + +func NewStoryService() (*StoryService, error) { + data, err := os.ReadFile("./story/story.json") + if err != nil { + return nil, err + } + story := &Story{} + if err := json.Unmarshal(data, story); err != nil { + return nil, err + } + return &StoryService{story: story}, nil +} + +func (s *StoryService) GetPlace(code string) (*Place, error) { + for _, place := range s.story.Places { + if place.Code == code { + return place, nil + } + } + return nil, errors.New("place not found") +} diff --git a/proto/main.pb.go b/proto/main.pb.go index afc638d..5d68b9c 100644 --- a/proto/main.pb.go +++ b/proto/main.pb.go @@ -593,8 +593,6 @@ type GetTeamReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` } func (x *GetTeamReq) Reset() { @@ -629,19 +627,12 @@ func (*GetTeamReq) Descriptor() ([]byte, []int) { return file_main_proto_rawDescGZIP(), []int{12} } -func (x *GetTeamReq) GetId() int64 { - if x != nil { - return x.Id - } - return 0 -} - type GetTeamRsp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Actions []*AddActionRsp `protobuf:"bytes,1,rep,name=actions,proto3" json:"actions,omitempty"` + Actions []*Action `protobuf:"bytes,1,rep,name=actions,proto3" json:"actions,omitempty"` } func (x *GetTeamRsp) Reset() { @@ -676,7 +667,7 @@ func (*GetTeamRsp) Descriptor() ([]byte, []int) { return file_main_proto_rawDescGZIP(), []int{13} } -func (x *GetTeamRsp) GetActions() []*AddActionRsp { +func (x *GetTeamRsp) GetActions() []*Action { if x != nil { return x.Actions } @@ -764,7 +755,7 @@ type AddActionReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - To string `protobuf:"bytes,1,opt,name=to,proto3" json:"to,omitempty"` + Place string `protobuf:"bytes,1,opt,name=place,proto3" json:"place,omitempty"` } func (x *AddActionReq) Reset() { @@ -799,9 +790,9 @@ func (*AddActionReq) Descriptor() ([]byte, []int) { return file_main_proto_rawDescGZIP(), []int{16} } -func (x *AddActionReq) GetTo() string { +func (x *AddActionReq) GetPlace() string { if x != nil { - return x.To + return x.Place } return "" } @@ -810,11 +801,6 @@ type AddActionRsp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - To string `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"` - Text string `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"` - Applications []*Application `protobuf:"bytes,4,rep,name=applications,proto3" json:"applications,omitempty"` } func (x *AddActionRsp) Reset() { @@ -849,28 +835,71 @@ func (*AddActionRsp) Descriptor() ([]byte, []int) { return file_main_proto_rawDescGZIP(), []int{17} } -func (x *AddActionRsp) GetId() int64 { +type Action struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Place string `protobuf:"bytes,2,opt,name=place,proto3" json:"place,omitempty"` + Text string `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"` + Applications []*Application `protobuf:"bytes,4,rep,name=applications,proto3" json:"applications,omitempty"` +} + +func (x *Action) Reset() { + *x = Action{} + if protoimpl.UnsafeEnabled { + mi := &file_main_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Action) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Action) ProtoMessage() {} + +func (x *Action) ProtoReflect() protoreflect.Message { + mi := &file_main_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Action.ProtoReflect.Descriptor instead. +func (*Action) Descriptor() ([]byte, []int) { + return file_main_proto_rawDescGZIP(), []int{18} +} + +func (x *Action) GetId() int64 { if x != nil { return x.Id } return 0 } -func (x *AddActionRsp) GetTo() string { +func (x *Action) GetPlace() string { if x != nil { - return x.To + return x.Place } return "" } -func (x *AddActionRsp) GetText() string { +func (x *Action) GetText() string { if x != nil { return x.Text } return "" } -func (x *AddActionRsp) GetApplications() []*Application { +func (x *Action) GetApplications() []*Application { if x != nil { return x.Applications } @@ -886,7 +915,7 @@ type GameStartReq struct { func (x *GameStartReq) Reset() { *x = GameStartReq{} if protoimpl.UnsafeEnabled { - mi := &file_main_proto_msgTypes[18] + mi := &file_main_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -899,7 +928,7 @@ func (x *GameStartReq) String() string { func (*GameStartReq) ProtoMessage() {} func (x *GameStartReq) ProtoReflect() protoreflect.Message { - mi := &file_main_proto_msgTypes[18] + mi := &file_main_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -912,7 +941,7 @@ func (x *GameStartReq) ProtoReflect() protoreflect.Message { // Deprecated: Use GameStartReq.ProtoReflect.Descriptor instead. func (*GameStartReq) Descriptor() ([]byte, []int) { - return file_main_proto_rawDescGZIP(), []int{18} + return file_main_proto_rawDescGZIP(), []int{19} } type GameStartRsp struct { @@ -924,7 +953,7 @@ type GameStartRsp struct { func (x *GameStartRsp) Reset() { *x = GameStartRsp{} if protoimpl.UnsafeEnabled { - mi := &file_main_proto_msgTypes[19] + mi := &file_main_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -937,7 +966,7 @@ func (x *GameStartRsp) String() string { func (*GameStartRsp) ProtoMessage() {} func (x *GameStartRsp) ProtoReflect() protoreflect.Message { - mi := &file_main_proto_msgTypes[19] + mi := &file_main_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -950,7 +979,7 @@ func (x *GameStartRsp) ProtoReflect() protoreflect.Message { // Deprecated: Use GameStartRsp.ProtoReflect.Descriptor instead. func (*GameStartRsp) Descriptor() ([]byte, []int) { - return file_main_proto_rawDescGZIP(), []int{19} + return file_main_proto_rawDescGZIP(), []int{20} } type GameStopReq struct { @@ -964,7 +993,7 @@ type GameStopReq struct { func (x *GameStopReq) Reset() { *x = GameStopReq{} if protoimpl.UnsafeEnabled { - mi := &file_main_proto_msgTypes[20] + mi := &file_main_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -977,7 +1006,7 @@ func (x *GameStopReq) String() string { func (*GameStopReq) ProtoMessage() {} func (x *GameStopReq) ProtoReflect() protoreflect.Message { - mi := &file_main_proto_msgTypes[20] + mi := &file_main_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -990,7 +1019,7 @@ func (x *GameStopReq) ProtoReflect() protoreflect.Message { // Deprecated: Use GameStopReq.ProtoReflect.Descriptor instead. func (*GameStopReq) Descriptor() ([]byte, []int) { - return file_main_proto_rawDescGZIP(), []int{20} + return file_main_proto_rawDescGZIP(), []int{21} } func (x *GameStopReq) GetTimeSeconds() int64 { @@ -1009,7 +1038,7 @@ type GameStopRsp struct { func (x *GameStopRsp) Reset() { *x = GameStopRsp{} if protoimpl.UnsafeEnabled { - mi := &file_main_proto_msgTypes[21] + mi := &file_main_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1022,7 +1051,7 @@ func (x *GameStopRsp) String() string { func (*GameStopRsp) ProtoMessage() {} func (x *GameStopRsp) ProtoReflect() protoreflect.Message { - mi := &file_main_proto_msgTypes[21] + mi := &file_main_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1035,7 +1064,7 @@ func (x *GameStopRsp) ProtoReflect() protoreflect.Message { // Deprecated: Use GameStopRsp.ProtoReflect.Descriptor instead. func (*GameStopRsp) Descriptor() ([]byte, []int) { - return file_main_proto_rawDescGZIP(), []int{21} + return file_main_proto_rawDescGZIP(), []int{22} } type GiveApplicationsReq struct { @@ -1050,7 +1079,7 @@ type GiveApplicationsReq struct { func (x *GiveApplicationsReq) Reset() { *x = GiveApplicationsReq{} if protoimpl.UnsafeEnabled { - mi := &file_main_proto_msgTypes[22] + mi := &file_main_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1063,7 +1092,7 @@ func (x *GiveApplicationsReq) String() string { func (*GiveApplicationsReq) ProtoMessage() {} func (x *GiveApplicationsReq) ProtoReflect() protoreflect.Message { - mi := &file_main_proto_msgTypes[22] + mi := &file_main_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1076,7 +1105,7 @@ func (x *GiveApplicationsReq) ProtoReflect() protoreflect.Message { // Deprecated: Use GiveApplicationsReq.ProtoReflect.Descriptor instead. func (*GiveApplicationsReq) Descriptor() ([]byte, []int) { - return file_main_proto_rawDescGZIP(), []int{22} + return file_main_proto_rawDescGZIP(), []int{23} } func (x *GiveApplicationsReq) GetTeamId() int64 { @@ -1102,7 +1131,7 @@ type GiveApplicationsRsp struct { func (x *GiveApplicationsRsp) Reset() { *x = GiveApplicationsRsp{} if protoimpl.UnsafeEnabled { - mi := &file_main_proto_msgTypes[23] + mi := &file_main_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1115,7 +1144,7 @@ func (x *GiveApplicationsRsp) String() string { func (*GiveApplicationsRsp) ProtoMessage() {} func (x *GiveApplicationsRsp) ProtoReflect() protoreflect.Message { - mi := &file_main_proto_msgTypes[23] + mi := &file_main_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1128,7 +1157,7 @@ func (x *GiveApplicationsRsp) ProtoReflect() protoreflect.Message { // Deprecated: Use GiveApplicationsRsp.ProtoReflect.Descriptor instead. func (*GiveApplicationsRsp) Descriptor() ([]byte, []int) { - return file_main_proto_rawDescGZIP(), []int{23} + return file_main_proto_rawDescGZIP(), []int{24} } var File_main_proto protoreflect.FileDescriptor @@ -1176,21 +1205,21 @@ var file_main_proto_rawDesc = []byte{ 0x0c, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x21, 0x0a, 0x0b, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x22, 0x1c, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x22, 0x4d, - 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x73, 0x70, 0x12, 0x3f, 0x0a, 0x07, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, + 0x22, 0x0c, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x22, 0x47, + 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x73, 0x70, 0x12, 0x39, 0x0a, 0x07, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, - 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x73, 0x70, 0x52, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x10, 0x0a, - 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x22, - 0x10, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x52, 0x73, - 0x70, 0x22, 0x1e, 0x0a, 0x0c, 0x41, 0x64, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x74, - 0x6f, 0x22, 0x8c, 0x01, 0x0a, 0x0c, 0x41, 0x64, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x73, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x22, 0x10, 0x0a, 0x0e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x52, 0x73, 0x70, 0x22, 0x24, 0x0a, 0x0c, 0x41, + 0x64, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x70, + 0x6c, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x6c, 0x61, 0x63, + 0x65, 0x22, 0x0e, 0x0a, 0x0c, 0x41, 0x64, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x73, + 0x70, 0x22, 0x8c, 0x01, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, + 0x70, 0x6c, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x6c, 0x61, + 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x48, 0x0a, 0x0c, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, @@ -1211,7 +1240,7 @@ var file_main_proto_rawDesc = []byte{ 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x15, 0x0a, 0x13, 0x47, 0x69, 0x76, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x73, 0x70, - 0x32, 0xf3, 0x08, 0x0a, 0x10, 0x45, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74, 0x65, + 0x32, 0xf5, 0x08, 0x0a, 0x10, 0x45, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x59, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x20, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x1a, @@ -1238,52 +1267,52 @@ var file_main_proto_rawDesc = []byte{ 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x43, 0x53, 0x56, 0x52, 0x73, 0x70, 0x22, 0x0c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x06, 0x12, 0x04, 0x2f, 0x63, - 0x73, 0x76, 0x12, 0x68, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x54, 0x65, 0x61, 0x6d, 0x12, 0x23, 0x2e, + 0x73, 0x76, 0x12, 0x62, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x54, 0x65, 0x61, 0x6d, 0x12, 0x23, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x1a, 0x23, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x47, 0x65, 0x74, - 0x54, 0x65, 0x61, 0x6d, 0x52, 0x73, 0x70, 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x12, - 0x0b, 0x2f, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x6f, 0x0a, 0x0b, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x27, 0x2e, 0x63, 0x72, - 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, - 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x65, 0x61, 0x6d, - 0x73, 0x52, 0x65, 0x71, 0x1a, 0x27, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, - 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x52, 0x73, 0x70, 0x22, 0x0e, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x08, 0x2a, 0x06, 0x2f, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x6b, 0x0a, - 0x09, 0x41, 0x64, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x2e, 0x63, 0x72, 0x61, - 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, - 0x74, 0x69, 0x76, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x1a, 0x25, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, - 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x41, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x73, 0x70, 0x22, 0x10, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0a, - 0x22, 0x08, 0x2f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x71, 0x0a, 0x09, 0x47, 0x61, - 0x6d, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x25, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, - 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, - 0x65, 0x2e, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x25, + 0x54, 0x65, 0x61, 0x6d, 0x52, 0x73, 0x70, 0x22, 0x0d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x07, 0x12, + 0x05, 0x2f, 0x74, 0x65, 0x61, 0x6d, 0x12, 0x6f, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x54, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x27, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, + 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x27, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, - 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x74, 0x61, - 0x72, 0x74, 0x52, 0x73, 0x70, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x3a, 0x01, 0x2a, - 0x22, 0x0b, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x6d, 0x0a, - 0x08, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x24, 0x2e, 0x63, 0x72, 0x61, 0x62, + 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, + 0x65, 0x61, 0x6d, 0x73, 0x52, 0x73, 0x70, 0x22, 0x0e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x08, 0x2a, + 0x06, 0x2f, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x73, 0x0a, 0x09, 0x41, 0x64, 0x64, 0x41, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, + 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x41, + 0x64, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x25, 0x2e, 0x63, 0x72, + 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, + 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x73, 0x70, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x3a, 0x01, 0x2a, 0x22, 0x0d, 0x2f, + 0x74, 0x65, 0x61, 0x6d, 0x2f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x71, 0x0a, 0x09, + 0x47, 0x61, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x25, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, - 0x69, 0x76, 0x65, 0x2e, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x1a, - 0x24, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, - 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x74, - 0x6f, 0x70, 0x52, 0x73, 0x70, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x3a, 0x01, 0x2a, - 0x22, 0x0a, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x73, 0x74, 0x6f, 0x70, 0x12, 0x97, 0x01, 0x0a, - 0x10, 0x47, 0x69, 0x76, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x12, 0x2c, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, + 0x69, 0x76, 0x65, 0x2e, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, + 0x1a, 0x25, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, + 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x47, 0x61, 0x6d, 0x65, 0x53, + 0x74, 0x61, 0x72, 0x74, 0x52, 0x73, 0x70, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x3a, + 0x01, 0x2a, 0x22, 0x0b, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, + 0x6d, 0x0a, 0x08, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x24, 0x2e, 0x63, 0x72, + 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, + 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, + 0x71, 0x1a, 0x24, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, + 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x47, 0x61, 0x6d, 0x65, + 0x53, 0x74, 0x6f, 0x70, 0x52, 0x73, 0x70, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x3a, + 0x01, 0x2a, 0x22, 0x0a, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x73, 0x74, 0x6f, 0x70, 0x12, 0x97, + 0x01, 0x0a, 0x10, 0x47, 0x69, 0x76, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x2c, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, + 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x47, 0x69, + 0x76, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, + 0x71, 0x1a, 0x2c, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x47, 0x69, 0x76, 0x65, - 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x1a, - 0x2c, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, - 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x47, 0x69, 0x76, 0x65, 0x41, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x73, 0x70, 0x22, 0x27, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x01, 0x2a, 0x22, 0x1c, 0x2f, 0x74, 0x65, 0x61, 0x6d, 0x73, - 0x2f, 0x7b, 0x74, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x7d, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x0b, 0x5a, 0x09, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x73, 0x70, 0x22, + 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x01, 0x2a, 0x22, 0x1c, 0x2f, 0x74, 0x65, 0x61, + 0x6d, 0x73, 0x2f, 0x7b, 0x74, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x7d, 0x2f, 0x61, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x0b, 0x5a, 0x09, 0x70, 0x6b, 0x67, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1298,7 +1327,7 @@ func file_main_proto_rawDescGZIP() []byte { return file_main_proto_rawDescData } -var file_main_proto_msgTypes = make([]protoimpl.MessageInfo, 24) +var file_main_proto_msgTypes = make([]protoimpl.MessageInfo, 25) var file_main_proto_goTypes = []interface{}{ (*PingReq)(nil), // 0: crabs.evening_detective.PingReq (*PingRsp)(nil), // 1: crabs.evening_detective.PingRsp @@ -1318,20 +1347,21 @@ var file_main_proto_goTypes = []interface{}{ (*DeleteTeamsRsp)(nil), // 15: crabs.evening_detective.DeleteTeamsRsp (*AddActionReq)(nil), // 16: crabs.evening_detective.AddActionReq (*AddActionRsp)(nil), // 17: crabs.evening_detective.AddActionRsp - (*GameStartReq)(nil), // 18: crabs.evening_detective.GameStartReq - (*GameStartRsp)(nil), // 19: crabs.evening_detective.GameStartRsp - (*GameStopReq)(nil), // 20: crabs.evening_detective.GameStopReq - (*GameStopRsp)(nil), // 21: crabs.evening_detective.GameStopRsp - (*GiveApplicationsReq)(nil), // 22: crabs.evening_detective.GiveApplicationsReq - (*GiveApplicationsRsp)(nil), // 23: crabs.evening_detective.GiveApplicationsRsp + (*Action)(nil), // 18: crabs.evening_detective.Action + (*GameStartReq)(nil), // 19: crabs.evening_detective.GameStartReq + (*GameStartRsp)(nil), // 20: crabs.evening_detective.GameStartRsp + (*GameStopReq)(nil), // 21: crabs.evening_detective.GameStopReq + (*GameStopRsp)(nil), // 22: crabs.evening_detective.GameStopRsp + (*GiveApplicationsReq)(nil), // 23: crabs.evening_detective.GiveApplicationsReq + (*GiveApplicationsRsp)(nil), // 24: crabs.evening_detective.GiveApplicationsRsp } var file_main_proto_depIdxs = []int32{ 3, // 0: crabs.evening_detective.AddTeamsReq.teams:type_name -> crabs.evening_detective.Team 5, // 1: crabs.evening_detective.AddTeamsRsp.teams:type_name -> crabs.evening_detective.TeamFull 10, // 2: crabs.evening_detective.GetTeamsRsp.teams:type_name -> crabs.evening_detective.TeamAdvanced 11, // 3: crabs.evening_detective.TeamAdvanced.applications:type_name -> crabs.evening_detective.Application - 17, // 4: crabs.evening_detective.GetTeamRsp.actions:type_name -> crabs.evening_detective.AddActionRsp - 11, // 5: crabs.evening_detective.AddActionRsp.applications:type_name -> crabs.evening_detective.Application + 18, // 4: crabs.evening_detective.GetTeamRsp.actions:type_name -> crabs.evening_detective.Action + 11, // 5: crabs.evening_detective.Action.applications:type_name -> crabs.evening_detective.Application 11, // 6: crabs.evening_detective.GiveApplicationsReq.applications:type_name -> crabs.evening_detective.Application 0, // 7: crabs.evening_detective.EveningDetective.Ping:input_type -> crabs.evening_detective.PingReq 2, // 8: crabs.evening_detective.EveningDetective.AddTeams:input_type -> crabs.evening_detective.AddTeamsReq @@ -1340,9 +1370,9 @@ var file_main_proto_depIdxs = []int32{ 12, // 11: crabs.evening_detective.EveningDetective.GetTeam:input_type -> crabs.evening_detective.GetTeamReq 14, // 12: crabs.evening_detective.EveningDetective.DeleteTeams:input_type -> crabs.evening_detective.DeleteTeamsReq 16, // 13: crabs.evening_detective.EveningDetective.AddAction:input_type -> crabs.evening_detective.AddActionReq - 18, // 14: crabs.evening_detective.EveningDetective.GameStart:input_type -> crabs.evening_detective.GameStartReq - 20, // 15: crabs.evening_detective.EveningDetective.GameStop:input_type -> crabs.evening_detective.GameStopReq - 22, // 16: crabs.evening_detective.EveningDetective.GiveApplications:input_type -> crabs.evening_detective.GiveApplicationsReq + 19, // 14: crabs.evening_detective.EveningDetective.GameStart:input_type -> crabs.evening_detective.GameStartReq + 21, // 15: crabs.evening_detective.EveningDetective.GameStop:input_type -> crabs.evening_detective.GameStopReq + 23, // 16: crabs.evening_detective.EveningDetective.GiveApplications:input_type -> crabs.evening_detective.GiveApplicationsReq 1, // 17: crabs.evening_detective.EveningDetective.Ping:output_type -> crabs.evening_detective.PingRsp 4, // 18: crabs.evening_detective.EveningDetective.AddTeams:output_type -> crabs.evening_detective.AddTeamsRsp 7, // 19: crabs.evening_detective.EveningDetective.GetTeams:output_type -> crabs.evening_detective.GetTeamsRsp @@ -1350,9 +1380,9 @@ var file_main_proto_depIdxs = []int32{ 13, // 21: crabs.evening_detective.EveningDetective.GetTeam:output_type -> crabs.evening_detective.GetTeamRsp 15, // 22: crabs.evening_detective.EveningDetective.DeleteTeams:output_type -> crabs.evening_detective.DeleteTeamsRsp 17, // 23: crabs.evening_detective.EveningDetective.AddAction:output_type -> crabs.evening_detective.AddActionRsp - 19, // 24: crabs.evening_detective.EveningDetective.GameStart:output_type -> crabs.evening_detective.GameStartRsp - 21, // 25: crabs.evening_detective.EveningDetective.GameStop:output_type -> crabs.evening_detective.GameStopRsp - 23, // 26: crabs.evening_detective.EveningDetective.GiveApplications:output_type -> crabs.evening_detective.GiveApplicationsRsp + 20, // 24: crabs.evening_detective.EveningDetective.GameStart:output_type -> crabs.evening_detective.GameStartRsp + 22, // 25: crabs.evening_detective.EveningDetective.GameStop:output_type -> crabs.evening_detective.GameStopRsp + 24, // 26: crabs.evening_detective.EveningDetective.GiveApplications:output_type -> crabs.evening_detective.GiveApplicationsRsp 17, // [17:27] is the sub-list for method output_type 7, // [7:17] is the sub-list for method input_type 7, // [7:7] is the sub-list for extension type_name @@ -1583,7 +1613,7 @@ func file_main_proto_init() { } } file_main_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GameStartReq); i { + switch v := v.(*Action); i { case 0: return &v.state case 1: @@ -1595,7 +1625,7 @@ func file_main_proto_init() { } } file_main_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GameStartRsp); i { + switch v := v.(*GameStartReq); i { case 0: return &v.state case 1: @@ -1607,7 +1637,7 @@ func file_main_proto_init() { } } file_main_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GameStopReq); i { + switch v := v.(*GameStartRsp); i { case 0: return &v.state case 1: @@ -1619,7 +1649,7 @@ func file_main_proto_init() { } } file_main_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GameStopRsp); i { + switch v := v.(*GameStopReq); i { case 0: return &v.state case 1: @@ -1631,7 +1661,7 @@ func file_main_proto_init() { } } file_main_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GiveApplicationsReq); i { + switch v := v.(*GameStopRsp); i { case 0: return &v.state case 1: @@ -1643,6 +1673,18 @@ func file_main_proto_init() { } } file_main_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GiveApplicationsReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_main_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GiveApplicationsRsp); i { case 0: return &v.state @@ -1661,7 +1703,7 @@ func file_main_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_main_proto_rawDesc, NumEnums: 0, - NumMessages: 24, + NumMessages: 25, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/main.pb.gw.go b/proto/main.pb.gw.go index 8eb364e..4e341e9 100644 --- a/proto/main.pb.gw.go +++ b/proto/main.pb.gw.go @@ -115,23 +115,6 @@ func request_EveningDetective_GetTeam_0(ctx context.Context, marshaler runtime.M var protoReq GetTeamReq var metadata runtime.ServerMetadata - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") - } - - protoReq.Id, err = runtime.Int64(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) - } - msg, err := client.GetTeam(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -141,23 +124,6 @@ func local_request_EveningDetective_GetTeam_0(ctx context.Context, marshaler run var protoReq GetTeamReq var metadata runtime.ServerMetadata - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") - } - - protoReq.Id, err = runtime.Int64(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) - } - msg, err := server.GetTeam(ctx, &protoReq) return msg, metadata, err @@ -181,18 +147,11 @@ func local_request_EveningDetective_DeleteTeams_0(ctx context.Context, marshaler } -var ( - filter_EveningDetective_AddAction_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - func request_EveningDetective_AddAction_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq AddActionReq var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EveningDetective_AddAction_0); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -205,10 +164,7 @@ func local_request_EveningDetective_AddAction_0(ctx context.Context, marshaler r var protoReq AddActionReq var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EveningDetective_AddAction_0); err != nil { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -443,7 +399,7 @@ func RegisterEveningDetectiveHandlerServer(ctx context.Context, mux *runtime.Ser inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.evening_detective.EveningDetective/GetTeam", runtime.WithHTTPPathPattern("/teams/{id}")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.evening_detective.EveningDetective/GetTeam", runtime.WithHTTPPathPattern("/team")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -493,7 +449,7 @@ func RegisterEveningDetectiveHandlerServer(ctx context.Context, mux *runtime.Ser inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.evening_detective.EveningDetective/AddAction", runtime.WithHTTPPathPattern("/actions")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.evening_detective.EveningDetective/AddAction", runtime.WithHTTPPathPattern("/team/actions")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -720,7 +676,7 @@ func RegisterEveningDetectiveHandlerClient(ctx context.Context, mux *runtime.Ser inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/crabs.evening_detective.EveningDetective/GetTeam", runtime.WithHTTPPathPattern("/teams/{id}")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/crabs.evening_detective.EveningDetective/GetTeam", runtime.WithHTTPPathPattern("/team")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -764,7 +720,7 @@ func RegisterEveningDetectiveHandlerClient(ctx context.Context, mux *runtime.Ser inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/crabs.evening_detective.EveningDetective/AddAction", runtime.WithHTTPPathPattern("/actions")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/crabs.evening_detective.EveningDetective/AddAction", runtime.WithHTTPPathPattern("/team/actions")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -858,11 +814,11 @@ var ( pattern_EveningDetective_GetTeamsCSV_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"csv"}, "")) - pattern_EveningDetective_GetTeam_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"teams", "id"}, "")) + pattern_EveningDetective_GetTeam_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"team"}, "")) pattern_EveningDetective_DeleteTeams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"teams"}, "")) - pattern_EveningDetective_AddAction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"actions"}, "")) + pattern_EveningDetective_AddAction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"team", "actions"}, "")) pattern_EveningDetective_GameStart_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"game", "start"}, "")) diff --git a/proto/main.swagger.json b/proto/main.swagger.json index ce29651..f588551 100644 --- a/proto/main.swagger.json +++ b/proto/main.swagger.json @@ -11,28 +11,6 @@ "application/json" ], "paths": { - "/actions": { - "post": { - "operationId": "EveningDetective_AddAction", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/evening_detectiveAddActionRsp" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/runtimeError" - } - } - }, - "tags": [ - "EveningDetective" - ] - } - }, "/csv": { "get": { "operationId": "EveningDetective_GetTeamsCSV", @@ -141,6 +119,60 @@ ] } }, + "/team": { + "get": { + "operationId": "EveningDetective_GetTeam", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/evening_detectiveGetTeamRsp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "tags": [ + "EveningDetective" + ] + } + }, + "/team/actions": { + "post": { + "operationId": "EveningDetective_AddAction", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/evening_detectiveAddActionRsp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/runtimeError" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/evening_detectiveAddActionReq" + } + } + ], + "tags": [ + "EveningDetective" + ] + } + }, "/teams": { "get": { "operationId": "EveningDetective_GetTeams", @@ -213,37 +245,6 @@ ] } }, - "/teams/{id}": { - "get": { - "operationId": "EveningDetective_GetTeam", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/evening_detectiveGetTeamRsp" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/runtimeError" - } - } - }, - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "type": "string", - "format": "int64" - } - ], - "tags": [ - "EveningDetective" - ] - } - }, "/teams/{teamId}/applications": { "post": { "operationId": "EveningDetective_GiveApplications", @@ -285,14 +286,14 @@ } }, "definitions": { - "evening_detectiveAddActionRsp": { + "evening_detectiveAction": { "type": "object", "properties": { "id": { "type": "string", "format": "int64" }, - "to": { + "place": { "type": "string" }, "text": { @@ -306,6 +307,17 @@ } } }, + "evening_detectiveAddActionReq": { + "type": "object", + "properties": { + "place": { + "type": "string" + } + } + }, + "evening_detectiveAddActionRsp": { + "type": "object" + }, "evening_detectiveAddTeamsReq": { "type": "object", "properties": { @@ -363,7 +375,7 @@ "actions": { "type": "array", "items": { - "$ref": "#/definitions/evening_detectiveAddActionRsp" + "$ref": "#/definitions/evening_detectiveAction" } } } diff --git a/story/story.json b/story/story.json new file mode 100644 index 0000000..71b6d42 --- /dev/null +++ b/story/story.json @@ -0,0 +1,13 @@ +{ + "places": [ + { + "code": "A-1", + "text": "Вас приветствуют волонтеры, говорят что игорек где-то здесь, но точно они не знают.", + "applications": [ + { + "name": "Карта" + } + ] + } + ] +}