From 02649f54f282a1706a07342a4a6e24edd249954e Mon Sep 17 00:00:00 2001 From: Ahmet Turkmen Date: Tue, 17 Aug 2021 12:28:59 +0200 Subject: [PATCH 1/3] update grpc message for onlyVPN Signed-off-by: Ahmet Turkmen --- proto/store.pb.go | 16 ++++++++-------- proto/store.proto | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/proto/store.pb.go b/proto/store.pb.go index f603fcb..80fc886 100644 --- a/proto/store.pb.go +++ b/proto/store.pb.go @@ -942,7 +942,7 @@ type AddEventRequest struct { FinishedAt string `protobuf:"bytes,9,opt,name=finishedAt,proto3" json:"finishedAt,omitempty"` Status int32 `protobuf:"varint,10,opt,name=status,proto3" json:"status,omitempty"` CreatedBy string `protobuf:"bytes,11,opt,name=createdBy,proto3" json:"createdBy,omitempty"` - OnlyVPN bool `protobuf:"varint,12,opt,name=onlyVPN,proto3" json:"onlyVPN,omitempty"` + OnlyVPN int32 `protobuf:"varint,12,opt,name=onlyVPN,proto3" json:"onlyVPN,omitempty"` SecretKey string `protobuf:"bytes,13,opt,name=secretKey,proto3" json:"secretKey,omitempty"` DisabledExercises string `protobuf:"bytes,14,opt,name=disabledExercises,proto3" json:"disabledExercises,omitempty"` } @@ -1056,11 +1056,11 @@ func (x *AddEventRequest) GetCreatedBy() string { return "" } -func (x *AddEventRequest) GetOnlyVPN() bool { +func (x *AddEventRequest) GetOnlyVPN() int32 { if x != nil { return x.OnlyVPN } - return false + return 0 } func (x *AddEventRequest) GetSecretKey() string { @@ -1620,7 +1620,7 @@ type GetEventResponse_Events struct { FinishedAt string `protobuf:"bytes,9,opt,name=finishedAt,proto3" json:"finishedAt,omitempty"` Status int32 `protobuf:"varint,10,opt,name=status,proto3" json:"status,omitempty"` CreatedBy string `protobuf:"bytes,11,opt,name=createdBy,proto3" json:"createdBy,omitempty"` - OnlyVPN bool `protobuf:"varint,12,opt,name=onlyVPN,proto3" json:"onlyVPN,omitempty"` + OnlyVPN int32 `protobuf:"varint,12,opt,name=onlyVPN,proto3" json:"onlyVPN,omitempty"` // 0 browser // 1 VPN 2 // VPN + Browser SecretKey string `protobuf:"bytes,13,opt,name=secretKey,proto3" json:"secretKey,omitempty"` DisabledExercises string `protobuf:"bytes,14,opt,name=disabledExercises,proto3" json:"disabledExercises,omitempty"` } @@ -1734,11 +1734,11 @@ func (x *GetEventResponse_Events) GetCreatedBy() string { return "" } -func (x *GetEventResponse_Events) GetOnlyVPN() bool { +func (x *GetEventResponse_Events) GetOnlyVPN() int32 { if x != nil { return x.OnlyVPN } - return false + return 0 } func (x *GetEventResponse_Events) GetSecretKey() string { @@ -1947,7 +1947,7 @@ var file_store_proto_rawDesc = []byte{ 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x42, 0x79, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x42, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x6e, 0x6c, 0x79, 0x56, 0x50, 0x4e, - 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6f, 0x6e, 0x6c, 0x79, 0x56, 0x50, 0x4e, 0x12, + 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6f, 0x6e, 0x6c, 0x79, 0x56, 0x50, 0x4e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x11, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x45, 0x78, 0x65, 0x72, 0x63, 0x69, 0x73, @@ -1994,7 +1994,7 @@ var file_store_proto_rawDesc = []byte{ 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x42, 0x79, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x42, 0x79, 0x12, 0x18, 0x0a, - 0x07, 0x6f, 0x6e, 0x6c, 0x79, 0x56, 0x50, 0x4e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, + 0x07, 0x6f, 0x6e, 0x6c, 0x79, 0x56, 0x50, 0x4e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6f, 0x6e, 0x6c, 0x79, 0x56, 0x50, 0x4e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x11, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, diff --git a/proto/store.proto b/proto/store.proto index 8e5c5ba..400d417 100644 --- a/proto/store.proto +++ b/proto/store.proto @@ -128,7 +128,7 @@ message AddEventRequest{ string finishedAt = 9; int32 status = 10; string createdBy = 11; - bool onlyVPN = 12; + int32 onlyVPN = 12; string secretKey = 13; string disabledExercises = 14; } @@ -159,7 +159,7 @@ message GetEventResponse{ string finishedAt = 9; int32 status = 10; string createdBy =11; - bool onlyVPN = 12; + int32 onlyVPN = 12; // 0 browser // 1 VPN 2 // VPN + Browser string secretKey = 13; string disabledExercises = 14; } From 5a1715dc47565cc7ac3cc6e294983e1dca262113 Mon Sep 17 00:00:00 2001 From: Ahmet Turkmen Date: Tue, 17 Aug 2021 12:29:18 +0200 Subject: [PATCH 2/3] update onlyVPN variable to integer Signed-off-by: Ahmet Turkmen --- database/query.go | 2 +- model/model.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/database/query.go b/database/query.go index cf0a7f5..f21c386 100644 --- a/database/query.go +++ b/database/query.go @@ -14,7 +14,7 @@ var ( "finish_expected timestamp, " + "finished_at timestamp," + "createdBy text," + - "onlyVPN boolean," + + "onlyVPN integer," + "secretKey text," + "disabledExercises text);" diff --git a/model/model.go b/model/model.go index 07f9579..fe32590 100644 --- a/model/model.go +++ b/model/model.go @@ -13,7 +13,7 @@ type Event struct { ExpectedFinishTime string FinishedAt string CreatedBy string - OnlyVPN bool + OnlyVPN int32 SecretKey string DisabledExercises string } From a4ab77b3e4df241700e8a5c4def3270c599c4f18 Mon Sep 17 00:00:00 2001 From: Ahmet Turkmen Date: Tue, 17 Aug 2021 12:29:36 +0200 Subject: [PATCH 3/3] update tests; change onlyVPN Signed-off-by: Ahmet Turkmen --- database/store_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/store_test.go b/database/store_test.go index 763daea..b83603d 100644 --- a/database/store_test.go +++ b/database/store_test.go @@ -213,7 +213,7 @@ func TestAddEvent(t *testing.T) { Status: 1, ExpectedFinishTime: "2020-05-21 14:35:01", FinishedAt: "0001-01-01 00:00:00", // it means that event is not finished yet - OnlyVPN: false, + OnlyVPN: 0, SecretKey: "", DisabledExercises: "", } @@ -342,7 +342,7 @@ func TestMultipleEventWithSameTag(t *testing.T) { Capacity: 2, StartTime: "2020-06-20 14:35:01", ExpectedFinishTime: "2020-06-21 14:35:01", - OnlyVPN: false, + OnlyVPN: 0, SecretKey: "", DisabledExercises: "", }