generated from VLADIMIR/template
fix login
This commit is contained in:
parent
e0d39bbd72
commit
7de3a6324f
@ -104,8 +104,9 @@ message GetTeamsCSVRsp {
|
|||||||
message TeamAdvanced {
|
message TeamAdvanced {
|
||||||
int64 id = 1;
|
int64 id = 1;
|
||||||
string name = 2;
|
string name = 2;
|
||||||
int64 spendTime = 3;
|
string password = 3;
|
||||||
repeated Application applications = 4;
|
int64 spendTime = 4;
|
||||||
|
repeated Application applications = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Application {
|
message Application {
|
||||||
@ -117,7 +118,8 @@ message Application {
|
|||||||
message GetTeamReq {}
|
message GetTeamReq {}
|
||||||
|
|
||||||
message GetTeamRsp {
|
message GetTeamRsp {
|
||||||
repeated Action actions = 1;
|
string name = 1;
|
||||||
|
repeated Action actions = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message AddActionReq {
|
message AddActionReq {
|
||||||
|
@ -10,6 +10,7 @@ func mapTeamsToTeamAdvanced(team *models.Team) *proto.TeamAdvanced {
|
|||||||
return &proto.TeamAdvanced{
|
return &proto.TeamAdvanced{
|
||||||
Id: team.ID,
|
Id: team.ID,
|
||||||
Name: team.Name,
|
Name: team.Name,
|
||||||
|
Password: team.Password,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,11 +30,6 @@ func NewRepository() (*Repository, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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
|
return &Repository{db: db}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package services
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"evening_detective/internal/models"
|
"evening_detective/internal/models"
|
||||||
"evening_detective/internal/modules/password"
|
"evening_detective/internal/modules/password"
|
||||||
@ -96,7 +97,10 @@ func (s *Services) GetTeam(ctx context.Context, req *proto.GetTeamReq) (*proto.G
|
|||||||
}
|
}
|
||||||
res = append(res, newAction)
|
res = append(res, newAction)
|
||||||
}
|
}
|
||||||
return &proto.GetTeamRsp{Actions: res}, err
|
return &proto.GetTeamRsp{
|
||||||
|
Name: team.Name,
|
||||||
|
Actions: res,
|
||||||
|
}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Services) GetTeamsCSV(ctx context.Context, req *proto.GetTeamsCSVReq) (*proto.GetTeamsCSVRsp, error) {
|
func (s *Services) GetTeamsCSV(ctx context.Context, req *proto.GetTeamsCSVReq) (*proto.GetTeamsCSVRsp, error) {
|
||||||
@ -154,7 +158,10 @@ func (s *Services) getTeam(ctx context.Context) (*models.Team, error) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return nil, status.Errorf(codes.Unauthenticated, "error creds")
|
return nil, status.Errorf(codes.Unauthenticated, "error creds")
|
||||||
}
|
}
|
||||||
teamId := teamIdArr[0]
|
teamId, err := base64.StdEncoding.DecodeString(teamIdArr[0])
|
||||||
|
if err != nil {
|
||||||
|
return nil, status.Errorf(codes.Unauthenticated, "error creds")
|
||||||
|
}
|
||||||
|
|
||||||
passwordArr, ok := md["password"]
|
passwordArr, ok := md["password"]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -478,8 +478,9 @@ type TeamAdvanced struct {
|
|||||||
|
|
||||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
SpendTime int64 `protobuf:"varint,3,opt,name=spendTime,proto3" json:"spendTime,omitempty"`
|
Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"`
|
||||||
Applications []*Application `protobuf:"bytes,4,rep,name=applications,proto3" json:"applications,omitempty"`
|
SpendTime int64 `protobuf:"varint,4,opt,name=spendTime,proto3" json:"spendTime,omitempty"`
|
||||||
|
Applications []*Application `protobuf:"bytes,5,rep,name=applications,proto3" json:"applications,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *TeamAdvanced) Reset() {
|
func (x *TeamAdvanced) Reset() {
|
||||||
@ -528,6 +529,13 @@ func (x *TeamAdvanced) GetName() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *TeamAdvanced) GetPassword() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Password
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (x *TeamAdvanced) GetSpendTime() int64 {
|
func (x *TeamAdvanced) GetSpendTime() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.SpendTime
|
return x.SpendTime
|
||||||
@ -648,7 +656,8 @@ type GetTeamRsp struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Actions []*Action `protobuf:"bytes,1,rep,name=actions,proto3" json:"actions,omitempty"`
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
Actions []*Action `protobuf:"bytes,2,rep,name=actions,proto3" json:"actions,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetTeamRsp) Reset() {
|
func (x *GetTeamRsp) Reset() {
|
||||||
@ -683,6 +692,13 @@ func (*GetTeamRsp) Descriptor() ([]byte, []int) {
|
|||||||
return file_main_proto_rawDescGZIP(), []int{13}
|
return file_main_proto_rawDescGZIP(), []int{13}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *GetTeamRsp) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (x *GetTeamRsp) GetActions() []*Action {
|
func (x *GetTeamRsp) GetActions() []*Action {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Actions
|
return x.Actions
|
||||||
@ -1141,23 +1157,26 @@ var file_main_proto_rawDesc = []byte{
|
|||||||
0x65, 0x61, 0x6d, 0x73, 0x43, 0x53, 0x56, 0x52, 0x65, 0x71, 0x22, 0x24, 0x0a, 0x0e, 0x47, 0x65,
|
0x65, 0x61, 0x6d, 0x73, 0x43, 0x53, 0x56, 0x52, 0x65, 0x71, 0x22, 0x24, 0x0a, 0x0e, 0x47, 0x65,
|
||||||
0x74, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x43, 0x53, 0x56, 0x52, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04,
|
0x74, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x43, 0x53, 0x56, 0x52, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04,
|
||||||
0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61,
|
0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61,
|
||||||
0x22, 0x9a, 0x01, 0x0a, 0x0c, 0x54, 0x65, 0x61, 0x6d, 0x41, 0x64, 0x76, 0x61, 0x6e, 0x63, 0x65,
|
0x22, 0xb6, 0x01, 0x0a, 0x0c, 0x54, 0x65, 0x61, 0x6d, 0x41, 0x64, 0x76, 0x61, 0x6e, 0x63, 0x65,
|
||||||
0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69,
|
0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69,
|
||||||
0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x70, 0x65, 0x6e, 0x64, 0x54, 0x69,
|
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72,
|
||||||
0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x70, 0x65, 0x6e, 0x64, 0x54,
|
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72,
|
||||||
0x69, 0x6d, 0x65, 0x12, 0x48, 0x0a, 0x0c, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69,
|
0x64, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x70, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x04,
|
||||||
0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x72, 0x61, 0x62,
|
0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x70, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12,
|
||||||
0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74,
|
0x48, 0x0a, 0x0c, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18,
|
||||||
0x69, 0x76, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
|
0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76,
|
||||||
0x0c, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x47, 0x0a,
|
0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e,
|
||||||
0x0b, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02,
|
0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x61, 0x70, 0x70,
|
||||||
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04,
|
0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x47, 0x0a, 0x0b, 0x41, 0x70, 0x70,
|
||||||
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
|
0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
|
||||||
0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
|
||||||
0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x0c, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x54, 0x65, 0x61,
|
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05,
|
||||||
0x6d, 0x52, 0x65, 0x71, 0x22, 0x47, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x54, 0x65, 0x61, 0x6d, 0x52,
|
0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61,
|
||||||
0x73, 0x70, 0x12, 0x39, 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20,
|
0x74, 0x65, 0x22, 0x0c, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71,
|
||||||
|
0x22, 0x5b, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x73, 0x70, 0x12, 0x12,
|
||||||
|
0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
|
||||||
|
0x6d, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20,
|
||||||
0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e,
|
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, 0x63,
|
0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x41, 0x63,
|
||||||
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x24, 0x0a,
|
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x24, 0x0a,
|
||||||
|
@ -359,6 +359,9 @@
|
|||||||
"evening_detectiveGetTeamRsp": {
|
"evening_detectiveGetTeamRsp": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"actions": {
|
"actions": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
@ -425,6 +428,9 @@
|
|||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"password": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"spendTime": {
|
"spendTime": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "int64"
|
"format": "int64"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user