diff --git a/protobuf/auth.proto b/protobuf/auth.proto index fd871ea..74d105b 100644 --- a/protobuf/auth.proto +++ b/protobuf/auth.proto @@ -22,6 +22,10 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { } }; +message RequestDetail{ + string requestId = 1; +} + service AuthService{ rpc EmailLogin(EmailLoginRequest) returns (EmailLoginResponse) { option (google.api.http) = { @@ -74,3 +78,4 @@ message RefreshTokenResponse{ string refreshToken = 1; string accessToken = 2; } + diff --git a/protobuf/gen/go/auth.pb.go b/protobuf/gen/go/auth.pb.go index 96dc065..33a4fa5 100644 --- a/protobuf/gen/go/auth.pb.go +++ b/protobuf/gen/go/auth.pb.go @@ -22,6 +22,53 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type RequestDetail struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId string `protobuf:"bytes,1,opt,name=requestId,proto3" json:"requestId,omitempty"` +} + +func (x *RequestDetail) Reset() { + *x = RequestDetail{} + if protoimpl.UnsafeEnabled { + mi := &file_auth_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RequestDetail) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RequestDetail) ProtoMessage() {} + +func (x *RequestDetail) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[0] + 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 RequestDetail.ProtoReflect.Descriptor instead. +func (*RequestDetail) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{0} +} + +func (x *RequestDetail) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + type EmailLoginRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -34,7 +81,7 @@ type EmailLoginRequest struct { func (x *EmailLoginRequest) Reset() { *x = EmailLoginRequest{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[0] + mi := &file_auth_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -47,7 +94,7 @@ func (x *EmailLoginRequest) String() string { func (*EmailLoginRequest) ProtoMessage() {} func (x *EmailLoginRequest) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[0] + mi := &file_auth_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -60,7 +107,7 @@ func (x *EmailLoginRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use EmailLoginRequest.ProtoReflect.Descriptor instead. func (*EmailLoginRequest) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{0} + return file_auth_proto_rawDescGZIP(), []int{1} } func (x *EmailLoginRequest) GetEmail() string { @@ -90,7 +137,7 @@ type EmailLoginResponse struct { func (x *EmailLoginResponse) Reset() { *x = EmailLoginResponse{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[1] + mi := &file_auth_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -103,7 +150,7 @@ func (x *EmailLoginResponse) String() string { func (*EmailLoginResponse) ProtoMessage() {} func (x *EmailLoginResponse) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[1] + mi := &file_auth_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116,7 +163,7 @@ func (x *EmailLoginResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use EmailLoginResponse.ProtoReflect.Descriptor instead. func (*EmailLoginResponse) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{1} + return file_auth_proto_rawDescGZIP(), []int{2} } func (x *EmailLoginResponse) GetUserId() string { @@ -152,7 +199,7 @@ type EmailRegisterRequest struct { func (x *EmailRegisterRequest) Reset() { *x = EmailRegisterRequest{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[2] + mi := &file_auth_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -165,7 +212,7 @@ func (x *EmailRegisterRequest) String() string { func (*EmailRegisterRequest) ProtoMessage() {} func (x *EmailRegisterRequest) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[2] + mi := &file_auth_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -178,7 +225,7 @@ func (x *EmailRegisterRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use EmailRegisterRequest.ProtoReflect.Descriptor instead. func (*EmailRegisterRequest) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{2} + return file_auth_proto_rawDescGZIP(), []int{3} } func (x *EmailRegisterRequest) GetEmail() string { @@ -206,7 +253,7 @@ type EmailRegisterResponse struct { func (x *EmailRegisterResponse) Reset() { *x = EmailRegisterResponse{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[3] + mi := &file_auth_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -219,7 +266,7 @@ func (x *EmailRegisterResponse) String() string { func (*EmailRegisterResponse) ProtoMessage() {} func (x *EmailRegisterResponse) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[3] + mi := &file_auth_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -232,7 +279,7 @@ func (x *EmailRegisterResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use EmailRegisterResponse.ProtoReflect.Descriptor instead. func (*EmailRegisterResponse) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{3} + return file_auth_proto_rawDescGZIP(), []int{4} } func (x *EmailRegisterResponse) GetUserId() string { @@ -253,7 +300,7 @@ type RefreshTokenRequest struct { func (x *RefreshTokenRequest) Reset() { *x = RefreshTokenRequest{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[4] + mi := &file_auth_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -266,7 +313,7 @@ func (x *RefreshTokenRequest) String() string { func (*RefreshTokenRequest) ProtoMessage() {} func (x *RefreshTokenRequest) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[4] + mi := &file_auth_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -279,7 +326,7 @@ func (x *RefreshTokenRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RefreshTokenRequest.ProtoReflect.Descriptor instead. func (*RefreshTokenRequest) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{4} + return file_auth_proto_rawDescGZIP(), []int{5} } func (x *RefreshTokenRequest) GetRefreshToken() string { @@ -301,7 +348,7 @@ type RefreshTokenResponse struct { func (x *RefreshTokenResponse) Reset() { *x = RefreshTokenResponse{} if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[5] + mi := &file_auth_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -314,7 +361,7 @@ func (x *RefreshTokenResponse) String() string { func (*RefreshTokenResponse) ProtoMessage() {} func (x *RefreshTokenResponse) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[5] + mi := &file_auth_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -327,7 +374,7 @@ func (x *RefreshTokenResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RefreshTokenResponse.ProtoReflect.Descriptor instead. func (*RefreshTokenResponse) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{5} + return file_auth_proto_rawDescGZIP(), []int{6} } func (x *RefreshTokenResponse) GetRefreshToken() string { @@ -352,61 +399,63 @@ var file_auth_proto_rawDesc = []byte{ 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x45, 0x0a, 0x11, 0x45, 0x6d, - 0x61, 0x69, 0x6c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, - 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, - 0x64, 0x22, 0x74, 0x0a, 0x12, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, - 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x5f, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, - 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x48, 0x0a, 0x14, 0x45, 0x6d, 0x61, 0x69, 0x6c, - 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, - 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, - 0x64, 0x22, 0x2f, 0x0a, 0x15, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, - 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, - 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, - 0x49, 0x64, 0x22, 0x39, 0x0a, 0x13, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x66, - 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x5c, 0x0a, - 0x14, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x66, - 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0x9d, 0x02, 0x0a, 0x0b, - 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x50, 0x0a, 0x0a, 0x45, - 0x6d, 0x61, 0x69, 0x6c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x12, 0x2e, 0x45, 0x6d, 0x61, 0x69, - 0x6c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, - 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, - 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x5c, 0x0a, - 0x0d, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x15, - 0x2e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x67, - 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, - 0x65, 0x72, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x5e, 0x0a, 0x0c, 0x52, - 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14, 0x2e, 0x52, 0x65, - 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x15, 0x2e, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, - 0x3a, 0x01, 0x2a, 0x22, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x72, 0x65, - 0x66, 0x72, 0x65, 0x73, 0x68, 0x2d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x5c, 0x92, 0x41, 0x3b, - 0x12, 0x05, 0x32, 0x03, 0x31, 0x2e, 0x30, 0x1a, 0x0e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x6f, 0x6e, - 0x69, 0x66, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2a, 0x01, 0x02, 0x5a, 0x1f, 0x0a, 0x1d, 0x0a, 0x06, - 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x12, 0x13, 0x08, 0x02, 0x1a, 0x0d, 0x41, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x02, 0x5a, 0x1c, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x53, 0x70, 0x65, 0x65, 0x64, 0x52, 0x65, 0x61, - 0x63, 0x68, 0x2f, 0x6d, 0x6f, 0x6e, 0x69, 0x66, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2d, 0x0a, 0x0d, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x22, 0x45, 0x0a, 0x11, 0x45, 0x6d, 0x61, + 0x69, 0x6c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, + 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, + 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, + 0x22, 0x74, 0x0a, 0x12, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x21, + 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x5f, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, + 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x48, 0x0a, 0x14, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, + 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, + 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, + 0x22, 0x2f, 0x0a, 0x15, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, + 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, + 0x64, 0x22, 0x39, 0x0a, 0x13, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x66, 0x72, + 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x5c, 0x0a, 0x14, + 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x66, 0x72, + 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0x9d, 0x02, 0x0a, 0x0b, 0x41, + 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x50, 0x0a, 0x0a, 0x45, 0x6d, + 0x61, 0x69, 0x6c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x12, 0x2e, 0x45, 0x6d, 0x61, 0x69, 0x6c, + 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x45, + 0x6d, 0x61, 0x69, 0x6c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76, + 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x5c, 0x0a, 0x0d, + 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x15, 0x2e, + 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, + 0x72, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x5e, 0x0a, 0x0c, 0x52, 0x65, + 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14, 0x2e, 0x52, 0x65, 0x66, + 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x15, 0x2e, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x3a, + 0x01, 0x2a, 0x22, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x66, + 0x72, 0x65, 0x73, 0x68, 0x2d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x5c, 0x92, 0x41, 0x3b, 0x12, + 0x05, 0x32, 0x03, 0x31, 0x2e, 0x30, 0x1a, 0x0e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x6f, 0x6e, 0x69, + 0x66, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2a, 0x01, 0x02, 0x5a, 0x1f, 0x0a, 0x1d, 0x0a, 0x06, 0x42, + 0x65, 0x61, 0x72, 0x65, 0x72, 0x12, 0x13, 0x08, 0x02, 0x1a, 0x0d, 0x41, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x02, 0x5a, 0x1c, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x53, 0x70, 0x65, 0x65, 0x64, 0x52, 0x65, 0x61, 0x63, + 0x68, 0x2f, 0x6d, 0x6f, 0x6e, 0x69, 0x66, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -421,22 +470,23 @@ func file_auth_proto_rawDescGZIP() []byte { return file_auth_proto_rawDescData } -var file_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_auth_proto_goTypes = []interface{}{ - (*EmailLoginRequest)(nil), // 0: EmailLoginRequest - (*EmailLoginResponse)(nil), // 1: EmailLoginResponse - (*EmailRegisterRequest)(nil), // 2: EmailRegisterRequest - (*EmailRegisterResponse)(nil), // 3: EmailRegisterResponse - (*RefreshTokenRequest)(nil), // 4: RefreshTokenRequest - (*RefreshTokenResponse)(nil), // 5: RefreshTokenResponse + (*RequestDetail)(nil), // 0: RequestDetail + (*EmailLoginRequest)(nil), // 1: EmailLoginRequest + (*EmailLoginResponse)(nil), // 2: EmailLoginResponse + (*EmailRegisterRequest)(nil), // 3: EmailRegisterRequest + (*EmailRegisterResponse)(nil), // 4: EmailRegisterResponse + (*RefreshTokenRequest)(nil), // 5: RefreshTokenRequest + (*RefreshTokenResponse)(nil), // 6: RefreshTokenResponse } var file_auth_proto_depIdxs = []int32{ - 0, // 0: AuthService.EmailLogin:input_type -> EmailLoginRequest - 2, // 1: AuthService.EmailRegister:input_type -> EmailRegisterRequest - 4, // 2: AuthService.RefreshToken:input_type -> RefreshTokenRequest - 1, // 3: AuthService.EmailLogin:output_type -> EmailLoginResponse - 3, // 4: AuthService.EmailRegister:output_type -> EmailRegisterResponse - 5, // 5: AuthService.RefreshToken:output_type -> RefreshTokenResponse + 1, // 0: AuthService.EmailLogin:input_type -> EmailLoginRequest + 3, // 1: AuthService.EmailRegister:input_type -> EmailRegisterRequest + 5, // 2: AuthService.RefreshToken:input_type -> RefreshTokenRequest + 2, // 3: AuthService.EmailLogin:output_type -> EmailLoginResponse + 4, // 4: AuthService.EmailRegister:output_type -> EmailRegisterResponse + 6, // 5: AuthService.RefreshToken:output_type -> RefreshTokenResponse 3, // [3:6] is the sub-list for method output_type 0, // [0:3] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name @@ -451,7 +501,7 @@ func file_auth_proto_init() { } if !protoimpl.UnsafeEnabled { file_auth_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EmailLoginRequest); i { + switch v := v.(*RequestDetail); i { case 0: return &v.state case 1: @@ -463,7 +513,7 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EmailLoginResponse); i { + switch v := v.(*EmailLoginRequest); i { case 0: return &v.state case 1: @@ -475,7 +525,7 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EmailRegisterRequest); i { + switch v := v.(*EmailLoginResponse); i { case 0: return &v.state case 1: @@ -487,7 +537,7 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EmailRegisterResponse); i { + switch v := v.(*EmailRegisterRequest); i { case 0: return &v.state case 1: @@ -499,7 +549,7 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RefreshTokenRequest); i { + switch v := v.(*EmailRegisterResponse); i { case 0: return &v.state case 1: @@ -511,6 +561,18 @@ func file_auth_proto_init() { } } file_auth_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RefreshTokenRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_auth_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RefreshTokenResponse); i { case 0: return &v.state @@ -529,7 +591,7 @@ func file_auth_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_auth_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 7, NumExtensions: 0, NumServices: 1, }, diff --git a/services/api/controllers/group/generate_invite_code.go b/services/api/controllers/group/generate_invite_code.go index c9eb56c..5a57d1a 100644 --- a/services/api/controllers/group/generate_invite_code.go +++ b/services/api/controllers/group/generate_invite_code.go @@ -45,18 +45,24 @@ func (s Service) GenerateInviteCode(ctx context.Context, req *monify.GenerateInv return nil, status.Error(codes.PermissionDenied, "Permission denied") } + logger.Info("Generating invite code", zap.String("group_id", groupId.String())) + code, err := getExistsInviteCode(ctx, groupId) if err != nil { logger.Error("Failed to get invite code", zap.Error(err)) return nil, err } - if code != (group.InviteCode{}) && !code.IsExpired() { - _, err := db.ExecContext(ctx, `DELETE FROM group_invite_code WHERE invite_code = $1`, code.GroupId) + //clean up old invite code or return if not expired + if code != (group.InviteCode{}) { + if !code.IsExpired() { + return &monify.GenerateInviteCodeResponse{InviteCode: code.Code}, nil + } + logger.Info("Deleting expired invite code", zap.String("group_id", groupId.String()), zap.String("invite_code", code.Code)) + _, err := db.ExecContext(ctx, `DELETE FROM group_invite_code WHERE invite_code = $1`, code.Code) if err != nil { logger.Error("Failed to delete invite code", zap.Error(err)) return nil, status.Error(codes.Internal, "Internal") } - return &monify.GenerateInviteCodeResponse{InviteCode: code.Code}, nil } // generate invite code, we retry when the invite code already exists and is active @@ -76,9 +82,8 @@ func (s Service) GenerateInviteCode(ctx context.Context, req *monify.GenerateInv defer tx.Rollback() //check if invite code already exists and is active - row := tx.QueryRowContext(ctx, "SELECT created_at FROM group_invite_code WHERE invite_code = $1", inviteCode) var createdAt time.Time - err = row.Scan(&createdAt) + err = tx.QueryRowContext(ctx, "SELECT created_at FROM group_invite_code WHERE invite_code = $1", inviteCode).Scan(&createdAt) if err != nil && err != sql.ErrNoRows { logger.Error("", zap.Error(err)) return nil, status.Error(codes.Internal, "Internal") diff --git a/services/api/server.go b/services/api/server.go index 6642768..f6a9010 100644 --- a/services/api/server.go +++ b/services/api/server.go @@ -7,6 +7,8 @@ import ( "github.com/google/uuid" "go.uber.org/zap" "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "monify/lib" authLib "monify/lib/auth" monify "monify/protobuf/gen/go" @@ -64,6 +66,16 @@ func setupInterceptor(resources infra.Resources, config ServerConfig) grpc.Serve start := time.Now() m, err := handler(ctx, req) logger.Log(zap.InfoLevel, "request completed", zap.Duration("duration", time.Since(start)), zap.String("method", info.FullMethod)) + if err != nil { + st, _ := status.FromError(err) + if st.Code() == codes.Internal { + detail := &monify.RequestDetail{RequestId: requestId.String()} + st, err := st.WithDetails(detail) + if err == nil { + return nil, st.Err() + } + } + } return m, err } return grpc.UnaryInterceptor(interceptor)