From a028e2ecaa8540d5b0852d14e39aac55bde77326 Mon Sep 17 00:00:00 2001 From: idoko Date: Tue, 28 May 2024 06:50:10 +0100 Subject: [PATCH 1/4] store snoozed PMM versions --- api/swagger/swagger-dev.json | 15 ++++++++++ api/swagger/swagger.json | 15 ++++++++++ .../json/client/user/get_user_responses.go | 3 ++ .../json/client/user/update_user_responses.go | 6 ++++ api/userpb/json/userpb.json | 15 ++++++++++ api/userpb/user.pb.go | 30 +++++++++++++++++-- api/userpb/user.pb.validate.go | 4 +++ api/userpb/user.proto | 4 +++ managed/models/database.go | 4 +++ managed/models/user_flags_helpers.go | 10 +++++-- managed/models/user_flags_model.go | 7 +++-- managed/models/user_flags_model_reform.go | 11 +++++-- managed/services/user/user.go | 5 +++- 13 files changed, 116 insertions(+), 13 deletions(-) diff --git a/api/swagger/swagger-dev.json b/api/swagger/swagger-dev.json index 9a3b980655..f5b33f99ab 100644 --- a/api/swagger/swagger-dev.json +++ b/api/swagger/swagger-dev.json @@ -30218,6 +30218,11 @@ "type": "boolean", "title": "Alerting Tour", "x-order": 2 + }, + "snoozed_pmm_version": { + "type": "string", + "title": "Snoozed PMM version update", + "x-order": 3 } } } @@ -30279,6 +30284,11 @@ "type": "boolean", "title": "Alerting Tour", "x-order": 1 + }, + "snoozed_pmm_version": { + "type": "string", + "title": "Snooze update alert for a PMM version", + "x-order": 2 } } } @@ -30305,6 +30315,11 @@ "type": "boolean", "title": "Alerting Tour", "x-order": 2 + }, + "snoozed_pmm_version": { + "type": "string", + "title": "Snoozed PMM version update", + "x-order": 3 } } } diff --git a/api/swagger/swagger.json b/api/swagger/swagger.json index a786b6f5e0..7cafc1d2f3 100644 --- a/api/swagger/swagger.json +++ b/api/swagger/swagger.json @@ -24685,6 +24685,11 @@ "type": "boolean", "title": "Alerting Tour", "x-order": 2 + }, + "snoozed_pmm_version": { + "type": "string", + "title": "Snoozed PMM version update", + "x-order": 3 } } } @@ -24746,6 +24751,11 @@ "type": "boolean", "title": "Alerting Tour", "x-order": 1 + }, + "snoozed_pmm_version": { + "type": "string", + "title": "Snooze update alert for a PMM version", + "x-order": 2 } } } @@ -24772,6 +24782,11 @@ "type": "boolean", "title": "Alerting Tour", "x-order": 2 + }, + "snoozed_pmm_version": { + "type": "string", + "title": "Snoozed PMM version update", + "x-order": 3 } } } diff --git a/api/userpb/json/client/user/get_user_responses.go b/api/userpb/json/client/user/get_user_responses.go index 8597bee46d..ba42b12ca3 100644 --- a/api/userpb/json/client/user/get_user_responses.go +++ b/api/userpb/json/client/user/get_user_responses.go @@ -272,6 +272,9 @@ type GetUserOKBody struct { // Alerting Tour AlertingTourCompleted bool `json:"alerting_tour_completed,omitempty"` + + // Snoozed PMM version update + SnoozedPMMVersion string `json:"snoozed_pmm_version,omitempty"` } // Validate validates this get user OK body diff --git a/api/userpb/json/client/user/update_user_responses.go b/api/userpb/json/client/user/update_user_responses.go index ffedede7cf..c360f3e637 100644 --- a/api/userpb/json/client/user/update_user_responses.go +++ b/api/userpb/json/client/user/update_user_responses.go @@ -128,6 +128,9 @@ type UpdateUserBody struct { // Alerting Tour AlertingTourCompleted bool `json:"alerting_tour_completed,omitempty"` + + // Snooze update alert for a PMM version + SnoozedPMMVersion string `json:"snoozed_pmm_version,omitempty"` } // Validate validates this update user body @@ -312,6 +315,9 @@ type UpdateUserOKBody struct { // Alerting Tour AlertingTourCompleted bool `json:"alerting_tour_completed,omitempty"` + + // Snoozed PMM version update + SnoozedPMMVersion string `json:"snoozed_pmm_version,omitempty"` } // Validate validates this update user OK body diff --git a/api/userpb/json/userpb.json b/api/userpb/json/userpb.json index dc52a4e609..46a27f223f 100644 --- a/api/userpb/json/userpb.json +++ b/api/userpb/json/userpb.json @@ -39,6 +39,11 @@ "title": "Product Tour", "x-order": 1 }, + "snoozed_pmm_version": { + "type": "string", + "title": "Snoozed PMM version update", + "x-order": 3 + }, "user_id": { "type": "integer", "format": "int64", @@ -105,6 +110,11 @@ "type": "boolean", "title": "Product Tour", "x-order": 0 + }, + "snoozed_pmm_version": { + "type": "string", + "title": "Snooze update alert for a PMM version", + "x-order": 2 } } } @@ -126,6 +136,11 @@ "title": "Product Tour", "x-order": 1 }, + "snoozed_pmm_version": { + "type": "string", + "title": "Snoozed PMM version update", + "x-order": 3 + }, "user_id": { "type": "integer", "format": "int64", diff --git a/api/userpb/user.pb.go b/api/userpb/user.pb.go index 9628723644..ffd13f4480 100644 --- a/api/userpb/user.pb.go +++ b/api/userpb/user.pb.go @@ -74,6 +74,8 @@ type UserDetailsResponse struct { ProductTourCompleted bool `protobuf:"varint,2,opt,name=product_tour_completed,json=productTourCompleted,proto3" json:"product_tour_completed,omitempty"` // Alerting Tour AlertingTourCompleted bool `protobuf:"varint,3,opt,name=alerting_tour_completed,json=alertingTourCompleted,proto3" json:"alerting_tour_completed,omitempty"` + // Snoozed PMM version update + SnoozedPmmVersion string `protobuf:"bytes,4,opt,name=snoozed_pmm_version,json=snoozedPmmVersion,proto3" json:"snoozed_pmm_version,omitempty"` } func (x *UserDetailsResponse) Reset() { @@ -129,6 +131,13 @@ func (x *UserDetailsResponse) GetAlertingTourCompleted() bool { return false } +func (x *UserDetailsResponse) GetSnoozedPmmVersion() string { + if x != nil { + return x.SnoozedPmmVersion + } + return "" +} + type UserUpdateRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -138,6 +147,8 @@ type UserUpdateRequest struct { ProductTourCompleted bool `protobuf:"varint,2,opt,name=product_tour_completed,json=productTourCompleted,proto3" json:"product_tour_completed,omitempty"` // Alerting Tour AlertingTourCompleted bool `protobuf:"varint,3,opt,name=alerting_tour_completed,json=alertingTourCompleted,proto3" json:"alerting_tour_completed,omitempty"` + // Snooze update alert for a PMM version + SnoozedPmmVersion string `protobuf:"bytes,4,opt,name=snoozed_pmm_version,json=snoozedPmmVersion,proto3" json:"snoozed_pmm_version,omitempty"` } func (x *UserUpdateRequest) Reset() { @@ -186,6 +197,13 @@ func (x *UserUpdateRequest) GetAlertingTourCompleted() bool { return false } +func (x *UserUpdateRequest) GetSnoozedPmmVersion() string { + if x != nil { + return x.SnoozedPmmVersion + } + return "" +} + type ListUsersRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -341,7 +359,7 @@ var file_userpb_user_proto_rawDesc = []byte{ 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, 0x14, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, - 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x9c, + 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xcc, 0x01, 0x0a, 0x13, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, @@ -351,7 +369,10 @@ var file_userpb_user_proto_rawDesc = []byte{ 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x17, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x6f, 0x75, 0x72, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, - 0x54, 0x6f, 0x75, 0x72, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x22, 0x81, 0x01, + 0x54, 0x6f, 0x75, 0x72, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x2e, 0x0a, + 0x13, 0x73, 0x6e, 0x6f, 0x6f, 0x7a, 0x65, 0x64, 0x5f, 0x70, 0x6d, 0x6d, 0x5f, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x73, 0x6e, 0x6f, 0x6f, + 0x7a, 0x65, 0x64, 0x50, 0x6d, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xb1, 0x01, 0x0a, 0x11, 0x55, 0x73, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x16, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x74, 0x6f, 0x75, 0x72, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, @@ -360,7 +381,10 @@ var file_userpb_user_proto_rawDesc = []byte{ 0x72, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x6f, 0x75, 0x72, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x54, 0x6f, 0x75, 0x72, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, - 0x64, 0x22, 0x12, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, + 0x64, 0x12, 0x2e, 0x0a, 0x13, 0x73, 0x6e, 0x6f, 0x6f, 0x7a, 0x65, 0x64, 0x5f, 0x70, 0x6d, 0x6d, + 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, + 0x73, 0x6e, 0x6f, 0x6f, 0x7a, 0x65, 0x64, 0x50, 0x6d, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x22, 0x12, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x8f, 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x75, 0x73, 0x65, diff --git a/api/userpb/user.pb.validate.go b/api/userpb/user.pb.validate.go index 7e70fb1cc6..3a91d48a70 100644 --- a/api/userpb/user.pb.validate.go +++ b/api/userpb/user.pb.validate.go @@ -165,6 +165,8 @@ func (m *UserDetailsResponse) validate(all bool) error { // no validation rules for AlertingTourCompleted + // no validation rules for SnoozedPmmVersion + if len(errors) > 0 { return UserDetailsResponseMultiError(errors) } @@ -271,6 +273,8 @@ func (m *UserUpdateRequest) validate(all bool) error { // no validation rules for AlertingTourCompleted + // no validation rules for SnoozedPmmVersion + if len(errors) > 0 { return UserUpdateRequestMultiError(errors) } diff --git a/api/userpb/user.proto b/api/userpb/user.proto index 3513fd0731..0a0d26b364 100644 --- a/api/userpb/user.proto +++ b/api/userpb/user.proto @@ -21,6 +21,8 @@ message UserDetailsResponse { bool product_tour_completed = 2; // Alerting Tour bool alerting_tour_completed = 3; + // Snoozed PMM version update + string snoozed_pmm_version = 4; } message UserUpdateRequest { @@ -28,6 +30,8 @@ message UserUpdateRequest { bool product_tour_completed = 2; // Alerting Tour bool alerting_tour_completed = 3; + // Snooze update alert for a PMM version + string snoozed_pmm_version = 4; } message ListUsersRequest {} diff --git a/managed/models/database.go b/managed/models/database.go index 0228cbcc40..fd05e95518 100644 --- a/managed/models/database.go +++ b/managed/models/database.go @@ -966,6 +966,10 @@ var databaseSchema = [][]string{ 102: { `UPDATE settings SET settings = settings - 'alert_manager_url'`, }, + 103: { + `ALTER TABLE user_flags + ADD COLUMN snoozed_pmm_version VARCHAR NOT NULL DEFAULT ''`, + }, } // ^^^ Avoid default values in schema definition. ^^^ diff --git a/managed/models/user_flags_helpers.go b/managed/models/user_flags_helpers.go index 20f7faea2b..508071d864 100644 --- a/managed/models/user_flags_helpers.go +++ b/managed/models/user_flags_helpers.go @@ -31,9 +31,10 @@ type CreateUserParams struct { // UpdateUserParams has parameters to update existing user. type UpdateUserParams struct { - UserID int - Tour bool - AlertingTour bool + UserID int + Tour bool + AlertingTour bool + SnoozedPMMVersion string } // GetOrCreateUser returns user and optionally creates it, if not in database yet. @@ -103,6 +104,9 @@ func UpdateUser(q *reform.Querier, params *UpdateUserParams) (*UserDetails, erro row.Tour = params.Tour row.AlertingTour = params.AlertingTour + if params.SnoozedPMMVersion != "" { + row.SnoozedPMMVersion = params.SnoozedPMMVersion + } if err = q.Update(row); err != nil { return nil, errors.Wrap(err, "failed to update user") diff --git a/managed/models/user_flags_model.go b/managed/models/user_flags_model.go index 5f7e8cff1e..e1a8109006 100644 --- a/managed/models/user_flags_model.go +++ b/managed/models/user_flags_model.go @@ -27,9 +27,10 @@ import ( // //reform:user_flags type UserDetails struct { - ID int `reform:"id,pk"` - Tour bool `reform:"tour_done"` - AlertingTour bool `reform:"alerting_tour_done"` + ID int `reform:"id,pk"` + Tour bool `reform:"tour_done"` + AlertingTour bool `reform:"alerting_tour_done"` + SnoozedPMMVersion string `reform:"snoozed_pmm_version"` CreatedAt time.Time `reform:"created_at"` UpdatedAt time.Time `reform:"updated_at"` diff --git a/managed/models/user_flags_model_reform.go b/managed/models/user_flags_model_reform.go index 6a0d712dd3..940c242e1d 100644 --- a/managed/models/user_flags_model_reform.go +++ b/managed/models/user_flags_model_reform.go @@ -31,6 +31,7 @@ func (v *userDetailsTableType) Columns() []string { "id", "tour_done", "alerting_tour_done", + "snoozed_pmm_version", "created_at", "updated_at", } @@ -60,6 +61,7 @@ var UserDetailsTable = &userDetailsTableType{ {Name: "ID", Type: "int", Column: "id"}, {Name: "Tour", Type: "bool", Column: "tour_done"}, {Name: "AlertingTour", Type: "bool", Column: "alerting_tour_done"}, + {Name: "SnoozedPMMVersion", Type: "string", Column: "snoozed_pmm_version"}, {Name: "CreatedAt", Type: "time.Time", Column: "created_at"}, {Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"}, }, @@ -70,12 +72,13 @@ var UserDetailsTable = &userDetailsTableType{ // String returns a string representation of this struct or record. func (s UserDetails) String() string { - res := make([]string, 5) + res := make([]string, 6) res[0] = "ID: " + reform.Inspect(s.ID, true) res[1] = "Tour: " + reform.Inspect(s.Tour, true) res[2] = "AlertingTour: " + reform.Inspect(s.AlertingTour, true) - res[3] = "CreatedAt: " + reform.Inspect(s.CreatedAt, true) - res[4] = "UpdatedAt: " + reform.Inspect(s.UpdatedAt, true) + res[3] = "SnoozedPMMVersion: " + reform.Inspect(s.SnoozedPMMVersion, true) + res[4] = "CreatedAt: " + reform.Inspect(s.CreatedAt, true) + res[5] = "UpdatedAt: " + reform.Inspect(s.UpdatedAt, true) return strings.Join(res, ", ") } @@ -86,6 +89,7 @@ func (s *UserDetails) Values() []interface{} { s.ID, s.Tour, s.AlertingTour, + s.SnoozedPMMVersion, s.CreatedAt, s.UpdatedAt, } @@ -98,6 +102,7 @@ func (s *UserDetails) Pointers() []interface{} { &s.ID, &s.Tour, &s.AlertingTour, + &s.SnoozedPMMVersion, &s.CreatedAt, &s.UpdatedAt, } diff --git a/managed/services/user/user.go b/managed/services/user/user.go index c0dd0d5365..20c5d6f197 100644 --- a/managed/services/user/user.go +++ b/managed/services/user/user.go @@ -75,7 +75,7 @@ func (s *Service) GetUser(ctx context.Context, _ *userpb.UserDetailsRequest) (*u return resp, nil } -// UpdateUser updates data for given user. +// UpdateUser updates data and flags for the given user. func (s *Service) UpdateUser(ctx context.Context, req *userpb.UserUpdateRequest) (*userpb.UserDetailsResponse, error) { userID, err := s.c.GetUserID(ctx) if err != nil { @@ -106,6 +106,9 @@ func (s *Service) UpdateUser(ctx context.Context, req *userpb.UserUpdateRequest) if req.AlertingTourCompleted { params.AlertingTour = req.AlertingTourCompleted } + if req.SnoozedPmmVersion != "" { + params.SnoozedPMMVersion = req.SnoozedPmmVersion + } userInfo, err = models.UpdateUser(tx.Querier, params) if err != nil { From 1ba9e97c51b264103f4aadb963d9248e784fc241 Mon Sep 17 00:00:00 2001 From: idoko Date: Fri, 14 Jun 2024 10:09:32 +0100 Subject: [PATCH 2/4] replace type with pointer --- api/userpb/user.pb.go | 140 +++++++++++++++++---------------- api/userpb/user.pb.validate.go | 29 ++++++- api/userpb/user.proto | 2 +- managed/services/user/user.go | 6 +- 4 files changed, 105 insertions(+), 72 deletions(-) diff --git a/api/userpb/user.pb.go b/api/userpb/user.pb.go index ffd13f4480..47558a6cc2 100644 --- a/api/userpb/user.pb.go +++ b/api/userpb/user.pb.go @@ -15,7 +15,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" _ "google.golang.org/protobuf/types/known/timestamppb" - _ "google.golang.org/protobuf/types/known/wrapperspb" + wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" ) const ( @@ -148,7 +148,7 @@ type UserUpdateRequest struct { // Alerting Tour AlertingTourCompleted bool `protobuf:"varint,3,opt,name=alerting_tour_completed,json=alertingTourCompleted,proto3" json:"alerting_tour_completed,omitempty"` // Snooze update alert for a PMM version - SnoozedPmmVersion string `protobuf:"bytes,4,opt,name=snoozed_pmm_version,json=snoozedPmmVersion,proto3" json:"snoozed_pmm_version,omitempty"` + SnoozedPmmVersion *wrapperspb.StringValue `protobuf:"bytes,4,opt,name=snoozed_pmm_version,json=snoozedPmmVersion,proto3" json:"snoozed_pmm_version,omitempty"` } func (x *UserUpdateRequest) Reset() { @@ -197,11 +197,11 @@ func (x *UserUpdateRequest) GetAlertingTourCompleted() bool { return false } -func (x *UserUpdateRequest) GetSnoozedPmmVersion() string { +func (x *UserUpdateRequest) GetSnoozedPmmVersion() *wrapperspb.StringValue { if x != nil { return x.SnoozedPmmVersion } - return "" + return nil } type ListUsersRequest struct { @@ -372,7 +372,7 @@ var file_userpb_user_proto_rawDesc = []byte{ 0x54, 0x6f, 0x75, 0x72, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x13, 0x73, 0x6e, 0x6f, 0x6f, 0x7a, 0x65, 0x64, 0x5f, 0x70, 0x6d, 0x6d, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x73, 0x6e, 0x6f, 0x6f, - 0x7a, 0x65, 0x64, 0x50, 0x6d, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xb1, 0x01, + 0x7a, 0x65, 0x64, 0x50, 0x6d, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xcf, 0x01, 0x0a, 0x11, 0x55, 0x73, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x16, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x74, 0x6f, 0x75, 0x72, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, @@ -381,57 +381,59 @@ var file_userpb_user_proto_rawDesc = []byte{ 0x72, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x6f, 0x75, 0x72, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x54, 0x6f, 0x75, 0x72, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, - 0x64, 0x12, 0x2e, 0x0a, 0x13, 0x73, 0x6e, 0x6f, 0x6f, 0x7a, 0x65, 0x64, 0x5f, 0x70, 0x6d, 0x6d, - 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, - 0x73, 0x6e, 0x6f, 0x6f, 0x7a, 0x65, 0x64, 0x50, 0x6d, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x22, 0x12, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x8f, 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, - 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x05, 0x75, - 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x75, 0x73, 0x65, - 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x05, - 0x75, 0x73, 0x65, 0x72, 0x73, 0x1a, 0x40, 0x0a, 0x0a, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x74, - 0x61, 0x69, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, - 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x07, - 0x72, 0x6f, 0x6c, 0x65, 0x49, 0x64, 0x73, 0x32, 0xd4, 0x03, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, - 0x12, 0x8c, 0x01, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x75, - 0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, - 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x4c, 0x92, 0x41, 0x39, 0x12, 0x10, 0x47, 0x65, 0x74, 0x20, 0x75, 0x73, 0x65, 0x72, - 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x1a, 0x25, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, - 0x76, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x20, - 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x12, - 0x91, 0x01, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x17, - 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, - 0x73, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x4f, 0x92, 0x41, 0x39, 0x12, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, - 0x75, 0x73, 0x65, 0x72, 0x1a, 0x2a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x64, 0x65, 0x74, - 0x61, 0x69, 0x6c, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, 0x75, 0x73, - 0x65, 0x72, 0x20, 0x69, 0x6e, 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x3a, 0x01, 0x2a, 0x1a, 0x08, 0x2f, 0x76, 0x31, 0x2f, 0x75, - 0x73, 0x65, 0x72, 0x12, 0xa8, 0x01, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, - 0x73, 0x12, 0x16, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, - 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x75, 0x73, 0x65, 0x72, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x6a, 0x92, 0x41, 0x52, 0x12, 0x1b, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x61, 0x6c, - 0x6c, 0x20, 0x75, 0x73, 0x65, 0x72, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x64, 0x65, 0x74, - 0x61, 0x69, 0x6c, 0x73, 0x1a, 0x33, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, 0x20, 0x75, - 0x73, 0x65, 0x72, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, - 0x61, 0x6c, 0x6c, 0x20, 0x75, 0x73, 0x65, 0x72, 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x50, - 0x4d, 0x4d, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x22, - 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x42, 0x77, - 0x92, 0x41, 0x0c, 0x12, 0x0a, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x20, 0x41, 0x50, 0x49, 0x0a, - 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x42, 0x09, 0x55, 0x73, 0x65, 0x72, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x70, 0x65, 0x72, 0x63, 0x6f, 0x6e, 0x61, 0x2f, 0x70, 0x6d, 0x6d, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x70, 0x62, 0xa2, 0x02, 0x03, 0x55, 0x58, 0x58, 0xaa, - 0x02, 0x04, 0x55, 0x73, 0x65, 0x72, 0xca, 0x02, 0x04, 0x55, 0x73, 0x65, 0x72, 0xe2, 0x02, 0x10, - 0x55, 0x73, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x04, 0x55, 0x73, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x12, 0x4c, 0x0a, 0x13, 0x73, 0x6e, 0x6f, 0x6f, 0x7a, 0x65, 0x64, 0x5f, 0x70, 0x6d, 0x6d, + 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x11, 0x73, 0x6e, + 0x6f, 0x6f, 0x7a, 0x65, 0x64, 0x50, 0x6d, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, + 0x12, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0x8f, 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x05, 0x75, 0x73, 0x65, + 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x05, 0x75, 0x73, + 0x65, 0x72, 0x73, 0x1a, 0x40, 0x0a, 0x0a, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x6f, + 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x07, 0x72, 0x6f, + 0x6c, 0x65, 0x49, 0x64, 0x73, 0x32, 0xd4, 0x03, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x8c, + 0x01, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x75, 0x73, 0x65, + 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, + 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x4c, 0x92, 0x41, 0x39, 0x12, 0x10, 0x47, 0x65, 0x74, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x64, + 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x1a, 0x25, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, + 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x20, 0x66, 0x72, + 0x6f, 0x6d, 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x0a, 0x12, 0x08, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x12, 0x91, 0x01, + 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x75, + 0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, + 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x4f, 0x92, 0x41, 0x39, 0x12, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x75, 0x73, + 0x65, 0x72, 0x1a, 0x2a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, 0x75, 0x73, 0x65, 0x72, + 0x20, 0x69, 0x6e, 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x0d, 0x3a, 0x01, 0x2a, 0x1a, 0x08, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, + 0x72, 0x12, 0xa8, 0x01, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, + 0x16, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x6a, 0x92, 0x41, 0x52, 0x12, 0x1b, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x20, + 0x75, 0x73, 0x65, 0x72, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x73, 0x1a, 0x33, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, 0x20, 0x75, 0x73, 0x65, + 0x72, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, + 0x6c, 0x20, 0x75, 0x73, 0x65, 0x72, 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x50, 0x4d, 0x4d, + 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x22, 0x0d, 0x2f, + 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x42, 0x77, 0x92, 0x41, + 0x0c, 0x12, 0x0a, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x20, 0x41, 0x50, 0x49, 0x0a, 0x08, 0x63, + 0x6f, 0x6d, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x42, 0x09, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x70, 0x65, 0x72, 0x63, 0x6f, 0x6e, 0x61, 0x2f, 0x70, 0x6d, 0x6d, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x75, 0x73, 0x65, 0x72, 0x70, 0x62, 0xa2, 0x02, 0x03, 0x55, 0x58, 0x58, 0xaa, 0x02, 0x04, + 0x55, 0x73, 0x65, 0x72, 0xca, 0x02, 0x04, 0x55, 0x73, 0x65, 0x72, 0xe2, 0x02, 0x10, 0x55, 0x73, + 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x04, 0x55, 0x73, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -455,22 +457,24 @@ var ( (*ListUsersRequest)(nil), // 3: user.ListUsersRequest (*ListUsersResponse)(nil), // 4: user.ListUsersResponse (*ListUsersResponse_UserDetail)(nil), // 5: user.ListUsersResponse.UserDetail + (*wrapperspb.StringValue)(nil), // 6: google.protobuf.StringValue } ) var file_userpb_user_proto_depIdxs = []int32{ - 5, // 0: user.ListUsersResponse.users:type_name -> user.ListUsersResponse.UserDetail - 0, // 1: user.User.GetUser:input_type -> user.UserDetailsRequest - 2, // 2: user.User.UpdateUser:input_type -> user.UserUpdateRequest - 3, // 3: user.User.ListUsers:input_type -> user.ListUsersRequest - 1, // 4: user.User.GetUser:output_type -> user.UserDetailsResponse - 1, // 5: user.User.UpdateUser:output_type -> user.UserDetailsResponse - 4, // 6: user.User.ListUsers:output_type -> user.ListUsersResponse - 4, // [4:7] is the sub-list for method output_type - 1, // [1:4] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 6, // 0: user.UserUpdateRequest.snoozed_pmm_version:type_name -> google.protobuf.StringValue + 5, // 1: user.ListUsersResponse.users:type_name -> user.ListUsersResponse.UserDetail + 0, // 2: user.User.GetUser:input_type -> user.UserDetailsRequest + 2, // 3: user.User.UpdateUser:input_type -> user.UserUpdateRequest + 3, // 4: user.User.ListUsers:input_type -> user.ListUsersRequest + 1, // 5: user.User.GetUser:output_type -> user.UserDetailsResponse + 1, // 6: user.User.UpdateUser:output_type -> user.UserDetailsResponse + 4, // 7: user.User.ListUsers:output_type -> user.ListUsersResponse + 5, // [5:8] is the sub-list for method output_type + 2, // [2:5] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_userpb_user_proto_init() } diff --git a/api/userpb/user.pb.validate.go b/api/userpb/user.pb.validate.go index 3a91d48a70..527a526270 100644 --- a/api/userpb/user.pb.validate.go +++ b/api/userpb/user.pb.validate.go @@ -273,7 +273,34 @@ func (m *UserUpdateRequest) validate(all bool) error { // no validation rules for AlertingTourCompleted - // no validation rules for SnoozedPmmVersion + if all { + switch v := interface{}(m.GetSnoozedPmmVersion()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, UserUpdateRequestValidationError{ + field: "SnoozedPmmVersion", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, UserUpdateRequestValidationError{ + field: "SnoozedPmmVersion", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetSnoozedPmmVersion()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return UserUpdateRequestValidationError{ + field: "SnoozedPmmVersion", + reason: "embedded message failed validation", + cause: err, + } + } + } if len(errors) > 0 { return UserUpdateRequestMultiError(errors) diff --git a/api/userpb/user.proto b/api/userpb/user.proto index 0a0d26b364..e8d6b33b32 100644 --- a/api/userpb/user.proto +++ b/api/userpb/user.proto @@ -31,7 +31,7 @@ message UserUpdateRequest { // Alerting Tour bool alerting_tour_completed = 3; // Snooze update alert for a PMM version - string snoozed_pmm_version = 4; + google.protobuf.StringValue snoozed_pmm_version = 4; } message ListUsersRequest {} diff --git a/managed/services/user/user.go b/managed/services/user/user.go index 20c5d6f197..23cdbac9f0 100644 --- a/managed/services/user/user.go +++ b/managed/services/user/user.go @@ -71,6 +71,7 @@ func (s *Service) GetUser(ctx context.Context, _ *userpb.UserDetailsRequest) (*u UserId: uint32(userInfo.ID), ProductTourCompleted: userInfo.Tour, AlertingTourCompleted: userInfo.AlertingTour, + SnoozedPmmVersion: userInfo.SnoozedPMMVersion, } return resp, nil } @@ -106,8 +107,8 @@ func (s *Service) UpdateUser(ctx context.Context, req *userpb.UserUpdateRequest) if req.AlertingTourCompleted { params.AlertingTour = req.AlertingTourCompleted } - if req.SnoozedPmmVersion != "" { - params.SnoozedPMMVersion = req.SnoozedPmmVersion + if req.SnoozedPmmVersion != nil { + params.SnoozedPMMVersion = req.SnoozedPmmVersion.Value } userInfo, err = models.UpdateUser(tx.Querier, params) @@ -125,6 +126,7 @@ func (s *Service) UpdateUser(ctx context.Context, req *userpb.UserUpdateRequest) UserId: uint32(userInfo.ID), ProductTourCompleted: userInfo.Tour, AlertingTourCompleted: userInfo.AlertingTour, + SnoozedPmmVersion: userInfo.SnoozedPMMVersion, } return resp, nil } From 12467300bf42b0b65a21c93d1b34d89221c09605 Mon Sep 17 00:00:00 2001 From: idoko Date: Wed, 24 Jul 2024 09:39:10 +0100 Subject: [PATCH 3/4] use pointer for snoozed versions --- api/swagger/swagger-dev.json | 6 + api/swagger/swagger.json | 6 + .../user_service/update_user_responses.go | 3 + api/user/v1/json/v1.json | 6 + api/user/v1/user.pb.go | 150 ++++++++++-------- api/user/v1/user.pb.validate.go | 4 + api/user/v1/user.proto | 2 + docker-compose.yml | 2 +- managed/models/user_flags_helpers.go | 6 +- managed/services/user/user.go | 2 +- 10 files changed, 114 insertions(+), 73 deletions(-) diff --git a/api/swagger/swagger-dev.json b/api/swagger/swagger-dev.json index fe427acb68..fcf768784f 100644 --- a/api/swagger/swagger-dev.json +++ b/api/swagger/swagger-dev.json @@ -27919,6 +27919,12 @@ "title": "Alerting Tour", "x-nullable": true, "x-order": 1 + }, + "snoozed_pmm_version": { + "type": "string", + "title": "Snooze update alert for a PMM version", + "x-nullable": true, + "x-order": 2 } } } diff --git a/api/swagger/swagger.json b/api/swagger/swagger.json index 701fd74a21..244be80d21 100644 --- a/api/swagger/swagger.json +++ b/api/swagger/swagger.json @@ -26961,6 +26961,12 @@ "title": "Alerting Tour", "x-nullable": true, "x-order": 1 + }, + "snoozed_pmm_version": { + "type": "string", + "title": "Snooze update alert for a PMM version", + "x-nullable": true, + "x-order": 2 } } } diff --git a/api/user/v1/json/client/user_service/update_user_responses.go b/api/user/v1/json/client/user_service/update_user_responses.go index 94c4daf2d2..4a8b209032 100644 --- a/api/user/v1/json/client/user_service/update_user_responses.go +++ b/api/user/v1/json/client/user_service/update_user_responses.go @@ -128,6 +128,9 @@ type UpdateUserBody struct { // Alerting Tour AlertingTourCompleted *bool `json:"alerting_tour_completed,omitempty"` + + // Snooze update alert for a PMM version + SnoozedPMMVersion *string `json:"snoozed_pmm_version,omitempty"` } // Validate validates this update user body diff --git a/api/user/v1/json/v1.json b/api/user/v1/json/v1.json index 0fb6be01d7..b87d4f3a51 100644 --- a/api/user/v1/json/v1.json +++ b/api/user/v1/json/v1.json @@ -186,6 +186,12 @@ "title": "Product Tour", "x-nullable": true, "x-order": 0 + }, + "snoozed_pmm_version": { + "type": "string", + "title": "Snooze update alert for a PMM version", + "x-nullable": true, + "x-order": 2 } } } diff --git a/api/user/v1/user.pb.go b/api/user/v1/user.pb.go index 1d09a46ab2..dbfb229876 100644 --- a/api/user/v1/user.pb.go +++ b/api/user/v1/user.pb.go @@ -145,6 +145,8 @@ type UpdateUserRequest struct { ProductTourCompleted *bool `protobuf:"varint,2,opt,name=product_tour_completed,json=productTourCompleted,proto3,oneof" json:"product_tour_completed,omitempty"` // Alerting Tour AlertingTourCompleted *bool `protobuf:"varint,3,opt,name=alerting_tour_completed,json=alertingTourCompleted,proto3,oneof" json:"alerting_tour_completed,omitempty"` + // Snooze update alert for a PMM version + SnoozedPmmVersion *string `protobuf:"bytes,4,opt,name=snoozed_pmm_version,json=snoozedPmmVersion,proto3,oneof" json:"snoozed_pmm_version,omitempty"` } func (x *UpdateUserRequest) Reset() { @@ -193,6 +195,13 @@ func (x *UpdateUserRequest) GetAlertingTourCompleted() bool { return false } +func (x *UpdateUserRequest) GetSnoozedPmmVersion() string { + if x != nil && x.SnoozedPmmVersion != nil { + return *x.SnoozedPmmVersion + } + return "" +} + type UpdateUserResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -432,7 +441,7 @@ var file_user_v1_user_proto_rawDesc = []byte{ 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x13, 0x73, 0x6e, 0x6f, 0x6f, 0x7a, 0x65, 0x64, 0x5f, 0x70, 0x6d, 0x6d, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x73, 0x6e, 0x6f, 0x6f, 0x7a, 0x65, 0x64, 0x50, 0x6d, - 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xc2, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, + 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x8f, 0x02, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x39, 0x0a, 0x16, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x74, 0x6f, 0x75, 0x72, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, @@ -441,73 +450,78 @@ var file_user_v1_user_proto_rawDesc = []byte{ 0x72, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x6f, 0x75, 0x72, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x48, 0x01, 0x52, 0x15, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x54, 0x6f, 0x75, 0x72, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, - 0x74, 0x65, 0x64, 0x88, 0x01, 0x01, 0x42, 0x19, 0x0a, 0x17, 0x5f, 0x70, 0x72, 0x6f, 0x64, 0x75, - 0x63, 0x74, 0x5f, 0x74, 0x6f, 0x75, 0x72, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, - 0x64, 0x42, 0x1a, 0x0a, 0x18, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x74, - 0x6f, 0x75, 0x72, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x22, 0xcb, 0x01, - 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x34, 0x0a, - 0x16, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x74, 0x6f, 0x75, 0x72, 0x5f, 0x63, 0x6f, - 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x70, - 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x54, 0x6f, 0x75, 0x72, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, - 0x74, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x17, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x5f, - 0x74, 0x6f, 0x75, 0x72, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x54, 0x6f, - 0x75, 0x72, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x13, 0x73, - 0x6e, 0x6f, 0x6f, 0x7a, 0x65, 0x64, 0x5f, 0x70, 0x6d, 0x6d, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x73, 0x6e, 0x6f, 0x6f, 0x7a, 0x65, - 0x64, 0x50, 0x6d, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x12, 0x0a, 0x10, 0x4c, - 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, - 0x92, 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x05, 0x75, 0x73, 0x65, - 0x72, 0x73, 0x1a, 0x40, 0x0a, 0x0a, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, - 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x6f, 0x6c, - 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x07, 0x72, 0x6f, 0x6c, - 0x65, 0x49, 0x64, 0x73, 0x32, 0xd4, 0x03, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x12, 0x8e, 0x01, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, - 0x12, 0x17, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, - 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x75, 0x73, 0x65, 0x72, - 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x50, 0x92, 0x41, 0x39, 0x12, 0x10, 0x47, 0x65, 0x74, 0x20, 0x75, 0x73, - 0x65, 0x72, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x1a, 0x25, 0x52, 0x65, 0x74, 0x72, - 0x69, 0x65, 0x76, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, - 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, - 0x72, 0x73, 0x2f, 0x6d, 0x65, 0x12, 0x93, 0x01, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x55, 0x73, 0x65, 0x72, 0x12, 0x1a, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1b, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4c, 0x92, - 0x41, 0x32, 0x12, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x75, 0x73, 0x65, - 0x72, 0x1a, 0x21, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x64, - 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x3a, 0x01, 0x2a, 0x1a, 0x0c, 0x2f, - 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x6d, 0x65, 0x12, 0x9d, 0x01, 0x0a, 0x09, - 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x19, 0x2e, 0x75, 0x73, 0x65, 0x72, - 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x59, 0x92, 0x41, 0x45, 0x12, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x20, - 0x75, 0x73, 0x65, 0x72, 0x73, 0x1a, 0x33, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, 0x20, - 0x75, 0x73, 0x65, 0x72, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x20, 0x66, 0x6f, 0x72, - 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x75, 0x73, 0x65, 0x72, 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, - 0x50, 0x4d, 0x4d, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, - 0x12, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x42, 0x8f, 0x01, 0x92, 0x41, - 0x0c, 0x12, 0x0a, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x20, 0x41, 0x50, 0x49, 0x0a, 0x0b, 0x63, - 0x6f, 0x6d, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x42, 0x09, 0x55, 0x73, 0x65, 0x72, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x65, 0x72, 0x63, 0x6f, 0x6e, 0x61, 0x2f, 0x70, 0x6d, 0x6d, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x75, 0x73, 0x65, 0x72, - 0x76, 0x31, 0xa2, 0x02, 0x03, 0x55, 0x58, 0x58, 0xaa, 0x02, 0x07, 0x55, 0x73, 0x65, 0x72, 0x2e, - 0x56, 0x31, 0xca, 0x02, 0x07, 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x13, 0x55, - 0x73, 0x65, 0x72, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x08, 0x55, 0x73, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x33, 0x0a, 0x13, 0x73, 0x6e, 0x6f, 0x6f, 0x7a, 0x65, + 0x64, 0x5f, 0x70, 0x6d, 0x6d, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x11, 0x73, 0x6e, 0x6f, 0x6f, 0x7a, 0x65, 0x64, 0x50, 0x6d, + 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x42, 0x19, 0x0a, 0x17, 0x5f, + 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x74, 0x6f, 0x75, 0x72, 0x5f, 0x63, 0x6f, 0x6d, + 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x42, 0x1a, 0x0a, 0x18, 0x5f, 0x61, 0x6c, 0x65, 0x72, 0x74, + 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x6f, 0x75, 0x72, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, + 0x65, 0x64, 0x42, 0x16, 0x0a, 0x14, 0x5f, 0x73, 0x6e, 0x6f, 0x6f, 0x7a, 0x65, 0x64, 0x5f, 0x70, + 0x6d, 0x6d, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xcb, 0x01, 0x0a, 0x12, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x16, 0x70, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x74, 0x6f, 0x75, 0x72, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, + 0x65, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x70, 0x72, 0x6f, 0x64, + 0x75, 0x63, 0x74, 0x54, 0x6f, 0x75, 0x72, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, + 0x12, 0x36, 0x0a, 0x17, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x6f, 0x75, + 0x72, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x15, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x54, 0x6f, 0x75, 0x72, 0x43, + 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x13, 0x73, 0x6e, 0x6f, 0x6f, + 0x7a, 0x65, 0x64, 0x5f, 0x70, 0x6d, 0x6d, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x73, 0x6e, 0x6f, 0x6f, 0x7a, 0x65, 0x64, 0x50, 0x6d, + 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x12, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, + 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x92, 0x01, 0x0a, + 0x11, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x25, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x55, 0x73, + 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x1a, + 0x40, 0x0a, 0x0a, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x17, 0x0a, + 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, + 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, + 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x07, 0x72, 0x6f, 0x6c, 0x65, 0x49, 0x64, + 0x73, 0x32, 0xd4, 0x03, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x8e, 0x01, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x17, 0x2e, + 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x50, 0x92, 0x41, 0x39, 0x12, 0x10, 0x47, 0x65, 0x74, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, + 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x1a, 0x25, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, + 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x20, 0x66, + 0x72, 0x6f, 0x6d, 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, + 0x6d, 0x65, 0x12, 0x93, 0x01, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x12, 0x1a, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, + 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4c, 0x92, 0x41, 0x32, 0x12, + 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x75, 0x73, 0x65, 0x72, 0x1a, 0x21, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x64, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x50, 0x4d, 0x4d, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x3a, 0x01, 0x2a, 0x1a, 0x0c, 0x2f, 0x76, 0x31, 0x2f, + 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x6d, 0x65, 0x12, 0x9d, 0x01, 0x0a, 0x09, 0x4c, 0x69, 0x73, + 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x19, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1a, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x59, 0x92, + 0x41, 0x45, 0x12, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x75, 0x73, 0x65, + 0x72, 0x73, 0x1a, 0x33, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, 0x20, 0x75, 0x73, 0x65, + 0x72, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, + 0x6c, 0x20, 0x75, 0x73, 0x65, 0x72, 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x50, 0x4d, 0x4d, + 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x12, 0x09, 0x2f, + 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x42, 0x8f, 0x01, 0x92, 0x41, 0x0c, 0x12, 0x0a, + 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x20, 0x41, 0x50, 0x49, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x2e, + 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x42, 0x09, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x70, 0x65, 0x72, 0x63, 0x6f, 0x6e, 0x61, 0x2f, 0x70, 0x6d, 0x6d, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x75, 0x73, 0x65, 0x72, 0x76, 0x31, 0xa2, + 0x02, 0x03, 0x55, 0x58, 0x58, 0xaa, 0x02, 0x07, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x56, 0x31, 0xca, + 0x02, 0x07, 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x13, 0x55, 0x73, 0x65, 0x72, + 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x08, 0x55, 0x73, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/api/user/v1/user.pb.validate.go b/api/user/v1/user.pb.validate.go index 97f501890b..a35b0f3413 100644 --- a/api/user/v1/user.pb.validate.go +++ b/api/user/v1/user.pb.validate.go @@ -273,6 +273,10 @@ func (m *UpdateUserRequest) validate(all bool) error { // no validation rules for AlertingTourCompleted } + if m.SnoozedPmmVersion != nil { + // no validation rules for SnoozedPmmVersion + } + if len(errors) > 0 { return UpdateUserRequestMultiError(errors) } diff --git a/api/user/v1/user.proto b/api/user/v1/user.proto index e9ba5b1e63..0cbfc1509e 100644 --- a/api/user/v1/user.proto +++ b/api/user/v1/user.proto @@ -27,6 +27,8 @@ message UpdateUserRequest { optional bool product_tour_completed = 2; // Alerting Tour optional bool alerting_tour_completed = 3; + // Snooze update alert for a PMM version + optional string snoozed_pmm_version = 4; } message UpdateUserResponse { diff --git a/docker-compose.yml b/docker-compose.yml index be66d5f014..b52205b730 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -76,7 +76,7 @@ services: # VM - ${PMM_PORT_VM:-9090}:9090 # CH - - ${PMM_PORT_CH_TCP:-11000}:9000 + - ${PMM_PORT_CH_TCP:-11001}:9000 - ${PMM_PORT_CH_HTTP:-11123}:8123 volumes: - ./:/root/go/src/github.com/percona/pmm diff --git a/managed/models/user_flags_helpers.go b/managed/models/user_flags_helpers.go index 9dcf44b70c..38cfe3725a 100644 --- a/managed/models/user_flags_helpers.go +++ b/managed/models/user_flags_helpers.go @@ -34,7 +34,7 @@ type UpdateUserParams struct { UserID int Tour *bool AlertingTour *bool - SnoozedPMMVersion string + SnoozedPMMVersion *string } // GetOrCreateUser returns user and optionally creates it, if not in database yet. @@ -107,8 +107,8 @@ func UpdateUser(q *reform.Querier, params *UpdateUserParams) (*UserDetails, erro if params.AlertingTour != nil { row.AlertingTour = *params.AlertingTour } - if params.SnoozedPMMVersion != "" { - row.SnoozedPMMVersion = params.SnoozedPMMVersion + if params.SnoozedPMMVersion != nil { + row.SnoozedPMMVersion = *params.SnoozedPMMVersion } if err = q.Update(row); err != nil { diff --git a/managed/services/user/user.go b/managed/services/user/user.go index db9c78e730..eb0443b90a 100644 --- a/managed/services/user/user.go +++ b/managed/services/user/user.go @@ -100,7 +100,7 @@ func (s *Service) UpdateUser(ctx context.Context, req *userv1.UpdateUserRequest) AlertingTour: req.AlertingTourCompleted, } if req.SnoozedPmmVersion != nil { - params.SnoozedPMMVersion = req.SnoozedPmmVersion.Value + params.SnoozedPMMVersion = req.SnoozedPmmVersion } userInfo, err = models.UpdateUser(tx.Querier, params) From 422665e8c5cecca15bb145a7e744632f8370db7a Mon Sep 17 00:00:00 2001 From: idoko Date: Wed, 24 Jul 2024 09:40:33 +0100 Subject: [PATCH 4/4] revert clickhouse port --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index b52205b730..be66d5f014 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -76,7 +76,7 @@ services: # VM - ${PMM_PORT_VM:-9090}:9090 # CH - - ${PMM_PORT_CH_TCP:-11001}:9000 + - ${PMM_PORT_CH_TCP:-11000}:9000 - ${PMM_PORT_CH_HTTP:-11123}:8123 volumes: - ./:/root/go/src/github.com/percona/pmm