From 4d928bf0084246f0024274a5b122eb1e5d0d40d3 Mon Sep 17 00:00:00 2001 From: Ahmet Turkmen Date: Sun, 20 Sep 2020 20:26:47 +0200 Subject: [PATCH 1/6] add onlyvpn field to event table Signed-off-by: Ahmet Turkmen --- database/query.go | 7 ++- database/store.go | 2 +- proto/store.pb.go | 141 ++++++++++++++++++++++++---------------------- proto/store.proto | 1 + 4 files changed, 81 insertions(+), 70 deletions(-) diff --git a/database/query.go b/database/query.go index 0aed8ff..4ed19e7 100644 --- a/database/query.go +++ b/database/query.go @@ -13,7 +13,8 @@ var ( "started_at timestamp, " + "finish_expected timestamp, " + "finished_at timestamp," + - "createdBy text);" + "createdBy text," + + "onlyVPN boolean);" CreateTeamsTable = "CREATE TABLE IF NOT EXISTS Team(" + "id serial primary key, " + @@ -29,8 +30,8 @@ var ( AddTeamQuery = "INSERT INTO team (tag, event_id, email, name, password, created_at, last_access, solved_challenges)" + "VALUES ($1, $2, $3, $4, $5, $6, $7, $8)" - AddEventQuery = "INSERT INTO event (tag, name, available, capacity, frontends, status, exercises, started_at, finish_expected, finished_at, createdby)" + - "VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10,$11)" + AddEventQuery = "INSERT INTO event (tag, name, available, capacity, frontends, status, exercises, started_at, finish_expected, finished_at, createdby, onlyVPN)" + + "VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10,$11,$12)" UpdateCloseEvent = "UPDATE event SET tag = $2, finished_at = $3 WHERE tag = $1" UpdateEventStatus = "UPDATE event SET status = $2 WHERE tag = $1 " diff --git a/database/store.go b/database/store.go index 33fb9bb..bbaa0f5 100644 --- a/database/store.go +++ b/database/store.go @@ -91,7 +91,7 @@ func (s *store) AddEvent(in *pb.AddEventRequest) (string, error) { finishTime, _ := time.Parse(TimeFormat, in.FinishedAt) expectedFinishTime, _ := time.Parse(TimeFormat, in.ExpectedFinishTime) - _, err := s.db.Exec(AddEventQuery, in.Tag, in.Name, in.Available, in.Capacity, in.Frontends, in.Status, in.Exercises, startTime, expectedFinishTime, finishTime, in.CreatedBy) + _, err := s.db.Exec(AddEventQuery, in.Tag, in.Name, in.Available, in.Capacity, in.Frontends, in.Status, in.Exercises, startTime, expectedFinishTime, finishTime, in.CreatedBy, in.OnlyVPN) if err != nil { return "", err diff --git a/proto/store.pb.go b/proto/store.pb.go index 1e6266d..a7a6b6e 100644 --- a/proto/store.pb.go +++ b/proto/store.pb.go @@ -494,6 +494,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"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -601,6 +602,13 @@ func (m *AddEventRequest) GetCreatedBy() string { return "" } +func (m *AddEventRequest) GetOnlyVPN() bool { + if m != nil { + return m.OnlyVPN + } + return false +} + type AddTeamRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` EventTag string `protobuf:"bytes,2,opt,name=event_tag,json=eventTag,proto3" json:"event_tag,omitempty"` @@ -1292,72 +1300,73 @@ func init() { func init() { proto.RegisterFile("store.proto", fileDescriptor_98bbca36ef968dfc) } var fileDescriptor_98bbca36ef968dfc = []byte{ - // 1034 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0xcd, 0x6e, 0xdb, 0x46, - 0x10, 0x96, 0x28, 0x4b, 0x16, 0xc7, 0xb6, 0x24, 0x6f, 0xed, 0x80, 0x65, 0x84, 0x42, 0xdd, 0x43, - 0xe1, 0x06, 0xcd, 0xb6, 0x50, 0x2e, 0x6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0xe8, 0x29, 0xb7, 0xb3, 0xd9, 0x65, 0xb1, 0x3a, 0x0b, - 0x53, 0x94, 0x70, 0x52, 0xbe, 0xbb, 0x98, 0xb2, 0xff, 0x34, 0xa0, 0xa7, 0xc5, 0xde, 0x8b, 0x5a, - 0x54, 0xc5, 0x53, 0xae, 0x45, 0x55, 0x3b, 0xff, 0x8f, 0x5a, 0x9c, 0xc2, 0x41, 0x96, 0x91, 0xa4, - 0x1e, 0xef, 0x34, 0xd8, 0xff, 0x30, 0x8a, 0xe7, 0x20, 0x15, 0x4a, 0xd3, 0x3d, 0x85, 0xae, 0x4c, - 0x80, 0x34, 0xdb, 0x63, 0xd6, 0xc8, 0xc6, 0x34, 0xa5, 0x59, 0xef, 0x94, 0xf0, 0xbf, 0xda, 0xd0, - 0x55, 0x42, 0x1b, 0x8d, 0x92, 0xf7, 0x82, 0xd1, 0xd4, 0x0b, 0x9d, 0x52, 0x55, 0x50, 0xd8, 0xbd, - 0xe0, 0xe2, 0xe2, 0xc7, 0xac, 0x1f, 0x74, 0xa2, 0x2b, 0x58, 0x29, 0x56, 0x33, 0x99, 0x36, 0x4c, - 0x01, 0x24, 0x19, 0xf0, 0xb9, 0x90, 0xb3, 0xe5, 0x12, 0x85, 0x50, 0xd9, 0x36, 0x9d, 0x12, 0x42, - 0x1e, 0xc0, 0x48, 0x84, 0xfe, 0x15, 0xba, 0xcf, 0x2e, 0xb8, 0xef, 0x63, 0x70, 0x8e, 0x22, 0x4d, - 0xfb, 0x06, 0x4e, 0x5d, 0x20, 0x2f, 0x23, 0x97, 0x4b, 0xac, 0xbf, 0x1f, 0xa1, 0xef, 0x16, 0x31, - 0x4f, 0xa9, 0x04, 0x0f, 0xf0, 0xed, 0x22, 0x2f, 0xea, 0x94, 0xaa, 0xd5, 0x44, 0xa7, 0x5e, 0x13, - 0x34, 0x80, 0x89, 0xb6, 0x92, 0x04, 0x6f, 0x5e, 0xf5, 0xa1, 0x64, 0x33, 0x49, 0xc4, 0x59, 0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x46, 0xf6, 0x58, 0x79, 0xf1, 0xb3, 0x07, 0xac, 0xb2, 0xcd, 0xe9, 0x0b, - 0xce, 0xeb, 0x17, 0x9c, 0xdf, 0xfd, 0x82, 0x8f, 0x61, 0xa4, 0x4b, 0xf1, 0x99, 0x1f, 0x0a, 0xdd, - 0xb8, 0xe4, 0x03, 0xb6, 0xd9, 0xc6, 0xf6, 0x90, 0x55, 0x4b, 0x96, 0xb6, 0xc8, 0x0b, 0xf8, 0xf0, - 0xc6, 0x4e, 0x24, 0x1f, 0xb3, 0x77, 0x75, 0x69, 0x93, 0xca, 0xe7, 0x70, 0xd0, 0xd4, 0x6c, 0x64, - 0xcc, 0x6e, 0xe9, 0xc1, 0x06, 0x45, 0xaf, 0x7a, 0xea, 0xaf, 0xe4, 0xd1, 0x3f, 0x01, 0x00, 0x00, - 0xff, 0xff, 0xf1, 0xde, 0x53, 0x82, 0xa4, 0x0c, 0x00, 0x00, + // 1050 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0xdd, 0x6e, 0xdc, 0x44, + 0x14, 0xde, 0x9f, 0xec, 0x66, 0x7d, 0xb2, 0x7f, 0x19, 0xd2, 0xca, 0xb8, 0x2b, 0xb4, 0xcc, 0x05, + 0x0a, 0x15, 0x1d, 0xd0, 0xf6, 0x26, 0x54, 0xaa, 0x60, 0x5b, 0x92, 0x2a, 0x02, 0xaa, 0xd6, 0xbb, + 0xe5, 0x16, 0x4d, 0xd7, 0xa7, 0x89, 0x85, 0xd7, 0x76, 0x3d, 0x93, 0x34, 0x7b, 0xcd, 0x0b, 0xf0, + 0x04, 0xbc, 0x04, 0x4f, 0xc0, 0x1d, 0x77, 0x3c, 0x08, 0x2f, 0x81, 0x3c, 0xe3, 0xff, 0x75, 0xd2, + 0x20, 0x71, 0x01, 0x77, 0x3e, 0xdf, 0x9c, 0xbf, 0x39, 0x7f, 0x73, 0x0c,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x3d, 0xde, 0x6a, 0xe4, 0xff, 0xde, 0xca, 0x1f, 0x8a, 0x44, 0x28, 0x49, 0xf7, 0x0c, 0x3a, 0x32, + 0x06, 0x92, 0x6c, 0x4f, 0x58, 0x2d, 0x1b, 0xd3, 0x94, 0x66, 0xbd, 0x55, 0xc2, 0xff, 0x6c, 0x42, + 0x47, 0x09, 0x6d, 0x35, 0x4a, 0xd6, 0x0b, 0xad, 0xba, 0x5e, 0x68, 0x17, 0xaa, 0x82, 0x42, 0xff, + 0x9c, 0x8b, 0xf3, 0x17, 0x69, 0x3f, 0xe8, 0x44, 0x97, 0xb0, 0x42, 0xac, 0xe6, 0x32, 0x69, 0x98, + 0x1c, 0x88, 0x33, 0xe0, 0x71, 0x21, 0xe7, 0xab, 0x15, 0x0a, 0xa1, 0xb2, 0x6d, 0xd8, 0x05, 0x84, + 0xdc, 0x87, 0xb1, 0x08, 0xbc, 0x4b, 0x74, 0x9e, 0x9e, 0x73, 0xcf, 0x43, 0xff, 0x0c, 0x45, 0x92, + 0xf6, 0x2d, 0x9c, 0x3a, 0x40, 0x5e, 0x85, 0x0e, 0x97, 0x58, 0x7d, 0x59, 0x02, 0xcf, 0xc9, 0x63, + 0x9e, 0x50, 0x31, 0xee, 0xe3, 0xbb, 0x65, 0x56, 0xd4, 0x09, 0x55, 0xa9, 0x89, 0x76, 0xb5, 0x26, + 0xa8, 0x0f, 0x53, 0x6d, 0x25, 0x0e, 0xde, 0xa2, 0xec, 0x43, 0xc1, 0x66, 0x9c, 0x88, 0xd3, 0x34, + 0xaa, 0x09, 0x55, 0xd3, 0x45, 0x53, 0xd8, 0x5b, 0x05, 0xeb, 0xd0, 0x43, 0x59, 0x30, 0x57, 0x84, + 0xe8, 0x4b, 0xb8, 0x97, 0xdb, 0xfb, 0x2e, 0x8b, 0xcc, 0xfb, 0x4c, 0x59, 0xd0, 0xe3, 0x8a, 0x71, + 0x2e, 0xd3, 0x61, 0x97, 0xd2, 0xf1, 0x98, 0xd2, 0x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 0xb6, 0x13, 0xc9, 0xc7, 0xec, 0x7d, 0x5d, 0x5a, 0xa7, 0xf2, 0x19, 0x1c, 0xd4, 0x35, 0x1b, 0x99, + 0xb0, 0x1b, 0x7a, 0xb0, 0x46, 0xd1, 0xeb, 0xae, 0xfa, 0x5f, 0x79, 0xf8, 0x77, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xd9, 0xa4, 0x25, 0x8e, 0xbe, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/proto/store.proto b/proto/store.proto index c8f792f..391b9ed 100644 --- a/proto/store.proto +++ b/proto/store.proto @@ -86,6 +86,7 @@ message AddEventRequest{ string finishedAt = 9; int32 status = 10; string createdBy = 11; + bool onlyVPN = 12; } message AddTeamRequest{ From 3ae271d51680737b63d4c99ac598eb9a16efe2fa Mon Sep 17 00:00:00 2001 From: Ahmet Turkmen Date: Sun, 20 Sep 2020 20:27:15 +0200 Subject: [PATCH 2/6] include dev docker-compose Signed-off-by: Ahmet Turkmen --- docker-compose-dev.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 docker-compose-dev.yml diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml new file mode 100644 index 0000000..0a035a7 --- /dev/null +++ b/docker-compose-dev.yml @@ -0,0 +1,37 @@ +version: '3' +services: + server: + container_name: server + env_file: + - .env + build: . + ports: + - 50051:50051 + restart: on-failure + depends_on: + - postgres-db + volumes: + - ${CERTS_PATH}:/certs:ro # in production, change this CERTS_PATH to your certificate files folder + - ${CONFIG_PATH}:/config.yml:ro # mount config file + networks: + - internal + + postgres-db: + image: postgres:alpine + container_name: postgres + command: postgres + env_file: + - .env + ports: + - '5432:5432' + volumes: + - data:/var/lib/postgresql/data + networks: + - internal + +# Networks to be created to facilitate communication between containers +volumes: + data: +networks: + internal: + driver: bridge From d6fd97761f6088ca892119d7f998a818d894618c Mon Sep 17 00:00:00 2001 From: Ahmet Turkmen Date: Sun, 20 Sep 2020 20:27:31 +0200 Subject: [PATCH 3/6] update version of postgres Signed-off-by: Ahmet Turkmen --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index af543bd..91c01da 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,7 +17,7 @@ services: - internal postgres-db: - image: postgres:9.6.18-alpine + image: postgres:alpine container_name: postgres command: postgres -c config_file=/etc/postgresql/postgresql.conf -c logging_collector=on -c log_destination=stderr -c log_directory=/logs env_file: From 50b1f989fa0ccc0fe200355f8d86ea75a9a768d7 Mon Sep 17 00:00:00 2001 From: Ahmet Turkmen Date: Sun, 20 Sep 2020 20:43:58 +0200 Subject: [PATCH 4/6] add onlyVPN to test and response Signed-off-by: Ahmet Turkmen --- database/store.go | 2 +- database/store_test.go | 1 + database/timeline.go | 2 +- database/timeline_test.go | 1 + model/model.go | 1 + proto/store.pb.go | 142 ++++++++++++++++++++------------------ proto/store.proto | 1 + 7 files changed, 81 insertions(+), 69 deletions(-) diff --git a/database/store.go b/database/store.go index bbaa0f5..9a5245b 100644 --- a/database/store.go +++ b/database/store.go @@ -321,7 +321,7 @@ func parseEvents(rows *sql.Rows) ([]model.Event, error) { for rows.Next() { event := new(model.Event) err := rows.Scan(&event.Id, &event.Tag, &event.Name, &event.Available, &event.Capacity, &event.Status, &event.Frontends, - &event.Exercises, &event.StartedAt, &event.ExpectedFinishTime, &event.FinishedAt, &event.CreatedBy) + &event.Exercises, &event.StartedAt, &event.ExpectedFinishTime, &event.FinishedAt, &event.CreatedBy, &event.OnlyVPN) if err != nil && !strings.Contains(err.Error(), handleNullConversionError) { return nil, err } diff --git a/database/store_test.go b/database/store_test.go index fa12e9c..5c0aac9 100644 --- a/database/store_test.go +++ b/database/store_test.go @@ -213,6 +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, } resp, err := c.AddEvent(context.Background(), &req) diff --git a/database/timeline.go b/database/timeline.go index f30d3b8..22d20ac 100644 --- a/database/timeline.go +++ b/database/timeline.go @@ -72,7 +72,7 @@ func getEvents(db *sql.DB) []model.Event { for r.Next() { event := new(model.Event) err := r.Scan(&event.Id, &event.Tag, &event.Name, &event.Available, &event.Capacity, &event.Status, &event.Frontends, - &event.Exercises, &event.StartedAt, &event.ExpectedFinishTime, &event.FinishedAt, &event.CreatedBy) + &event.Exercises, &event.StartedAt, &event.ExpectedFinishTime, &event.FinishedAt, &event.CreatedBy, &event.OnlyVPN) if err != nil && !strings.Contains(err.Error(), "Null conversion error ") { log.Fatalf("Error on scanning query %v", err) } diff --git a/database/timeline_test.go b/database/timeline_test.go index e45392f..52c9295 100644 --- a/database/timeline_test.go +++ b/database/timeline_test.go @@ -212,6 +212,7 @@ func TestGetEvents(t *testing.T) { ExpectedFinishTime: expectedFinishTime.Format(time.RFC3339), FinishedAt: time.Date(0001, 01, 01, 00, 00, 00, 0000, time.UTC).Format(time.RFC3339), CreatedBy: "tester", + OnlyVPN: false, }} if got := getEvents(db); !reflect.DeepEqual(got, events) { diff --git a/model/model.go b/model/model.go index cfe81b0..f91cd52 100644 --- a/model/model.go +++ b/model/model.go @@ -13,6 +13,7 @@ type Event struct { ExpectedFinishTime string FinishedAt string CreatedBy string + OnlyVPN bool } type Team struct { diff --git a/proto/store.pb.go b/proto/store.pb.go index a7a6b6e..93cf3fc 100644 --- a/proto/store.pb.go +++ b/proto/store.pb.go @@ -786,6 +786,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"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -893,6 +894,13 @@ func (m *GetEventResponse_Events) GetCreatedBy() string { return "" } +func (m *GetEventResponse_Events) GetOnlyVPN() bool { + if m != nil { + return m.OnlyVPN + } + return false +} + type GetEventTeamsRequest struct { EventTag string `protobuf:"bytes,1,opt,name=eventTag,proto3" json:"eventTag,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -1300,73 +1308,73 @@ func init() { func init() { proto.RegisterFile("store.proto", fileDescriptor_98bbca36ef968dfc) } var fileDescriptor_98bbca36ef968dfc = []byte{ - // 1050 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0xdd, 0x6e, 0xdc, 0x44, - 0x14, 0xde, 0x9f, 0xec, 0x66, 0x7d, 0xb2, 0x7f, 0x19, 0xd2, 0xca, 0xb8, 0x2b, 0xb4, 0xcc, 0x05, - 0x0a, 0x15, 0x1d, 0xd0, 0xf6, 0x26, 0x54, 0xaa, 0x60, 0x5b, 0x92, 0x2a, 0x02, 0xaa, 0xd6, 0xbb, - 0xe5, 0x16, 0x4d, 0xd7, 0xa7, 0x89, 0x85, 0xd7, 0x76, 0x3d, 0x93, 0x34, 0x7b, 0xcd, 0x0b, 0xf0, - 0x04, 0xbc, 0x04, 0x4f, 0xc0, 0x1d, 0x77, 0x3c, 0x08, 0x2f, 0x81, 0x3c, 0xe3, 0xff, 0x75, 0xd2, - 0x20, 0x71, 0x01, 0x77, 0x3e, 0xdf, 0x9c, 0xbf, 0x39, 0x7f, 0x73, 0x0c, 0x7b, 0x42, 0x06, 0x11, - 0xb2, 0x30, 0x0a, 0x64, 0x40, 0x87, 0xd0, 0x3f, 0x5e, 0x87, 0x72, 0x63, 0xe3, 0xdb, 0x0b, 0x14, - 0x92, 0xfe, 0xda, 0x84, 0x3b, 0xcf, 0x50, 0x2e, 0xdd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0xff, 0x6c, 0x42, - 0x47, 0x09, 0x6d, 0x35, 0x4a, 0xd6, 0x0b, 0xad, 0xba, 0x5e, 0x68, 0x17, 0xaa, 0x82, 0x42, 0xff, - 0x9c, 0x8b, 0xf3, 0x17, 0x69, 0x3f, 0xe8, 0x44, 0x97, 0xb0, 0x42, 0xac, 0xe6, 0x32, 0x69, 0x98, - 0x1c, 0x88, 0x33, 0xe0, 0x71, 0x21, 0xe7, 0xab, 0x15, 0x0a, 0xa1, 0xb2, 0x6d, 0xd8, 0x05, 0x84, - 0xdc, 0x87, 0xb1, 0x08, 0xbc, 0x4b, 0x74, 0x9e, 0x9e, 0x73, 0xcf, 0x43, 0xff, 0x0c, 0x45, 0x92, - 0xf6, 0x2d, 0x9c, 0x3a, 0x40, 0x5e, 0x85, 0x0e, 0x97, 0x58, 0x7d, 0x59, 0x02, 0xcf, 0xc9, 0x63, - 0x9e, 0x50, 0x31, 0xee, 0xe3, 0xbb, 0x65, 0x56, 0xd4, 0x09, 0x55, 0xa9, 0x89, 0x76, 0xb5, 0x26, - 0xa8, 0x0f, 0x53, 0x6d, 0x25, 0x0e, 0xde, 0xa2, 0xec, 0x43, 0xc1, 0x66, 0x9c, 0x88, 0xd3, 0x34, - 0xaa, 0x09, 0x55, 0xd3, 0x45, 0x53, 0xd8, 0x5b, 0x05, 0xeb, 0xd0, 0x43, 0x59, 0x30, 0x57, 0x84, - 0xe8, 0x4b, 0xb8, 0x97, 0xdb, 0xfb, 0x2e, 0x8b, 0xcc, 0xfb, 0x4c, 0x59, 0xd0, 0xe3, 0x8a, 0x71, - 0x2e, 0xd3, 0x61, 0x97, 0xd2, 0xf1, 0x98, 0xd2, 0x2a, 0xff, 0x9d, 0x31, 0x35, 0xfb, 0xa5, 0x0b, - 0x1d, 0xfd, 0x18, 0x7e, 0x0e, 0xbd, 0xf4, 0xcd, 0x23, 0x63, 0x56, 0x79, 0xfe, 0xac, 0x11, 0x2b, - 0x4f, 0x47, 0xda, 0x20, 0x0f,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, 0x77, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xd9, 0xa4, 0x25, 0x8e, 0xbe, 0x0c, 0x00, 0x00, + // 1051 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0xcd, 0x6e, 0x1c, 0x45, + 0x10, 0xde, 0x1f, 0xef, 0x7a, 0xa7, 0xbc, 0x7f, 0x6e, 0x9c, 0x68, 0x98, 0xac, 0xd0, 0xd2, 0x07, + 0x64, 0x22, 0xd2, 0xa0, 0xcd, 0xc5, 0x44, 0x8a, 0x60, 0x13, 0xec, 0xc8, 0x02, 0xa2, 0x64, 0x76, + 0xc3, 0x15, 0x75, 0x76, 0x2a, 0xf6, 0x88, 0xd9, 0x99, 0xc9, 0x74, 0xdb, 0xf1, 0x9e, 0x79, 0x01, + 0x9e, 0x80, 0x77, 0xe1, 0x01, 0x10, 0xef, 0xc0, 0x95, 0x97, 0x40, 0xd3, 0x3d, 0xff, 0x3b, 0x76, + 0x8c, 0xc4, 0x01, 0x6e, 0x53, 0x5f, 0x57, 0x57, 0x55, 0x57, 0x7f, 0x55, 0x5d, 0x03, 0x7b, 0x42, + 0x06, 0x11, 0xb2, 0x30, 0x0a, 0x64, 0x40, 0x87, 0xd0, 0x3f, 0x5e, 0x87, 0x72, 0x63, 0xe3, 0xdb, + 0x0b, 0x14, 0x92, 0xfe, 0xda, 0x84, 0x3b, 0xcf, 0x50, 0x2e, 0xdd, 0x35, 0x2e, 0x30, 0x72, 0x51, + 0xd8, 0x28, 0xc2, 0xc0, 0x17, 0x48, 0x4e, 0x00, 0xa4, 0xbb, 0x46, 0xa1, 0x50, 0xb3, 0x39, 0x6d, + 0x1f, 0xee, 0xcd, 0x3e, 0x61, 0xb5, 0xba, 0x6c, 0x99, 0x29, 0x1e, 0xfb, 0x32, 0xda, 0xd8, 0x85, + 0x9d, 0xd6, 0x63, 0x18, 0x55, 0x96, 0xc9,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x56, 0x28, 0x84, 0xe2, 0x81, 0x61, + 0x17, 0x10, 0x72, 0x1f, 0xc6, 0x22, 0xf0, 0x2e, 0xd1, 0x79, 0x7a, 0xce, 0x3d, 0x0f, 0xfd, 0x33, + 0x14, 0x09, 0x21, 0xb6, 0x70, 0xea, 0x00, 0x79, 0x15, 0x3a, 0x5c, 0x62, 0xf5, 0xcd, 0x09, 0x3c, + 0x27, 0xcf, 0x79, 0x22, 0xc5, 0xb8, 0x8f, 0xef, 0x96, 0x19, 0xdd, 0x13, 0xa9, 0xc2, 0x96, 0x76, + 0x95, 0x2d, 0xd4, 0x87, 0xa9, 0xf6, 0x12, 0x27, 0x6f, 0x51, 0x8e, 0xa1, 0xe0, 0x33, 0xbe, 0x88, + 0xd3, 0x34, 0xab, 0x89, 0x54, 0x53, 0x5f, 0x53, 0xd8, 0x5b, 0x05, 0xeb, 0xd0, 0x43, 0x59, 0x70, + 0x57, 0x84, 0xe8, 0x4b, 0xb8, 0x97, 0xfb, 0xfb, 0x2e, 0xcb, 0xcc, 0xfb, 0x5c, 0x59, 0xd0, 0xe3, + 0x4a, 0x71, 0x2e, 0xd3, 0x36, 0x98, 0xca, 0x71, 0x03, 0xd3, 0x26, 0xff, 0x9d, 0x06, 0x36, 0xfb, + 0xa5, 0x0b, 0x1d, 0xfd, 0x4c, 0x7e, 0x0e, 0xbd, 0xf4, 0x35, 0x24, 0x63, 0x56, 0x79, 0x18, 0xad, + 0x11, 0x2b, 0xf7, 0x4d, 0xda, 0x20, 0x0f, 0x60, 0x37, 0x69, 0xe8, 0x64, 0xc4, 0xca, 0xad, 0xbd, + 0x4e, 0x7d, 0x06, 0x46, 0x4a, 0x7f, 0x41, 0xc6, 0xac, 0x32, 0x5f, 0x58, 0xfb, 0x5b, 0x4d, 0x92, + 0x36, 0xc8, 0x97, 0x30, 0x2c, 0x0f, 0x17, 0x84, 0xb0, 0xad, 0x69, 0xa3, 0x7e, 0xeb, 0xd7, 0x30, + 0x28, 0x55, 0x1b, 0xb9, 0xc3, 0xea, 0x2a, 0xdb, 0xba, 0x5b, 0x5f, 0x94, 0xb4, 0x41, 0x1e, 0xe7, + 0xce, 0xf5, 0x38, 0x41, 0x72, 0xdd, 0xd2, 0xa4, 0x62, 0xed, 0xb3, 0xea, 0xd0, 0x41, 0x1b, 0xe4, + 0x08, 0x06, 0xa7, 0x42, 0xe1, 0x6a, 0x78, 0x13, 0x64, 0x9f, 0x55, 0x67, 0x46, 0x8b, 0xb0, 0xad, + 0xf1, 0x4f, 0xef, 0x2c, 0x8d, 0xc1, 0x64, 0xc0, 0x8a, 0x33, 0xb5, 0x0e, 0x79, 0x7b, 0x4a, 0xa6, + 0x0d, 0xf2, 0x19, 0x18, 0xd9, 0x98, 0x47, 0x06, 0xac, 0x38, 0x2c, 0x5a, 0x43, 0x56, 0x9a, 0x00, + 0xf5, 0x01, 0x17, 0xd5, 0x03, 0x2e, 0x6e, 0x7f, 0xc0, 0x47, 0x30, 0xd6, 0x54, 0x7c, 0xea, 0x05, + 0x42, 0x17, 0x2e, 0xf9, 0x80, 0x6d, 0x97, 0xb1, 0x35, 0x62, 0x65, 0xca, 0xd2, 0x06, 0x79, 0x09, + 0x1f, 0x5e, 0x5b, 0x89, 0xe4, 0x63, 0xf6, 0xbe, 0x2a, 0xad, 0x33, 0xf9, 0x0c, 0x0e, 0xea, 0x8a, + 0x8d, 0x4c, 0xd8, 0x0d, 0x35, 0x58, 0x63, 0xe8, 0x75, 0x57, 0xfd, 0xc9, 0x3c, 0xfc, 0x3b, 0x00, + 0x00, 0xff, 0xff, 0x59, 0xd1, 0xb0, 0x06, 0xd8, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/proto/store.proto b/proto/store.proto index 391b9ed..21f07d7 100644 --- a/proto/store.proto +++ b/proto/store.proto @@ -115,6 +115,7 @@ message GetEventResponse{ string finishedAt = 9; int32 status = 10; string createdBy =11; + bool onlyVPN = 12; } repeated Events events = 1; string errorMessage = 2; From 31ec2a4e76e6a13c3dcff5875e5c514934e43b6d Mon Sep 17 00:00:00 2001 From: Ahmet Turkmen Date: Sun, 20 Sep 2020 20:52:54 +0200 Subject: [PATCH 5/6] fix tests Signed-off-by: Ahmet Turkmen --- database/timeline_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/timeline_test.go b/database/timeline_test.go index 52c9295..5f3ca0f 100644 --- a/database/timeline_test.go +++ b/database/timeline_test.go @@ -57,7 +57,7 @@ func insertTeamEvent(eid int, db *sql.DB) error { } func insertFakeEvent(event fakeEvent, db *sql.DB) error { - _, err := db.Exec(AddEventQuery, event.tag, "", event.available, event.capacity, "kali", 1, "ftp,sql", event.sT.UTC(), event.fT.UTC(), time.Date(0001, 01, 01, 00, 00, 00, 0000, time.UTC).Format(time.RFC3339), "tester") + _, err := db.Exec(AddEventQuery, event.tag, "", event.available, event.capacity, "kali", 1, "ftp,sql", event.sT.UTC(), event.fT.UTC(), time.Date(0001, 01, 01, 00, 00, 00, 0000, time.UTC).Format(time.RFC3339), "tester", false) if err != nil { return err } From 2159a0e8d2e392588fd3e496ab8cc84faf2b1719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20T=C3=BCrkmen?= Date: Fri, 25 Sep 2020 09:49:29 +0200 Subject: [PATCH 6/6] add only vpn field to getevents response (#39) Signed-off-by: Ahmet Turkmen --- database/query.go | 2 +- util/util.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/database/query.go b/database/query.go index 4ed19e7..045ee21 100644 --- a/database/query.go +++ b/database/query.go @@ -30,7 +30,7 @@ var ( AddTeamQuery = "INSERT INTO team (tag, event_id, email, name, password, created_at, last_access, solved_challenges)" + "VALUES ($1, $2, $3, $4, $5, $6, $7, $8)" - AddEventQuery = "INSERT INTO event (tag, name, available, capacity, frontends, status, exercises, started_at, finish_expected, finished_at, createdby, onlyVPN)" + + AddEventQuery = "INSERT INTO event (tag, name, available, capacity, frontends, status, exercises, started_at, finish_expected, finished_at, createdby, onlyvpn)" + "VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10,$11,$12)" UpdateCloseEvent = "UPDATE event SET tag = $2, finished_at = $3 WHERE tag = $1" diff --git a/util/util.go b/util/util.go index 378d875..22d4f1e 100644 --- a/util/util.go +++ b/util/util.go @@ -336,6 +336,7 @@ func getEventsResponse(result []model.Event) []*pb.GetEventResponse_Events { FinishedAt: e.FinishedAt, Status: e.Status, CreatedBy: e.CreatedBy, + OnlyVPN: e.OnlyVPN, }) } log.Printf("Get Events")