From 78e9f4c8094a19a59e1a4bc159725955db6dae7e Mon Sep 17 00:00:00 2001 From: Max Baumann Date: Fri, 27 Dec 2024 14:33:04 +0100 Subject: [PATCH 1/8] stylecheck --- .golangci.yaml | 1 - libs/common/auth/auth.go | 33 ++++++------ libs/common/auth/auth_test.go | 10 ++-- libs/common/dapr.go | 4 +- .../common/hwgrpc/organization_interceptor.go | 8 +-- libs/common/test/grpc.go | 8 +-- libs/{decaying_lru => decaying-lru}/README.md | 2 +- libs/{decaying_lru => decaying-lru}/add.lua | 0 .../cmd/example/main.go | 4 +- libs/{decaying_lru => decaying-lru}/go.mod | 2 +- libs/{decaying_lru => decaying-lru}/go.sum | 0 libs/{decaying_lru => decaying-lru}/lru.go | 2 +- libs/{decaying_lru => decaying-lru}/setup.go | 2 +- .../{commonPerm => commonperm}/generic.go | 6 +-- .../{commonPerm => commonperm}/userOrg.go | 2 +- libs/hwauthz/spicedb/migrate/migrate.go | 6 +-- libs/hwauthz/spicedb/spicedb.go | 8 +-- libs/hwauthz/spicedb/spicedb_test.go | 30 +++++------ libs/hwauthz/test/true_authz.go | 6 +-- libs/hwdb/go.mod | 2 +- .../{pgx_zerolog => pgx-zerolog}/adapter.go | 2 +- .../{pgx_zerolog => pgx-zerolog}/tracer.go | 2 +- libs/hwdb/setup.go | 4 +- libs/hwes/event.go | 28 +++++----- .../eventstoredb/projections/custom/custom.go | 2 +- libs/hwes/integration_test.go | 4 +- libs/hwtesting/postgres.go | 6 +-- libs/hwutil/parse.go | 4 +- libs/telemetry/otel.go | 8 +-- renovate.json | 2 +- .../property-set/aggregate/aggregate.go | 2 +- .../commands/v1/create_property_set.go | 6 +-- .../set_spicedb_projection.go | 6 +-- .../queries/v1/get_property_set_by_id.go | 4 +- .../property-value/aggregate/aggregate.go | 4 +- .../internal/property-value/api/grpc.go | 4 +- .../commands/v1/attach_property_value.go | 4 +- .../property-value/models/propertyValue.go | 2 +- .../property_value_postgres_projection.go | 4 +- .../v1/get_property_values_by_subject_id.go | 6 +-- .../property-view/aggregate/aggregate.go | 4 +- .../models/patient_property_matcher.go | 6 +-- .../models/task_property_matchers.go | 6 +-- .../property_rules_postgres.go | 4 +- .../internal/property/aggregate/aggregate.go | 18 +++---- .../property/commands/v1/create_property.go | 6 +-- .../property/commands/v1/update_property.go | 4 +- .../postgres_projection.go | 18 +++---- .../property_spicedb_projection.go | 6 +-- .../v1/get_properties_by_subject_type.go | 4 +- .../property/queries/v1/get_property_by_id.go | 4 +- .../is_property_always_included_for_view.go | 4 +- .../property-svc/stories/GetProperty_test.go | 8 +-- .../stories/PropertyValueCRUD_test.go | 12 ++--- services/tasks-svc/go.mod | 4 +- services/tasks-svc/internal/bed/bed.go | 16 +++--- .../internal/patient/aggregate/aggregate.go | 8 +-- .../tasks-svc/internal/patient/api/grpc.go | 8 +-- .../internal/patient/api/grpc_test.go | 4 +- .../patient/commands/v1/assign_bed.go | 4 +- .../patient/commands/v1/create_patient.go | 6 +-- .../patient/commands/v1/delete_patient.go | 4 +- .../patient/commands/v1/discharge_patient.go | 4 +- .../patient/commands/v1/readmit_patient.go | 4 +- .../patient/commands/v1/unassign_bed.go | 4 +- .../patient/commands/v1/update_patient.go | 4 +- .../patient_postgres_projection.go | 8 +-- .../patient_spicedb_projection.go | 4 +- .../v1/get_all_patients_with_details.go | 4 +- .../v1/get_patient_assignment_by_ward.go | 4 +- .../patient/queries/v1/get_patient_by_bed.go | 4 +- .../v1/get_patient_with_details_by_id.go | 4 +- .../queries/v1/get_patients_by_ward.go | 4 +- services/tasks-svc/internal/room/room.go | 14 ++--- .../internal/task-template/task_template.go | 18 +++---- .../internal/task/aggregate/aggregate.go | 26 +++++----- .../internal/task/commands/v1/assign_task.go | 4 +- .../task/commands/v1/create_subtask.go | 4 +- .../internal/task/commands/v1/create_task.go | 4 +- .../task/commands/v1/delete_subtask.go | 4 +- .../internal/task/commands/v1/delete_task.go | 4 +- .../task/commands/v1/remove_task_due_at.go | 4 +- .../task/commands/v1/unassign_task.go | 4 +- .../task/commands/v1/update_subtask.go | 4 +- .../internal/task/commands/v1/update_task.go | 4 +- .../task_postgres_projection.go | 26 +++++----- .../task/projections/task_spicedb/spicedb.go | 2 +- .../queries/v1/get_task_with_patient_by_id.go | 4 +- .../task/queries/v1/get_tasks_by_patient.go | 4 +- .../v1/get_tasks_with_patients_by_asignee.go | 4 +- .../tasks-svc/internal/tracking/tracking.go | 10 ++-- services/tasks-svc/internal/ward/ward.go | 20 +++---- .../tasks-svc/stories/PatientCRUD_test.go | 6 +-- services/tasks-svc/stories/TaskCRUD_test.go | 6 +-- services/tasks-svc/stories/WardCRUD_test.go | 6 +-- services/updates-svc/go.mod | 2 +- services/updates-svc/stories/updates_test.go | 16 +++--- services/user-svc/internal/hwkc/client.go | 2 +- .../internal/organization/organization.go | 52 +++++++++---------- services/user-svc/internal/user/user.go | 6 +-- 100 files changed, 352 insertions(+), 354 deletions(-) rename libs/{decaying_lru => decaying-lru}/README.md (98%) rename libs/{decaying_lru => decaying-lru}/add.lua (100%) rename libs/{decaying_lru => decaying-lru}/cmd/example/main.go (89%) rename libs/{decaying_lru => decaying-lru}/go.mod (97%) rename libs/{decaying_lru => decaying-lru}/go.sum (100%) rename libs/{decaying_lru => decaying-lru}/lru.go (99%) rename libs/{decaying_lru => decaying-lru}/setup.go (99%) rename libs/hwauthz/{commonPerm => commonperm}/generic.go (90%) rename libs/hwauthz/{commonPerm => commonperm}/userOrg.go (97%) rename libs/hwdb/{pgx_zerolog => pgx-zerolog}/adapter.go (99%) rename libs/hwdb/{pgx_zerolog => pgx-zerolog}/tracer.go (99%) diff --git a/.golangci.yaml b/.golangci.yaml index 254a75c74..529967d3c 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -38,7 +38,6 @@ linters: - paralleltest # TODO - protogetter # TODO - revive # TODO - - stylecheck # TODO - tagliatelle # TODO - testpackage # TODO diff --git a/libs/common/auth/auth.go b/libs/common/auth/auth.go index 8cc955574..a91e540e2 100644 --- a/libs/common/auth/auth.go +++ b/libs/common/auth/auth.go @@ -19,9 +19,8 @@ import ( // to avoid ambiguity please read: https://wiki.helpwave.de/doc/keycloak-jedzCcERwF var ( - DEFAULT_OAUTH_ISSUER_URL = "https://accounts.helpwave.de/realms/helpwave" - - DEFAULT_OAUTH_CLIENT_ID = "helpwave-services" + DefaultOAuthIssuerURL = "https://accounts.helpwave.de/realms/helpwave" + DefaultOAuthClientID = "helpwave-services" onlyFakeAuthEnabled bool insecureFakeTokenEnable = false oauthConfig *oauth2.Config @@ -40,22 +39,22 @@ type ( organizationIDKey struct{} ) -func GetOAuthIssuerUrl() string { - issuerUrl := hwutil.GetEnvOr("OAUTH_ISSUER_URL", DEFAULT_OAUTH_ISSUER_URL) - if issuerUrl != DEFAULT_OAUTH_ISSUER_URL { +func GetOAuthIssuerURL() string { + issuerURL := hwutil.GetEnvOr("OAUTH_ISSUER_URL", DefaultOAuthIssuerURL) + if issuerURL != DefaultOAuthIssuerURL { zlog.Warn(). - Str("OAUTH_ISSUER_URL", issuerUrl). + Str("OAUTH_ISSUER_URL", issuerURL). Msg("using custom OAuth issuer url") } - return issuerUrl + return issuerURL } -func GetOAuthClientId() string { - clientId := hwutil.GetEnvOr("OAUTH_CLIENT_ID", DEFAULT_OAUTH_CLIENT_ID) - if clientId != DEFAULT_OAUTH_CLIENT_ID { - zlog.Warn().Str("OAUTH_CLIENT_ID", clientId).Msg("using custom OAuth client id") +func GetOAuthClientID() string { + clientID := hwutil.GetEnvOr("OAUTH_CLIENT_ID", DefaultOAuthClientID) + if clientID != DefaultOAuthClientID { + zlog.Warn().Str("OAUTH_CLIENT_ID", clientID).Msg("using custom OAuth client id") } - return clientId + return clientID } func IsOnlyFakeAuthEnabled() bool { @@ -109,7 +108,7 @@ type IDTokenClaims struct { } type OrganizationTokenClaim struct { - Id string `json:"id" validate:"required,uuid"` + ID string `json:"id" validate:"required,uuid"` Name string `json:"name" validate:"required"` } @@ -156,7 +155,7 @@ func VerifyFakeToken(ctx context.Context, token string) (*IDTokenClaims, *time.T } claims := IDTokenClaims{} - if err := hwutil.ParseValidJson(plainToken, &claims); err != nil { + if err := hwutil.ParseValidJSON(plainToken, &claims); err != nil { return nil, nil, fmt.Errorf("VerifyFakeToken: cant parse json: %w", err) } @@ -267,13 +266,13 @@ func SetupAuth(ctx context.Context, fakeOnly bool, passedInsecureFakeTokenEnable insecureFakeTokenEnable = passedInsecureFakeTokenEnable - provider, err := oidc.NewProvider(context.Background(), GetOAuthIssuerUrl()) + provider, err := oidc.NewProvider(context.Background(), GetOAuthIssuerURL()) if err != nil { log.Fatal().Err(err).Send() } oauthConfig = &oauth2.Config{ - ClientID: GetOAuthClientId(), + ClientID: GetOAuthClientID(), Endpoint: provider.Endpoint(), } diff --git a/libs/common/auth/auth_test.go b/libs/common/auth/auth_test.go index c4425e8d6..4342838bc 100644 --- a/libs/common/auth/auth_test.go +++ b/libs/common/auth/auth_test.go @@ -20,7 +20,7 @@ func TestIDTokenClaims_AsExpected(t *testing.T) { Name: "Test User", PreferredUsername: "testuser", Organization: &OrganizationTokenClaim{ - Id: "6759b6d7-a864-800c-a2e9-a780a83ec767", + ID: "6759b6d7-a864-800c-a2e9-a780a83ec767", Name: "Example Org", }, }, @@ -33,7 +33,7 @@ func TestIDTokenClaims_AsExpected(t *testing.T) { Name: "Test User", PreferredUsername: "testuser", Organization: &OrganizationTokenClaim{ - Id: "6759b6d7-a864-800c-a2e9-a780a83ec767", + ID: "6759b6d7-a864-800c-a2e9-a780a83ec767", Name: "Example Org", }, }, @@ -47,7 +47,7 @@ func TestIDTokenClaims_AsExpected(t *testing.T) { Name: "Test User", PreferredUsername: "testuser", Organization: &OrganizationTokenClaim{ - Id: "6759b6d7-a864-800c-a2e9-a780a83ec767", + ID: "6759b6d7-a864-800c-a2e9-a780a83ec767", Name: "Example Org", }, }, @@ -71,7 +71,7 @@ func TestIDTokenClaims_AsExpected(t *testing.T) { Name: "Test User", PreferredUsername: "testuser", Organization: &OrganizationTokenClaim{ - Id: "asdasd", + ID: "asdasd", Name: "Example Org", }, }, @@ -85,7 +85,7 @@ func TestIDTokenClaims_AsExpected(t *testing.T) { Name: "Test User", PreferredUsername: "testuser", Organization: &OrganizationTokenClaim{ - Id: "", + ID: "", Name: "", }, }, diff --git a/libs/common/dapr.go b/libs/common/dapr.go index ccfbc6728..c625aac44 100644 --- a/libs/common/dapr.go +++ b/libs/common/dapr.go @@ -63,7 +63,7 @@ func MustNewDaprGRPCClient() *daprc.GRPCClient { } // PrepCtxForSvcToSvcCall returns a context that can be used with Dapr specific service to service gRPC calls -func PrepCtxForSvcToSvcCall(ctx context.Context, targetDaprAppId string) (context.Context, context.CancelFunc, error) { +func PrepCtxForSvcToSvcCall(ctx context.Context, targetDaprAppID string) (context.Context, context.CancelFunc, error) { md, ok := metadata.FromIncomingContext(ctx) if !ok { return nil, nil, status.Errorf(codes.Internal, "No incoming metadata in context") @@ -72,7 +72,7 @@ func PrepCtxForSvcToSvcCall(ctx context.Context, targetDaprAppId string) (contex timeout := time.Second * 3 ctx, cancel := context.WithTimeout(outgoingCtx, timeout) - ctx = metadata.AppendToOutgoingContext(ctx, "dapr-app-id", targetDaprAppId) + ctx = metadata.AppendToOutgoingContext(ctx, "dapr-app-id", targetDaprAppID) return ctx, cancel, nil } diff --git a/libs/common/hwgrpc/organization_interceptor.go b/libs/common/hwgrpc/organization_interceptor.go index 1e02b4402..068757e84 100644 --- a/libs/common/hwgrpc/organization_interceptor.go +++ b/libs/common/hwgrpc/organization_interceptor.go @@ -49,7 +49,7 @@ func StreamOrganizationInterceptor( return next(req, stream) } -var ErrOrganizationIdMissing = errors.New("organization.id missing in id token") +var ErrOrganizationIDMissing = errors.New("organization.id missing in id token") // organizationInterceptor parses and injects the organization id of the OIDC claims into the current context // This is a separate function to allow endpoints to not fail when an organization id is not provided @@ -62,12 +62,12 @@ func organizationInterceptor(ctx context.Context) (context.Context, error) { return nil, err } - if len(claims.Organization.Id) == 0 { - return nil, ErrOrganizationIdMissing + if len(claims.Organization.ID) == 0 { + return nil, ErrOrganizationIDMissing } // parse organizationID - organizationID, err := uuid.Parse(claims.Organization.Id) + organizationID, err := uuid.Parse(claims.Organization.ID) if err != nil { return nil, status.Errorf(codes.Internal, "invalid organizationID") } diff --git a/libs/common/test/grpc.go b/libs/common/test/grpc.go index c57436b11..f38ff2fe3 100644 --- a/libs/common/test/grpc.go +++ b/libs/common/test/grpc.go @@ -78,19 +78,19 @@ func AuthenticatedUserClaim(userID string) map[string]interface{} { // AuthenticatedUserMetadata gives you a ready-to use grpc metadata object func AuthenticatedUserMetadata(userID string) metadata.MD { claims := AuthenticatedUserClaim(userID) - claimsJson, err := json.Marshal(claims) + claimsJSON, err := json.Marshal(claims) if err != nil { log.Fatal(err) } - fakeToken := base64.StdEncoding.EncodeToString(claimsJson) + fakeToken := base64.StdEncoding.EncodeToString(claimsJSON) return metadata.New(map[string]string{ "Authorization": "Bearer " + fakeToken, }) } -func AuthenticatedUserContext(ctx context.Context, userId string) context.Context { - md := AuthenticatedUserMetadata(userId) +func AuthenticatedUserContext(ctx context.Context, userID string) context.Context { + md := AuthenticatedUserMetadata(userID) if existing, existed := metadata.FromOutgoingContext(ctx); existed { md = metadata.Join(md, existing) } diff --git a/libs/decaying_lru/README.md b/libs/decaying-lru/README.md similarity index 98% rename from libs/decaying_lru/README.md rename to libs/decaying-lru/README.md index 9653cc58b..c739e62e7 100644 --- a/libs/decaying_lru/README.md +++ b/libs/decaying-lru/README.md @@ -1,4 +1,4 @@ -# decaying_lru +# decayinglru A module, which allows a service to leverage a redis-powered [LRU](https://en.wikipedia.org/wiki/Least_Recently_Used) which decays. Such a data structure is, for example, needed for `recently-used` tracking. diff --git a/libs/decaying_lru/add.lua b/libs/decaying-lru/add.lua similarity index 100% rename from libs/decaying_lru/add.lua rename to libs/decaying-lru/add.lua diff --git a/libs/decaying_lru/cmd/example/main.go b/libs/decaying-lru/cmd/example/main.go similarity index 89% rename from libs/decaying_lru/cmd/example/main.go rename to libs/decaying-lru/cmd/example/main.go index d24a48af8..869170b93 100644 --- a/libs/decaying_lru/cmd/example/main.go +++ b/libs/decaying-lru/cmd/example/main.go @@ -6,7 +6,7 @@ import ( "fmt" "time" - "decaying_lru" + "decayinglru" ) func must(err error) { @@ -22,7 +22,7 @@ const ( func main() { ctx := context.Background() - lru := decaying_lru.Setup(ctx, "example", size, time.Second, inverseP) + lru := decayinglru.Setup(ctx, "example", size, time.Second, inverseP) must(lru.AddItemForUser(ctx, "test", "1", "abc")) must(lru.AddItemForUser(ctx, "test", "1", "def")) diff --git a/libs/decaying_lru/go.mod b/libs/decaying-lru/go.mod similarity index 97% rename from libs/decaying_lru/go.mod rename to libs/decaying-lru/go.mod index 3b842e545..5cbc6dffa 100644 --- a/libs/decaying_lru/go.mod +++ b/libs/decaying-lru/go.mod @@ -1,4 +1,4 @@ -module decaying_lru +module decayinglru go 1.23 diff --git a/libs/decaying_lru/go.sum b/libs/decaying-lru/go.sum similarity index 100% rename from libs/decaying_lru/go.sum rename to libs/decaying-lru/go.sum diff --git a/libs/decaying_lru/lru.go b/libs/decaying-lru/lru.go similarity index 99% rename from libs/decaying_lru/lru.go rename to libs/decaying-lru/lru.go index 3d7ef3f3a..c39ed9457 100644 --- a/libs/decaying_lru/lru.go +++ b/libs/decaying-lru/lru.go @@ -1,4 +1,4 @@ -package decaying_lru +package decayinglru import ( "context" diff --git a/libs/decaying_lru/setup.go b/libs/decaying-lru/setup.go similarity index 99% rename from libs/decaying_lru/setup.go rename to libs/decaying-lru/setup.go index 143962c33..6e0df562f 100644 --- a/libs/decaying_lru/setup.go +++ b/libs/decaying-lru/setup.go @@ -1,4 +1,4 @@ -package decaying_lru +package decayinglru import ( "context" diff --git a/libs/hwauthz/commonPerm/generic.go b/libs/hwauthz/commonperm/generic.go similarity index 90% rename from libs/hwauthz/commonPerm/generic.go rename to libs/hwauthz/commonperm/generic.go index 3e255a8a4..9584b985e 100644 --- a/libs/hwauthz/commonPerm/generic.go +++ b/libs/hwauthz/commonperm/generic.go @@ -1,4 +1,4 @@ -package commonPerm +package commonperm import "hwauthz" @@ -7,7 +7,7 @@ import "hwauthz" // For example for tests, or if the type is only used once or so type GenericObject struct { Typ hwauthz.ObjectType - Id string + ID_ string } func (s GenericObject) Type() hwauthz.ObjectType { @@ -15,5 +15,5 @@ func (s GenericObject) Type() hwauthz.ObjectType { } func (s GenericObject) ID() string { - return s.Id + return s.ID_ } diff --git a/libs/hwauthz/commonPerm/userOrg.go b/libs/hwauthz/commonperm/userOrg.go similarity index 97% rename from libs/hwauthz/commonPerm/userOrg.go rename to libs/hwauthz/commonperm/userOrg.go index 195d4ad86..b4eeb5422 100644 --- a/libs/hwauthz/commonPerm/userOrg.go +++ b/libs/hwauthz/commonperm/userOrg.go @@ -1,4 +1,4 @@ -package commonPerm +package commonperm import ( "common/auth" diff --git a/libs/hwauthz/spicedb/migrate/migrate.go b/libs/hwauthz/spicedb/migrate/migrate.go index 904a62c46..869f53623 100644 --- a/libs/hwauthz/spicedb/migrate/migrate.go +++ b/libs/hwauthz/spicedb/migrate/migrate.go @@ -23,7 +23,7 @@ import ( const ( migrationResourceType = "spice_schema_migrations/migration" - migrationResourceId = "current" + migrationResourceID = "current" migrationRelation = "version" migrationSubjectType = "spice_schema_migrations/version" ) @@ -34,7 +34,7 @@ func GetCurrentVersion(ctx context.Context, client *authzed.Client) int { stream, err := client.ReadRelationships(ctx, &v1.ReadRelationshipsRequest{ RelationshipFilter: &v1.RelationshipFilter{ ResourceType: migrationResourceType, - OptionalResourceId: migrationResourceId, + OptionalResourceId: migrationResourceID, OptionalRelation: migrationRelation, }, OptionalLimit: 0, @@ -113,7 +113,7 @@ func relationshipOfVersion(version int) *v1.Relationship { return &v1.Relationship{ Resource: &v1.ObjectReference{ ObjectType: migrationResourceType, - ObjectId: migrationResourceId, + ObjectId: migrationResourceID, }, Relation: migrationRelation, Subject: &v1.SubjectReference{ diff --git a/libs/hwauthz/spicedb/spicedb.go b/libs/hwauthz/spicedb/spicedb.go index 26594e39a..5603e43ea 100644 --- a/libs/hwauthz/spicedb/spicedb.go +++ b/libs/hwauthz/spicedb/spicedb.go @@ -29,13 +29,13 @@ func fullyConsistent() *v1.Consistency { } } -func SetupSpiceDbByEnv() *authzed.Client { +func SetupSpiceDBByEnv() *authzed.Client { endpoint := hwutil.MustGetEnv("ZED_ENDPOINT") token := hwutil.MustGetEnv("ZED_TOKEN") - return SetupSpiceDb(endpoint, token) + return SetupSpiceDB(endpoint, token) } -func SetupSpiceDb(endpoint, token string) *authzed.Client { +func SetupSpiceDB(endpoint, token string) *authzed.Client { log := zlog.Logger // global logger client, err := authzed.NewClient( @@ -76,7 +76,7 @@ type SpiceDBAuthZ struct { // NewSpiceDBAuthZ constructs a new SpiceDBAuthZ instance func NewSpiceDBAuthZ() *SpiceDBAuthZ { - client := SetupSpiceDbByEnv() + client := SetupSpiceDBByEnv() return &SpiceDBAuthZ{client: client} } diff --git a/libs/hwauthz/spicedb/spicedb_test.go b/libs/hwauthz/spicedb/spicedb_test.go index 1715fd6a9..8829a8b0f 100644 --- a/libs/hwauthz/spicedb/spicedb_test.go +++ b/libs/hwauthz/spicedb/spicedb_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "hwauthz/commonPerm" + "hwauthz/commonperm" "github.com/google/uuid" @@ -63,14 +63,14 @@ func TestBulkCheck(t *testing.T) { tx := hwauthz.NewTx(client, nil, nil) for i := range checks { - sub := commonPerm.GenericObject{ + sub := commonperm.GenericObject{ Typ: "user", - Id: strconv.Itoa(i), + ID_: strconv.Itoa(i), } relation := hwauthz.Permission("member") - resc := commonPerm.GenericObject{ + resc := commonperm.GenericObject{ Typ: "organization", - Id: strconv.Itoa(i), + ID_: strconv.Itoa(i), } checks[i] = hwauthz.NewPermissionCheck(sub, relation, resc) @@ -106,18 +106,18 @@ func TestLookupResources(t *testing.T) { client := NewSpiceDBAuthZ() // preparations - sub := commonPerm.GenericObject{ + sub := commonperm.GenericObject{ Typ: "user", - Id: uuid.New().String(), + ID_: uuid.New().String(), } relation := hwauthz.Relation("member") // create test relations tx := hwauthz.NewTx(client, nil, nil) for i := range 3 { - resc := commonPerm.GenericObject{ + resc := commonperm.GenericObject{ Typ: "organization", - Id: strconv.Itoa(i), + ID_: strconv.Itoa(i), } relationship := hwauthz.NewRelationship(sub, relation, resc) tx.Create(relationship) @@ -139,23 +139,23 @@ func TestDeleteObject(t *testing.T) { client := NewSpiceDBAuthZ() // setup permission graph - ward := commonPerm.GenericObject{ + ward := commonperm.GenericObject{ Typ: "ward", - Id: uuid.New().String(), + ID_: uuid.New().String(), } - org := commonPerm.GenericObject{ + org := commonperm.GenericObject{ Typ: "organization", - Id: uuid.New().String(), + ID_: uuid.New().String(), } // the ward, which we will delete, is the (direct) resource of this relationship orgRelation := hwauthz.Relation("organization") resourceRelationship := hwauthz.NewRelationship(org, orgRelation, ward) tx := client.Create(resourceRelationship) - room := commonPerm.GenericObject{ + room := commonperm.GenericObject{ Typ: "room", - Id: uuid.New().String(), + ID_: uuid.New().String(), } // the ward is the (direct) subject of this relationship diff --git a/libs/hwauthz/test/true_authz.go b/libs/hwauthz/test/true_authz.go index 841607b0e..eade5e1bc 100644 --- a/libs/hwauthz/test/true_authz.go +++ b/libs/hwauthz/test/true_authz.go @@ -45,16 +45,16 @@ func (a *TrueAuthZ) BulkCheck(_ context.Context, checks []hwauthz.PermissionChec return bs, nil } -func (s *TrueAuthZ) BulkMust(_ context.Context, _ ...hwauthz.PermissionCheck) error { +func (a *TrueAuthZ) BulkMust(_ context.Context, _ ...hwauthz.PermissionCheck) error { return nil } -func (s *TrueAuthZ) LookupResources( +func (a *TrueAuthZ) LookupResources( _ context.Context, _ hwauthz.Object, _ hwauthz.Relation, _ hwauthz.ObjectType, ) ([]string, error) { return []string{}, nil } -func (s *TrueAuthZ) DeleteObject(_ context.Context, _ hwauthz.Object) error { +func (a *TrueAuthZ) DeleteObject(_ context.Context, _ hwauthz.Object) error { return nil } diff --git a/libs/hwdb/go.mod b/libs/hwdb/go.mod index 6ff95665a..8562572f0 100644 --- a/libs/hwdb/go.mod +++ b/libs/hwdb/go.mod @@ -11,6 +11,7 @@ replace ( require ( common v0.0.0 + github.com/google/uuid v1.6.0 github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa github.com/jackc/pgx/v5 v5.7.1 github.com/nicksnyder/go-i18n/v2 v2.4.1 @@ -36,7 +37,6 @@ require ( github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.23.0 // indirect - github.com/google/uuid v1.6.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect diff --git a/libs/hwdb/pgx_zerolog/adapter.go b/libs/hwdb/pgx-zerolog/adapter.go similarity index 99% rename from libs/hwdb/pgx_zerolog/adapter.go rename to libs/hwdb/pgx-zerolog/adapter.go index 1792a2f7b..93632b6cf 100644 --- a/libs/hwdb/pgx_zerolog/adapter.go +++ b/libs/hwdb/pgx-zerolog/adapter.go @@ -1,7 +1,7 @@ // This is adapted from github.com/jackc/pgx-zerolog, // and thus is licensed under the MIT LICENSE, // available in jackc/pgx-zerolog's LICENSE file -package pgx_zerolog +package pgxzerolog import ( "context" diff --git a/libs/hwdb/pgx_zerolog/tracer.go b/libs/hwdb/pgx-zerolog/tracer.go similarity index 99% rename from libs/hwdb/pgx_zerolog/tracer.go rename to libs/hwdb/pgx-zerolog/tracer.go index 1bab75df7..975a6a37b 100644 --- a/libs/hwdb/pgx_zerolog/tracer.go +++ b/libs/hwdb/pgx-zerolog/tracer.go @@ -1,4 +1,4 @@ -package pgx_zerolog +package pgxzerolog import ( "context" diff --git a/libs/hwdb/setup.go b/libs/hwdb/setup.go index 5090fcee2..42137f6ec 100644 --- a/libs/hwdb/setup.go +++ b/libs/hwdb/setup.go @@ -9,9 +9,9 @@ import ( "github.com/jackc/pgx/v5/pgconn" "github.com/jackc/pgx/v5/pgxpool" "github.com/rs/zerolog/log" - "hwdb/pgx_zerolog" pgxUUID "github.com/vgarvardt/pgx-google-uuid/v5" + pgxzerolog "hwdb/pgx-zerolog" ) type DBTX interface { @@ -95,7 +95,7 @@ func openDatabasePool(ctx context.Context, dsn string) (*pgxpool.Pool, error) { } // logging - pgxConfig.ConnConfig.Tracer = pgx_zerolog.NewTracer() + pgxConfig.ConnConfig.Tracer = pgxzerolog.NewTracer() // open pool dbpool, err := pgxpool.NewWithConfig(ctx, pgxConfig) diff --git a/libs/hwes/event.go b/libs/hwes/event.go index d8619d26c..c2341a5a4 100644 --- a/libs/hwes/event.go +++ b/libs/hwes/event.go @@ -114,10 +114,10 @@ func WithContext(ctx context.Context) EventOption { } } -// WithData applies SetJsonData after construction +// WithData applies SetJSONData after construction func WithData(data interface{}) EventOption { return func(event *Event) error { - return event.SetJsonData(data) + return event.SetJSONData(data) } } @@ -140,7 +140,7 @@ func NewEvent(aggregate Aggregate, eventType string, opts ...EventOption) (Event // TODO: We have to default to empty eventData as the eventstoredb-ui does not allow querying events without data var empty struct{} - if err := evt.SetJsonData(empty); err != nil { + if err := evt.SetJSONData(empty); err != nil { return Event{}, fmt.Errorf("NewEvent: could not set empty data: %w", err) } @@ -168,9 +168,9 @@ func NewEventFromProto(aggregate Aggregate, message proto.Message, opts ...Event return event, nil } -type StreamIdMalformedError string +type StreamIDMalformedError string -func (e StreamIdMalformedError) Error() string { +func (e StreamIDMalformedError) Error() string { return fmt.Sprintf("cannot resolve aggregateType and aggregateID from streamID %q", string(e)) } @@ -191,13 +191,13 @@ func resolveAggregateIDAndTypeFromStreamID(streamID string) (aID uuid.UUID, aggr aggregateTypeStr = streamIDParts[0] aggregateIDStr = streamIDParts[1] } else { - err = StreamIdMalformedError(streamID) + err = StreamIDMalformedError(streamID) return } aggregateType = AggregateType(aggregateTypeStr) if aggregateType == "" { - err = StreamIdMalformedError(streamID) + err = StreamIDMalformedError(streamID) return } @@ -308,7 +308,7 @@ func (e *Event) SetData(data []byte) *Event { return e } -func (e *Event) SetJsonData(data interface{}) error { +func (e *Event) SetJSONData(data interface{}) error { var dataBytes []byte var err error @@ -319,7 +319,7 @@ func (e *Event) SetJsonData(data interface{}) error { } if err != nil { - return fmt.Errorf("SetJsonData: %w", err) + return fmt.Errorf("SetJSONData: %w", err) } e.DataIsProto = false e.Data = dataBytes @@ -336,11 +336,11 @@ func (e *Event) SetProtoData(message proto.Message) error { return nil } -var ErrGetJsonOnProtoData = errors.New("data of event is marked as proto, use GetProtoData instead") +var ErrGetJSONOnProtoData = errors.New("data of event is marked as proto, use GetProtoData instead") -func (e *Event) GetJsonData(data interface{}) error { +func (e *Event) GetJSONData(data interface{}) error { if e.DataIsProto { - return ErrGetJsonOnProtoData + return ErrGetJSONOnProtoData } if jsonable, ok := data.(hwutil.JSONAble); ok { @@ -349,11 +349,11 @@ func (e *Event) GetJsonData(data interface{}) error { return json.Unmarshal(e.Data, data) } -var ErrGetProtoOnJsonData = errors.New("data of event is not marked as proto, use GetJsonData instead") +var ErrGetProtoOnJSONData = errors.New("data of event is not marked as proto, use GetJSONData instead") func (e *Event) GetProtoData(message proto.Message) error { if !e.DataIsProto { - return ErrGetProtoOnJsonData + return ErrGetProtoOnJSONData } return protojson.Unmarshal(e.Data, message) diff --git a/libs/hwes/eventstoredb/projections/custom/custom.go b/libs/hwes/eventstoredb/projections/custom/custom.go index d3badc691..e706ff3e9 100644 --- a/libs/hwes/eventstoredb/projections/custom/custom.go +++ b/libs/hwes/eventstoredb/projections/custom/custom.go @@ -65,7 +65,7 @@ type ICustomProjection interface { // log := zlog.Ctx(ctx) // // var payload taskEventsV1.TaskCreatedEvent -// if err := evt.GetJsonData(&payload); err != nil { +// if err := evt.GetJSONData(&payload); err != nil { // log.Error().Err(err).Msg("unmarshal failed") // return err, esdb.Nack_Retry // } diff --git a/libs/hwes/integration_test.go b/libs/hwes/integration_test.go index f246e41ab..0419d2ee6 100644 --- a/libs/hwes/integration_test.go +++ b/libs/hwes/integration_test.go @@ -28,7 +28,7 @@ type UserAggregate struct { func (a *UserAggregate) onUserCreated(evt hwes.Event) error { var payload UserCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -45,7 +45,7 @@ func (a *UserAggregate) onUserCreated(evt hwes.Event) error { func (a *UserAggregate) onUsernameUpdated(evt hwes.Event) error { var payload UsernameUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } diff --git a/libs/hwtesting/postgres.go b/libs/hwtesting/postgres.go index 2f3ee9cc5..052953d40 100644 --- a/libs/hwtesting/postgres.go +++ b/libs/hwtesting/postgres.go @@ -20,14 +20,14 @@ const ImagePostgres = "postgres:15.6" const ( PostgresUser = "postgres" PostgresPassword = "postgres" - PostgresDb = "postgres" + PostgresDB = "postgres" ) func startPostgres(ctx context.Context) (endpoint string, teardown func()) { container, err := postgres.Run(ctx, ImagePostgres, testcontainers.WithWaitStrategyAndDeadline(time.Second*10, wait.ForExposedPort()), - postgres.WithDatabase(PostgresDb), + postgres.WithDatabase(PostgresDB), postgres.WithUsername(PostgresUser), postgres.WithPassword(PostgresPassword), ) @@ -53,7 +53,7 @@ func SetPostgresEnv(endpoint string) string { postgresDSN := fmt.Sprintf( "postgres://%s:%s@%s:%s/%s?sslmode=disable", - PostgresUser, PostgresPassword, postgresHost, postgresPort, PostgresDb, + PostgresUser, PostgresPassword, postgresHost, postgresPort, PostgresDB, ) err := os.Setenv("POSTGRES_DSN", postgresDSN) diff --git a/libs/hwutil/parse.go b/libs/hwutil/parse.go index 9d6108eef..80c1049be 100644 --- a/libs/hwutil/parse.go +++ b/libs/hwutil/parse.go @@ -11,8 +11,8 @@ import ( var validate *validator.Validate -// ParseValidJson parses a JSON buffer into a struct and runs verifier on it -func ParseValidJson(buffer []byte, target any) error { +// ParseValidJSON parses a JSON buffer into a struct and runs verifier on it +func ParseValidJSON(buffer []byte, target any) error { if err := json.Unmarshal(buffer, target); err != nil { return err } diff --git a/libs/telemetry/otel.go b/libs/telemetry/otel.go index 21d312a7f..711563dd6 100644 --- a/libs/telemetry/otel.go +++ b/libs/telemetry/otel.go @@ -79,7 +79,7 @@ func FromTraceParent(ctx context.Context, traceparent string) context.Context { return propagator.Extract(ctx, carrier) } -// zerologTraceHook calls addSpanIdToLogEvent and TODO for log events +// zerologTraceHook calls addSpanIDToLogEvent and TODO for log events func zerologTraceHook() zerolog.HookFunc { return func(event *zerolog.Event, level zerolog.Level, message string) { span := trace.SpanFromContext(event.GetCtx()) @@ -90,16 +90,16 @@ func zerologTraceHook() zerolog.HookFunc { return } - addSpanIdToLogEvent(span, event) + addSpanIDToLogEvent(span, event) addLogEventToSpan(span, event, level, message) } } -// addSpanIdToLogEvent adds a span's id and its trace's id to a zerolog.Event +// addSpanIDToLogEvent adds a span's id and its trace's id to a zerolog.Event // this allows us to query a log database for log events, which arose in a span of interest // We might have to do this because we don't have access to // additional log fields in the span event added by addLogEventToSpan -func addSpanIdToLogEvent(span trace.Span, event *zerolog.Event) { +func addSpanIDToLogEvent(span trace.Span, event *zerolog.Event) { ctx := span.SpanContext() if ctx.HasTraceID() { event.Str("traceId", ctx.TraceID().String()) diff --git a/renovate.json b/renovate.json index e9d6f853a..e2891b9de 100644 --- a/renovate.json +++ b/renovate.json @@ -40,7 +40,7 @@ "extractVersion": "^v?(?.*)$" } ], - "ignoreDeps": ["common", "decaying_lru", "hwdb", "hwes", "hwutil", "hwlocale", "telemetry", "gen", "postgres"], + "ignoreDeps": ["common", "decayinglru", "hwdb", "hwes", "hwutil", "hwlocale", "telemetry", "gen", "postgres"], "customDatasources": { "buf": { "defaultRegistryUrlTemplate": "https://buf-resource-proxy.fly.dev/{{packageName}}", diff --git a/services/property-svc/internal/property-set/aggregate/aggregate.go b/services/property-svc/internal/property-set/aggregate/aggregate.go index 2fd4ed78a..9416886a3 100644 --- a/services/property-svc/internal/property-set/aggregate/aggregate.go +++ b/services/property-svc/internal/property-set/aggregate/aggregate.go @@ -46,7 +46,7 @@ func (a *PropertySetAggregate) initEventListeners() { // Event handlers func (a *PropertySetAggregate) onPropertySetCreated(evt hwes.Event) error { var payload propertySetEventsV1.PropertySetCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } diff --git a/services/property-svc/internal/property-set/commands/v1/create_property_set.go b/services/property-svc/internal/property-set/commands/v1/create_property_set.go index 869dc44ea..1e088e3e4 100644 --- a/services/property-svc/internal/property-set/commands/v1/create_property_set.go +++ b/services/property-svc/internal/property-set/commands/v1/create_property_set.go @@ -5,7 +5,7 @@ import ( "context" "fmt" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "hwes/errs" @@ -24,8 +24,8 @@ type CreatePropertySetCommandHandler func( func NewCreatePropertySetCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ) CreatePropertySetCommandHandler { return func(ctx context.Context, propertySetID uuid.UUID, name string) (common.ConsistencyToken, error) { - user := commonPerm.UserFromCtx(ctx) - org := commonPerm.OrganizationFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) + org := commonperm.OrganizationFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.OrganizationCanUserCreatePropertySet, org) if err := authz.Must(ctx, check); err != nil { diff --git a/services/property-svc/internal/property-set/projections/spiceDBProjection/set_spicedb_projection.go b/services/property-svc/internal/property-set/projections/spiceDBProjection/set_spicedb_projection.go index d6ae935c0..07432d8fc 100644 --- a/services/property-svc/internal/property-set/projections/spiceDBProjection/set_spicedb_projection.go +++ b/services/property-svc/internal/property-set/projections/spiceDBProjection/set_spicedb_projection.go @@ -4,7 +4,7 @@ import ( "context" "fmt" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "hwes/errs" "hwes/eventstoredb/projections/custom" @@ -48,7 +48,7 @@ func (p *Projection) onPropertySetCreated(ctx context.Context, evt hwes.Event) ( // Parse Values var payload propertySetEventsV1.PropertySetCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -64,7 +64,7 @@ func (p *Projection) onPropertySetCreated(ctx context.Context, evt hwes.Event) ( organizationID := *evt.OrganizationID relationship := hwauthz.NewRelationship( - commonPerm.Organization(organizationID), + commonperm.Organization(organizationID), perm.PropertySetOrganization, perm.PropertySet(propertySetID), ) diff --git a/services/property-svc/internal/property-set/queries/v1/get_property_set_by_id.go b/services/property-svc/internal/property-set/queries/v1/get_property_set_by_id.go index 678d470bd..c8a92ca01 100644 --- a/services/property-svc/internal/property-set/queries/v1/get_property_set_by_id.go +++ b/services/property-svc/internal/property-set/queries/v1/get_property_set_by_id.go @@ -4,7 +4,7 @@ import ( "context" "fmt" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "property-svc/internal/property-set/perm" @@ -19,7 +19,7 @@ type GetPropertySetByIDQueryHandler func(ctx context.Context, propertySetID uuid func NewGetPropertySetByIDQueryHandler(as hwes.AggregateStore, authz hwauthz.AuthZ) GetPropertySetByIDQueryHandler { return func(ctx context.Context, propertySetID uuid.UUID) (*models.PropertySet, error) { - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) set := perm.PropertySet(propertySetID) check := hwauthz.NewPermissionCheck(user, perm.PropertySetCanUserGet, set) diff --git a/services/property-svc/internal/property-value/aggregate/aggregate.go b/services/property-svc/internal/property-value/aggregate/aggregate.go index a344a2206..8696c49fa 100644 --- a/services/property-svc/internal/property-value/aggregate/aggregate.go +++ b/services/property-svc/internal/property-value/aggregate/aggregate.go @@ -45,7 +45,7 @@ func (a *PropertyValueAggregate) initEventListeners() { func (a *PropertyValueAggregate) onPropertyValueCreated(evt hwes.Event) error { var payload propertyEventsV1.PropertyValueCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return fmt.Errorf("PropertyValueAggregate.onPropertyValueCreated: invalid payload: %w", err) } @@ -71,7 +71,7 @@ func (a *PropertyValueAggregate) onPropertyValueCreated(evt hwes.Event) error { func (a *PropertyValueAggregate) onPropertyValueUpdated(evt hwes.Event) error { var payload propertyEventsV1.PropertyValueUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } diff --git a/services/property-svc/internal/property-value/api/grpc.go b/services/property-svc/internal/property-value/api/grpc.go index 2449e2ca3..08c59cba1 100644 --- a/services/property-svc/internal/property-value/api/grpc.go +++ b/services/property-svc/internal/property-value/api/grpc.go @@ -195,7 +195,7 @@ func (s *PropertyValueGrpcService) GetAttachedPropertyValues( v := pnv.Value.MultiSelectValues[0] res.Value = &pb.GetAttachedPropertyValuesResponse_Value_SelectValue{ SelectValue: &pb.SelectValueOption{ - Id: v.Id.String(), + Id: v.ID.String(), Name: v.Name, Description: v.Description, }, @@ -207,7 +207,7 @@ func (s *PropertyValueGrpcService) GetAttachedPropertyValues( pnv.Value.MultiSelectValues, func(o models.SelectValueOption) *pb.SelectValueOption { return &pb.SelectValueOption{ - Id: o.Id.String(), + Id: o.ID.String(), Name: o.Name, Description: o.Description, } diff --git a/services/property-svc/internal/property-value/commands/v1/attach_property_value.go b/services/property-svc/internal/property-value/commands/v1/attach_property_value.go index f938523e5..af130f80a 100644 --- a/services/property-svc/internal/property-value/commands/v1/attach_property_value.go +++ b/services/property-svc/internal/property-value/commands/v1/attach_property_value.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "hwes" @@ -36,7 +36,7 @@ func NewAttachPropertyValueCommandHandler( valueChange models.TypedValueChange, subjectID uuid.UUID, ) (common.ConsistencyToken, error) { - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.PropertyCanUserUpdateValue, perm.Property(propertyID)) if err := authz.Must(ctx, check); err != nil { return 0, err diff --git a/services/property-svc/internal/property-value/models/propertyValue.go b/services/property-svc/internal/property-value/models/propertyValue.go index b6f08d6d1..5c65c5a76 100644 --- a/services/property-svc/internal/property-value/models/propertyValue.go +++ b/services/property-svc/internal/property-value/models/propertyValue.go @@ -40,7 +40,7 @@ type PropertyValueWithProperty struct { } type SelectValueOption struct { - Id uuid.UUID + ID uuid.UUID Name string Description string } diff --git a/services/property-svc/internal/property-value/projections/property_value_postgres_projection/property_value_postgres_projection.go b/services/property-svc/internal/property-value/projections/property_value_postgres_projection/property_value_postgres_projection.go index c5763d4e8..13de08ae1 100644 --- a/services/property-svc/internal/property-value/projections/property_value_postgres_projection/property_value_postgres_projection.go +++ b/services/property-svc/internal/property-value/projections/property_value_postgres_projection/property_value_postgres_projection.go @@ -51,7 +51,7 @@ func (p *Projection) onPropertyValueCreated(ctx context.Context, evt hwes.Event) log := zlog.Ctx(ctx) var payload propertyValueEventsV1.PropertyValueCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -180,7 +180,7 @@ func (p *Projection) onPropertyValueUpdated(ctx context.Context, evt hwes.Event) log := zlog.Ctx(ctx) var payload propertyValueEventsV1.PropertyValueUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } diff --git a/services/property-svc/internal/property-value/queries/v1/get_property_values_by_subject_id.go b/services/property-svc/internal/property-value/queries/v1/get_property_values_by_subject_id.go index 5ba702ee6..187b5a7a2 100644 --- a/services/property-svc/internal/property-value/queries/v1/get_property_values_by_subject_id.go +++ b/services/property-svc/internal/property-value/queries/v1/get_property_values_by_subject_id.go @@ -6,7 +6,7 @@ import ( "fmt" pb "gen/services/property_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "hwes" "hwutil" @@ -105,7 +105,7 @@ func NewGetRelevantPropertyValuesQueryHandler( // add multiselectvalue to array properties[row.Property.ID].Value.MultiSelectValues = append( properties[row.Property.ID].Value.MultiSelectValues, models.SelectValueOption{ - Id: row.SelectOptionID.UUID, // known to be valid by if + ID: row.SelectOptionID.UUID, // known to be valid by if Name: *row.SelectOptionName, // known to be set due to NOT NULL and successful LEFT JOIN Description: *row.SelectOptionDescription, // known to be set due to NOT NULL and successful LEFT JOIN }) @@ -132,7 +132,7 @@ func NewGetRelevantPropertyValuesQueryHandler( propertySlice := hwutil.MapValuesPtrToSlice(properties) // filter out properties where permissions are missing - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) checks := hwutil.Map(propertySlice, func(p models.PropertyAndValue) hwauthz.PermissionCheck { return hwauthz.NewPermissionCheck(user, perm.PropertyCanUserGetValue, perm.Property(p.PropertyID)) }) diff --git a/services/property-svc/internal/property-view/aggregate/aggregate.go b/services/property-svc/internal/property-view/aggregate/aggregate.go index 142179ea5..f60f4fa42 100644 --- a/services/property-svc/internal/property-view/aggregate/aggregate.go +++ b/services/property-svc/internal/property-view/aggregate/aggregate.go @@ -48,7 +48,7 @@ func (a *PropertyViewRuleAggregate) initEventListeners() { func (a *PropertyViewRuleAggregate) onPropertyRuleCreated(event hwes.Event) error { var payload propertyViewEventsV1.PropertyRuleCreatedEvent - if err := event.GetJsonData(&payload); err != nil { + if err := event.GetJSONData(&payload); err != nil { return err } @@ -69,7 +69,7 @@ func (a *PropertyViewRuleAggregate) onPropertyRuleCreated(event hwes.Event) erro func (a *PropertyViewRuleAggregate) onPropertyRuleListsUpdated(event hwes.Event) error { var payload propertyViewEventsV1.PropertyRuleListsUpdatedEvent - if err := event.GetJsonData(&payload); err != nil { + if err := event.GetJSONData(&payload); err != nil { return err } diff --git a/services/property-svc/internal/property-view/models/patient_property_matcher.go b/services/property-svc/internal/property-view/models/patient_property_matcher.go index cca2acf13..37234ef98 100644 --- a/services/property-svc/internal/property-view/models/patient_property_matcher.go +++ b/services/property-svc/internal/property-view/models/patient_property_matcher.go @@ -4,7 +4,7 @@ import ( "context" "errors" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "hwutil" @@ -141,7 +141,7 @@ func PatientPropertyMatchersFromMap(m map[string]interface{}) (PatientPropertyMa } func (m PatientPropertyMatchers) UserMustBeAllowedToUpdateRule(ctx context.Context, authz hwauthz.AuthZ) error { - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) checks := make([]hwauthz.PermissionCheck, 0) @@ -156,7 +156,7 @@ func (m PatientPropertyMatchers) UserMustBeAllowedToUpdateRule(ctx context.Conte } if len(checks) == 0 { - org := commonPerm.OrganizationFromCtx(ctx) + org := commonperm.OrganizationFromCtx(ctx) checks = append(checks, hwauthz.NewPermissionCheck(user, perm.OrganizationCanUserAlterRootPropertyRules, org)) } diff --git a/services/property-svc/internal/property-view/models/task_property_matchers.go b/services/property-svc/internal/property-view/models/task_property_matchers.go index a034dc28c..38c7a90a2 100644 --- a/services/property-svc/internal/property-view/models/task_property_matchers.go +++ b/services/property-svc/internal/property-view/models/task_property_matchers.go @@ -4,7 +4,7 @@ import ( "context" "errors" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "hwutil" @@ -140,7 +140,7 @@ func TaskPropertyMatchersFromMap(m map[string]interface{}) (TaskPropertyMatchers } func (m TaskPropertyMatchers) UserMustBeAllowedToUpdateRule(ctx context.Context, authz hwauthz.AuthZ) error { - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) checks := make([]hwauthz.PermissionCheck, 0) @@ -155,7 +155,7 @@ func (m TaskPropertyMatchers) UserMustBeAllowedToUpdateRule(ctx context.Context, } if len(checks) == 0 { - org := commonPerm.OrganizationFromCtx(ctx) + org := commonperm.OrganizationFromCtx(ctx) checks = append(checks, hwauthz.NewPermissionCheck(user, perm.OrganizationCanUserAlterRootPropertyRules, org)) } diff --git a/services/property-svc/internal/property-view/projections/property_rules_postgres/property_rules_postgres.go b/services/property-svc/internal/property-view/projections/property_rules_postgres/property_rules_postgres.go index 6d1b799d2..ff5a434dd 100644 --- a/services/property-svc/internal/property-view/projections/property_rules_postgres/property_rules_postgres.go +++ b/services/property-svc/internal/property-view/projections/property_rules_postgres/property_rules_postgres.go @@ -64,7 +64,7 @@ func (p *Projection) onPropertyRuleCreated(ctx context.Context, evt hwes.Event) log := zlog.Ctx(ctx) var payload eventsV1.PropertyRuleCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -151,7 +151,7 @@ func (p *Projection) onPropertyRuleListsUpdated(ctx context.Context, evt hwes.Ev log := zlog.Ctx(ctx) var payload eventsV1.PropertyRuleListsUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionSkip) } diff --git a/services/property-svc/internal/property/aggregate/aggregate.go b/services/property-svc/internal/property/aggregate/aggregate.go index 79466a8f0..a41b6f43a 100644 --- a/services/property-svc/internal/property/aggregate/aggregate.go +++ b/services/property-svc/internal/property/aggregate/aggregate.go @@ -70,7 +70,7 @@ func (a *PropertyAggregate) initEventListeners() { // Event handlers func (a *PropertyAggregate) onPropertyCreated(evt hwes.Event) error { var payload propertyEventsV1.PropertyCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -93,7 +93,7 @@ func (a *PropertyAggregate) onPropertyCreated(evt hwes.Event) error { func (a *PropertyAggregate) onFieldTypeDataCreated(evt hwes.Event) error { var payload propertyEventsV1.FieldTypeDataCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -104,7 +104,7 @@ func (a *PropertyAggregate) onFieldTypeDataCreated(evt hwes.Event) error { func (a *PropertyAggregate) onDescriptionUpdated(evt hwes.Event) error { var payload propertyEventsV1.PropertyDescriptionUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -115,7 +115,7 @@ func (a *PropertyAggregate) onDescriptionUpdated(evt hwes.Event) error { func (a *PropertyAggregate) onSetIDUpdated(evt hwes.Event) error { var payload propertyEventsV1.PropertySetIDUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -134,7 +134,7 @@ func (a *PropertyAggregate) onSetIDUpdated(evt hwes.Event) error { func (a *PropertyAggregate) onSubjectTypeUpdated(evt hwes.Event) error { var payload propertyEventsV1.PropertySubjectTypeUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -149,7 +149,7 @@ func (a *PropertyAggregate) onSubjectTypeUpdated(evt hwes.Event) error { func (a *PropertyAggregate) onNameUpdated(evt hwes.Event) error { var payload propertyEventsV1.PropertyNameUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -159,7 +159,7 @@ func (a *PropertyAggregate) onNameUpdated(evt hwes.Event) error { func (a *PropertyAggregate) onAllowFreetextUpdated(evt hwes.Event) error { var payload propertyEventsV1.FieldTypeDataAllowFreetextUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -183,7 +183,7 @@ func (e SelectOptionNameMissingError) Error() string { func (a *PropertyAggregate) onFieldTypeDataSelectOptionsUpserted(evt hwes.Event) error { var payload propertyEventsV1.FieldTypeDataSelectOptionsUpsertedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -242,7 +242,7 @@ func (a *PropertyAggregate) onFieldTypeDataSelectOptionsUpserted(evt hwes.Event) func (a *PropertyAggregate) onFieldTypeDataSelectOptionsRemoved(evt hwes.Event) error { var payload propertyEventsV1.FieldTypeDataSelectOptionsRemovedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } diff --git a/services/property-svc/internal/property/commands/v1/create_property.go b/services/property-svc/internal/property/commands/v1/create_property.go index c76fc32ee..93a14ffa4 100644 --- a/services/property-svc/internal/property/commands/v1/create_property.go +++ b/services/property-svc/internal/property/commands/v1/create_property.go @@ -5,7 +5,7 @@ import ( "context" pb "gen/services/property_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "hwes/errs" @@ -36,8 +36,8 @@ func NewCreatePropertyCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ setID *string, fieldTypeData *models.FieldTypeData, ) (version common.ConsistencyToken, err error) { - user := commonPerm.UserFromCtx(ctx) - organization := commonPerm.OrganizationFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) + organization := commonperm.OrganizationFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.OrganizationCanUserCreateProperty, organization) if err = authz.Must(ctx, check); err != nil { diff --git a/services/property-svc/internal/property/commands/v1/update_property.go b/services/property-svc/internal/property/commands/v1/update_property.go index 6d19feef5..9918434e3 100644 --- a/services/property-svc/internal/property/commands/v1/update_property.go +++ b/services/property-svc/internal/property/commands/v1/update_property.go @@ -5,7 +5,7 @@ import ( "context" pb "gen/services/property_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "github.com/google/uuid" @@ -41,7 +41,7 @@ func NewUpdatePropertyCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ removeOptions []string, isArchived *bool, ) (common.ConsistencyToken, error) { - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.PropertyCanUserUpdate, perm.Property(propertyID)) if err := authz.Must(ctx, check); err != nil { diff --git a/services/property-svc/internal/property/projections/postgres_projection/postgres_projection.go b/services/property-svc/internal/property/projections/postgres_projection/postgres_projection.go index a72fc5c6e..1ffe09d3a 100644 --- a/services/property-svc/internal/property/projections/postgres_projection/postgres_projection.go +++ b/services/property-svc/internal/property/projections/postgres_projection/postgres_projection.go @@ -75,7 +75,7 @@ func (p *Projection) onPropertyCreated(ctx context.Context, evt hwes.Event) (err log := zlog.Ctx(ctx) var payload propertyEventsV1.PropertyCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) @@ -120,7 +120,7 @@ func (p *Projection) onPropertyDescriptionUpdated(ctx context.Context, evt hwes. log := zlog.Ctx(ctx) var payload propertyEventsV1.PropertyDescriptionUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -142,7 +142,7 @@ func (p *Projection) onPropertySetIDUpdated(ctx context.Context, evt hwes.Event) log := zlog.Ctx(ctx) var payload propertyEventsV1.PropertySetIDUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -173,7 +173,7 @@ func (p *Projection) onSubjectTypeUpdated(ctx context.Context, evt hwes.Event) ( log := zlog.Ctx(ctx) var payload propertyEventsV1.PropertySubjectTypeUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -200,7 +200,7 @@ func (p *Projection) onNameUpdated(ctx context.Context, evt hwes.Event) (error, log := zlog.Ctx(ctx) var payload propertyEventsV1.PropertyNameUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -254,7 +254,7 @@ func (p *Projection) onPropertyFieldTypeDataCreated(ctx context.Context, evt hwe propertyRepo := p.propertyRepo.WithTx(tx) var payload propertyEventsV1.FieldTypeDataCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -305,7 +305,7 @@ func (p *Projection) onAllowFreetextUpdated(ctx context.Context, evt hwes.Event) propertyRepo := p.propertyRepo.WithTx(tx) var payload propertyEventsV1.FieldTypeDataAllowFreetextUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -361,7 +361,7 @@ func (p *Projection) onFieldTypeDataSelectOptionsUpserted( propertyRepo := p.propertyRepo.WithTx(tx) var payload propertyEventsV1.FieldTypeDataSelectOptionsUpsertedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -514,7 +514,7 @@ func (p *Projection) onFieldTypeDataSelectOptionsRemoved( propertyRepo := p.propertyRepo.WithTx(tx) var payload propertyEventsV1.FieldTypeDataSelectOptionsRemovedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } diff --git a/services/property-svc/internal/property/projections/spiceDBProjection/property_spicedb_projection.go b/services/property-svc/internal/property/projections/spiceDBProjection/property_spicedb_projection.go index e3b9da2f1..c6b7928f8 100644 --- a/services/property-svc/internal/property/projections/spiceDBProjection/property_spicedb_projection.go +++ b/services/property-svc/internal/property/projections/spiceDBProjection/property_spicedb_projection.go @@ -4,7 +4,7 @@ import ( "context" "fmt" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "hwes/errs" "hwes/eventstoredb/projections/custom" @@ -48,7 +48,7 @@ func (p *Projection) onPropertyCreated(ctx context.Context, evt hwes.Event) (err // Parse Values var payload propertyEventsV1.PropertyCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -64,7 +64,7 @@ func (p *Projection) onPropertyCreated(ctx context.Context, evt hwes.Event) (err organizationID := *evt.OrganizationID relationship := hwauthz.NewRelationship( - commonPerm.Organization(organizationID), + commonperm.Organization(organizationID), perm.PropertyOrganization, perm.Property(propertyID), ) diff --git a/services/property-svc/internal/property/queries/v1/get_properties_by_subject_type.go b/services/property-svc/internal/property/queries/v1/get_properties_by_subject_type.go index 8c6228a06..f5a3fdc7a 100644 --- a/services/property-svc/internal/property/queries/v1/get_properties_by_subject_type.go +++ b/services/property-svc/internal/property/queries/v1/get_properties_by_subject_type.go @@ -5,7 +5,7 @@ import ( "context" pb "gen/services/property_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "hwutil" @@ -23,7 +23,7 @@ type GetPropertiesQueryHandler func( func NewGetPropertiesQueryHandler(authz hwauthz.AuthZ) GetPropertiesQueryHandler { return func(ctx context.Context, subjectType *pb.SubjectType) ([]*models.PropertyWithConsistency, error) { - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) propertyRepo := property_repo.New(hwdb.GetDB()) diff --git a/services/property-svc/internal/property/queries/v1/get_property_by_id.go b/services/property-svc/internal/property/queries/v1/get_property_by_id.go index ef11ba254..c5bf52b18 100644 --- a/services/property-svc/internal/property/queries/v1/get_property_by_id.go +++ b/services/property-svc/internal/property/queries/v1/get_property_by_id.go @@ -5,7 +5,7 @@ import ( "context" pb "gen/services/property_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "hwes/errs" @@ -23,7 +23,7 @@ type GetPropertyByIDQueryHandler func( func NewGetPropertyByIDQueryHandler(authz hwauthz.AuthZ) GetPropertyByIDQueryHandler { return func(ctx context.Context, propertyID uuid.UUID) (*models.Property, common.ConsistencyToken, error) { - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) // Verify user is allowed to see this property check := hwauthz.NewPermissionCheck(user, perm.PropertyCanUserGet, perm.Property(propertyID)) diff --git a/services/property-svc/internal/property/queries/v1/is_property_always_included_for_view.go b/services/property-svc/internal/property/queries/v1/is_property_always_included_for_view.go index bd5a4feb2..25e658481 100644 --- a/services/property-svc/internal/property/queries/v1/is_property_always_included_for_view.go +++ b/services/property-svc/internal/property/queries/v1/is_property_always_included_for_view.go @@ -4,7 +4,7 @@ import ( "context" pb "gen/services/property_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwutil" "github.com/google/uuid" @@ -33,7 +33,7 @@ func NewIsPropertyAlwaysIncludedForViewSourceHandler(authz hwauthz.AuthZ) IsProp subjectType pb.SubjectType, propertyID uuid.UUID, ) (bool, error) { - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) // Is user allowed to see this property? check := hwauthz.NewPermissionCheck(user, perm.PropertyCanUserGet, perm.Property(propertyID)) diff --git a/services/property-svc/stories/GetProperty_test.go b/services/property-svc/stories/GetProperty_test.go index b2531d65f..a5bcf5906 100644 --- a/services/property-svc/stories/GetProperty_test.go +++ b/services/property-svc/stories/GetProperty_test.go @@ -4,7 +4,7 @@ import ( "context" pb "gen/services/property_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwauthz/spicedb" "hwtesting" "hwutil" @@ -31,9 +31,9 @@ func TestTaskGetPropertyAlwaysIncluded(t *testing.T) { // give new user appropriate permissions authz := spicedb.NewSpiceDBAuthZ() - patient := commonPerm.GenericObject{Id: patientID.String(), Typ: "patient"} - task := commonPerm.GenericObject{Id: taskID.String(), Typ: "task"} - org := commonPerm.Organization(uuid.MustParse(hwtesting.FakeTokenOrganization)) + patient := commonperm.GenericObject{ID_: patientID.String(), Typ: "patient"} + task := commonperm.GenericObject{ID_: taskID.String(), Typ: "task"} + org := commonperm.Organization(uuid.MustParse(hwtesting.FakeTokenOrganization)) _, err := authz. Create(hwauthz.NewRelationship(org, "organization", perm.Ward(wardID))). diff --git a/services/property-svc/stories/PropertyValueCRUD_test.go b/services/property-svc/stories/PropertyValueCRUD_test.go index 405d3e465..d3dd8a6e5 100644 --- a/services/property-svc/stories/PropertyValueCRUD_test.go +++ b/services/property-svc/stories/PropertyValueCRUD_test.go @@ -48,7 +48,7 @@ func TestCreateAttachUpdateTextProperty(t *testing.T) { require.NoError(t, err, "could not get property after it was created") response := map[string]interface{}{ - "Id": propertyResponse.Id, + "ID": propertyResponse.Id, "SubjectType": propertyResponse.SubjectType.String(), "FieldType": propertyResponse.FieldType.String(), "Name": propertyResponse.Name, @@ -61,7 +61,7 @@ func TestCreateAttachUpdateTextProperty(t *testing.T) { } expectedResponse := map[string]interface{}{ - "Id": propertyID.String(), + "ID": propertyID.String(), "SubjectType": createPropertyRequest.SubjectType.String(), "FieldType": createPropertyRequest.FieldType.String(), "Name": createPropertyRequest.Name, @@ -210,7 +210,7 @@ func TestCreateAttachUpdateSelectProperty(t *testing.T) { require.NoError(t, err, "could not get property after it was created") response := map[string]interface{}{ - "Id": propertyResponse.Id, + "ID": propertyResponse.Id, "SubjectType": propertyResponse.SubjectType.String(), "FieldType": propertyResponse.FieldType.String(), "Name": propertyResponse.Name, @@ -223,7 +223,7 @@ func TestCreateAttachUpdateSelectProperty(t *testing.T) { } expectedResponse := map[string]interface{}{ - "Id": propertyID.String(), + "ID": propertyID.String(), "SubjectType": createPropertyRequest.SubjectType.String(), "FieldType": createPropertyRequest.FieldType.String(), "Name": createPropertyRequest.Name, @@ -382,7 +382,7 @@ func TestCreateAttachUpdateMultiSelectProperty(t *testing.T) { require.NoError(t, err, "could not get property after it was created") response := map[string]interface{}{ - "Id": propertyResponse.Id, + "ID": propertyResponse.Id, "SubjectType": propertyResponse.SubjectType.String(), "FieldType": propertyResponse.FieldType.String(), "Name": propertyResponse.Name, @@ -395,7 +395,7 @@ func TestCreateAttachUpdateMultiSelectProperty(t *testing.T) { } expectedResponse := map[string]interface{}{ - "Id": propertyID.String(), + "ID": propertyID.String(), "SubjectType": createPropertyRequest.SubjectType.String(), "FieldType": createPropertyRequest.FieldType.String(), "Name": createPropertyRequest.Name, diff --git a/services/tasks-svc/go.mod b/services/tasks-svc/go.mod index e10b865f5..cec4bb4ee 100644 --- a/services/tasks-svc/go.mod +++ b/services/tasks-svc/go.mod @@ -4,7 +4,7 @@ go 1.23 replace ( common => ../../libs/common - decaying_lru => ../../libs/decaying_lru + decayinglru => ../../libs/decaying-lru gen => ../../gen/go hwauthz => ../../libs/hwauthz hwdb => ../../libs/hwdb @@ -17,7 +17,7 @@ replace ( require ( common v0.0.0 - decaying_lru v0.0.0 + decayinglru v0.0.0 gen v0.0.0 github.com/EventStore/EventStore-Client-Go/v4 v4.2.0 github.com/dapr/go-sdk v1.11.0 diff --git a/services/tasks-svc/internal/bed/bed.go b/services/tasks-svc/internal/bed/bed.go index 9151329e7..30d0b5984 100644 --- a/services/tasks-svc/internal/bed/bed.go +++ b/services/tasks-svc/internal/bed/bed.go @@ -7,7 +7,7 @@ import ( "fmt" pbEventsV1 "gen/libs/events/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "hwes" "hwes/eventstoredb" @@ -71,7 +71,7 @@ func (s ServiceServer) CreateBed(ctx context.Context, req *pb.CreateBedRequest) } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, roomPerm.RoomCanUserCreateBed, roomPerm.Room(roomId)) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -146,7 +146,7 @@ func (s ServiceServer) GetBed(ctx context.Context, req *pb.GetBedRequest) (*pb.G } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.BedCanUserGet, perm.Bed(id)) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -189,7 +189,7 @@ func (s ServiceServer) GetBedByPatient( } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) checks := make([]hwauthz.PermissionCheck, 0) checks = append(checks, hwauthz.NewPermissionCheck(user, patientPerm.PatientCanUserGet, patientPerm.Patient(patientId))) @@ -237,7 +237,7 @@ func (s ServiceServer) GetBeds(ctx context.Context, req *pb.GetBedsRequest) (*pb } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) checks := hwutil.Map(beds, func(b bed_repo.Bed) hwauthz.PermissionCheck { return hwauthz.NewPermissionCheck(user, perm.BedCanUserGet, perm.Bed(b.ID)) }) @@ -288,7 +288,7 @@ func (s ServiceServer) GetBedsByRoom( } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) checks := hwutil.Map(beds, func(b bed_repo.Bed) hwauthz.PermissionCheck { return hwauthz.NewPermissionCheck(user, perm.BedCanUserGet, perm.Bed(b.ID)) }) @@ -326,7 +326,7 @@ func (s ServiceServer) UpdateBed(ctx context.Context, req *pb.UpdateBedRequest) } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.BedCanUserUpdate, perm.Bed(bedID)) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -372,7 +372,7 @@ func (s ServiceServer) DeleteBed(ctx context.Context, req *pb.DeleteBedRequest) } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.BedCanUserDelete, perm.Bed(bedID)) if err := s.authz.Must(ctx, check); err != nil { return nil, err diff --git a/services/tasks-svc/internal/patient/aggregate/aggregate.go b/services/tasks-svc/internal/patient/aggregate/aggregate.go index 554cff76a..714f4abef 100644 --- a/services/tasks-svc/internal/patient/aggregate/aggregate.go +++ b/services/tasks-svc/internal/patient/aggregate/aggregate.go @@ -47,7 +47,7 @@ func (a *PatientAggregate) initEventListeners() { // Event handlers func (a *PatientAggregate) onPatientCreated(evt hwes.Event) error { var payload patientEventsV1.PatientCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -61,7 +61,7 @@ func (a *PatientAggregate) onPatientCreated(evt hwes.Event) error { func (a *PatientAggregate) onBedAssigned(evt hwes.Event) error { var payload patientEventsV1.BedAssignedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -90,7 +90,7 @@ func (a *PatientAggregate) onPatientDischarged(evt hwes.Event) error { func (a *PatientAggregate) onNotesUpdated(evt hwes.Event) error { var payload patientEventsV1.NotesUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -101,7 +101,7 @@ func (a *PatientAggregate) onNotesUpdated(evt hwes.Event) error { func (a *PatientAggregate) onHumanReadableIdentifierUpdated(evt hwes.Event) error { var payload patientEventsV1.HumanReadableIdentifierUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } diff --git a/services/tasks-svc/internal/patient/api/grpc.go b/services/tasks-svc/internal/patient/api/grpc.go index 37519cf7a..0908ac425 100644 --- a/services/tasks-svc/internal/patient/api/grpc.go +++ b/services/tasks-svc/internal/patient/api/grpc.go @@ -6,7 +6,7 @@ import ( "context" pb "gen/services/tasks_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "hwdb/locale" "hwes" @@ -82,7 +82,7 @@ func (s *PatientGrpcService) GetPatient( bedRepo := bed_repo.New(hwdb.GetDB()) // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.PatientCanUserGet, perm.Patient(patientID)) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -367,7 +367,7 @@ func (s *PatientGrpcService) GetRecentPatients( if err != nil { return nil, hwerr.NewStatusError(ctx, codes.Internal, - "decaying_lru error: "+err.Error(), + "decayinglru error: "+err.Error(), locale.GenericError(ctx), ) } @@ -393,7 +393,7 @@ func (s *PatientGrpcService) GetRecentPatients( return &parsedUUID }) - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) checks := hwutil.Map(recentPatientIds, func(patientID uuid.UUID) hwauthz.PermissionCheck { return hwauthz.NewPermissionCheck(user, perm.PatientCanUserGet, perm.Patient(patientID)) }) diff --git a/services/tasks-svc/internal/patient/api/grpc_test.go b/services/tasks-svc/internal/patient/api/grpc_test.go index 435a37ad4..021b1a1c8 100644 --- a/services/tasks-svc/internal/patient/api/grpc_test.go +++ b/services/tasks-svc/internal/patient/api/grpc_test.go @@ -4,7 +4,7 @@ import ( "common" common_test "common/test" "context" - "decaying_lru" + "decayinglru" pb "gen/services/tasks_svc/v1" "hwauthz/test" hwes_test "hwes/test" @@ -55,7 +55,7 @@ func setup(t *testing.T) ( ctx = common_test.AuthenticatedUserContext(ctx, uuid.NewString()) redisClient, redisMock := redismock.NewClientMock() - tracking.SetLRU(decaying_lru.CustomSetup( + tracking.SetLRU(decayinglru.CustomSetup( ctx, "tasks-svc-test-"+t.Name(), 10, diff --git a/services/tasks-svc/internal/patient/commands/v1/assign_bed.go b/services/tasks-svc/internal/patient/commands/v1/assign_bed.go index f068d9c2d..5102a464e 100644 --- a/services/tasks-svc/internal/patient/commands/v1/assign_bed.go +++ b/services/tasks-svc/internal/patient/commands/v1/assign_bed.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" bedPerm "tasks-svc/internal/bed/perm" @@ -23,7 +23,7 @@ type AssignBedCommandHandler func( func NewAssignBedCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ) AssignBedCommandHandler { return func(ctx context.Context, patientID uuid.UUID, bedID uuid.UUID) (common.ConsistencyToken, error) { - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) checkPatient := hwauthz.NewPermissionCheck(user, perm.PatientCanUserAssignBed, perm.Patient(patientID)) checkBed := hwauthz.NewPermissionCheck(user, bedPerm.BedCanUserUpdate, bedPerm.Bed(bedID)) if err := authz.BulkMust(ctx, checkPatient, checkBed); err != nil { diff --git a/services/tasks-svc/internal/patient/commands/v1/create_patient.go b/services/tasks-svc/internal/patient/commands/v1/create_patient.go index 089e899b3..6bbf10837 100644 --- a/services/tasks-svc/internal/patient/commands/v1/create_patient.go +++ b/services/tasks-svc/internal/patient/commands/v1/create_patient.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "hwes/errs" @@ -32,8 +32,8 @@ func NewCreatePatientCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ) a := aggregate.NewPatientAggregate(patientID) // check permissions - user := commonPerm.UserFromCtx(ctx) - org := commonPerm.OrganizationFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) + org := commonperm.OrganizationFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.OrganizationCanUserCreatePatient, org) if err := authz.Must(ctx, check); err != nil { return 0, err diff --git a/services/tasks-svc/internal/patient/commands/v1/delete_patient.go b/services/tasks-svc/internal/patient/commands/v1/delete_patient.go index b4b626f7b..adbe5f9b8 100644 --- a/services/tasks-svc/internal/patient/commands/v1/delete_patient.go +++ b/services/tasks-svc/internal/patient/commands/v1/delete_patient.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "tasks-svc/internal/patient/perm" @@ -18,7 +18,7 @@ type DeletePatientCommandHandler func(ctx context.Context, patientID uuid.UUID) func NewDeletePatientCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ) DeletePatientCommandHandler { return func(ctx context.Context, patientID uuid.UUID) (common.ConsistencyToken, error) { - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.PatientCanUserDelete, perm.Patient(patientID)) if err := authz.Must(ctx, check); err != nil { return 0, err diff --git a/services/tasks-svc/internal/patient/commands/v1/discharge_patient.go b/services/tasks-svc/internal/patient/commands/v1/discharge_patient.go index bebdecb2f..a717afed5 100644 --- a/services/tasks-svc/internal/patient/commands/v1/discharge_patient.go +++ b/services/tasks-svc/internal/patient/commands/v1/discharge_patient.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "tasks-svc/internal/patient/perm" @@ -18,7 +18,7 @@ type DischargePatientCommandHandler func(ctx context.Context, patientID uuid.UUI func NewDischargePatientCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ) DischargePatientCommandHandler { return func(ctx context.Context, patientID uuid.UUID) (common.ConsistencyToken, error) { - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.PatientCanUserDischarge, perm.Patient(patientID)) if err := authz.Must(ctx, check); err != nil { return 0, err diff --git a/services/tasks-svc/internal/patient/commands/v1/readmit_patient.go b/services/tasks-svc/internal/patient/commands/v1/readmit_patient.go index d3ec10562..cc21e2e7c 100644 --- a/services/tasks-svc/internal/patient/commands/v1/readmit_patient.go +++ b/services/tasks-svc/internal/patient/commands/v1/readmit_patient.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "tasks-svc/internal/patient/perm" @@ -18,7 +18,7 @@ type ReadmitPatientCommandHandler func(ctx context.Context, patientID uuid.UUID) func NewReadmitPatientCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ) ReadmitPatientCommandHandler { return func(ctx context.Context, patientID uuid.UUID) (common.ConsistencyToken, error) { - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.PatientCanUserReadmit, perm.Patient(patientID)) if err := authz.Must(ctx, check); err != nil { return 0, err diff --git a/services/tasks-svc/internal/patient/commands/v1/unassign_bed.go b/services/tasks-svc/internal/patient/commands/v1/unassign_bed.go index 4f6eb65b1..a60dd169b 100644 --- a/services/tasks-svc/internal/patient/commands/v1/unassign_bed.go +++ b/services/tasks-svc/internal/patient/commands/v1/unassign_bed.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "github.com/google/uuid" @@ -25,7 +25,7 @@ func NewUnassignBedCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ) U } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) checks := make([]hwauthz.PermissionCheck, 0, 2) checks = append(checks, hwauthz.NewPermissionCheck(user, perm.PatientCanUserAssignBed, perm.Patient(patientID))) diff --git a/services/tasks-svc/internal/patient/commands/v1/update_patient.go b/services/tasks-svc/internal/patient/commands/v1/update_patient.go index 85776e9d8..0fc7b1e5f 100644 --- a/services/tasks-svc/internal/patient/commands/v1/update_patient.go +++ b/services/tasks-svc/internal/patient/commands/v1/update_patient.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "tasks-svc/internal/patient/perm" @@ -28,7 +28,7 @@ func NewUpdatePatientCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ) humanReadableIdentifier *string, notes *string, ) (common.ConsistencyToken, error) { - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.PatientCanUserUpdate, perm.Patient(patientID)) if err := authz.Must(ctx, check); err != nil { return 0, err diff --git a/services/tasks-svc/internal/patient/projections/patientPostgresProjection/patient_postgres_projection.go b/services/tasks-svc/internal/patient/projections/patientPostgresProjection/patient_postgres_projection.go index ed1e1a89d..558a63ca6 100644 --- a/services/tasks-svc/internal/patient/projections/patientPostgresProjection/patient_postgres_projection.go +++ b/services/tasks-svc/internal/patient/projections/patientPostgresProjection/patient_postgres_projection.go @@ -52,7 +52,7 @@ func (a *Projection) onPatientCreated(ctx context.Context, evt hwes.Event) (erro log := zlog.Ctx(ctx) var payload patientEventsV1.PatientCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -87,7 +87,7 @@ func (a *Projection) onBedAssigned(ctx context.Context, evt hwes.Event) (error, log := zlog.Ctx(ctx) var payload patientEventsV1.BedAssignedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -142,7 +142,7 @@ func (a *Projection) onNotesUpdated(ctx context.Context, evt hwes.Event) (error, log := zlog.Ctx(ctx) var payload patientEventsV1.NotesUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -164,7 +164,7 @@ func (a *Projection) onHumanReadableIdentifierUpdated(ctx context.Context, evt h log := zlog.Ctx(ctx) var payload patientEventsV1.HumanReadableIdentifierUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } diff --git a/services/tasks-svc/internal/patient/projections/patientSpiceDBProjection/patient_spicedb_projection.go b/services/tasks-svc/internal/patient/projections/patientSpiceDBProjection/patient_spicedb_projection.go index 525803280..72e2cb087 100644 --- a/services/tasks-svc/internal/patient/projections/patientSpiceDBProjection/patient_spicedb_projection.go +++ b/services/tasks-svc/internal/patient/projections/patientSpiceDBProjection/patient_spicedb_projection.go @@ -4,7 +4,7 @@ import ( "context" "fmt" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "hwes/errs" "hwes/eventstoredb/projections/custom" @@ -47,7 +47,7 @@ func (p *Projection) onPatientCreated(ctx context.Context, evt hwes.Event) (erro return errs.ErrOrganizationMissing, hwutil.PtrTo(esdb.NackActionSkip) } - organization := commonPerm.Organization(*evt.OrganizationID) + organization := commonperm.Organization(*evt.OrganizationID) patient := perm.Patient(evt.AggregateID) relationship := hwauthz.NewRelationship(organization, perm.PatientOrganization, patient) diff --git a/services/tasks-svc/internal/patient/queries/v1/get_all_patients_with_details.go b/services/tasks-svc/internal/patient/queries/v1/get_all_patients_with_details.go index ca66a2f14..93f8458b3 100644 --- a/services/tasks-svc/internal/patient/queries/v1/get_all_patients_with_details.go +++ b/services/tasks-svc/internal/patient/queries/v1/get_all_patients_with_details.go @@ -6,7 +6,7 @@ import ( "context" pb "gen/services/tasks_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "hwutil" @@ -27,7 +27,7 @@ func NewGetAllPatientsWithDetailsQueryHandler(authz hwauthz.AuthZ) GetAllPatient // gather inputs organizationID := auth.MustGetOrganizationID(ctx) - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) // do query rows, err := patientRepo.GetAllPatientsWithTasksBedAndRoom(ctx, organizationID) diff --git a/services/tasks-svc/internal/patient/queries/v1/get_patient_assignment_by_ward.go b/services/tasks-svc/internal/patient/queries/v1/get_patient_assignment_by_ward.go index bbdc53a1c..f11bf4690 100644 --- a/services/tasks-svc/internal/patient/queries/v1/get_patient_assignment_by_ward.go +++ b/services/tasks-svc/internal/patient/queries/v1/get_patient_assignment_by_ward.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "hwutil" @@ -33,7 +33,7 @@ func NewGetPatientAssignmentByWardQueryHandler(authz hwauthz.AuthZ) GetPatientAs // THAT'S WE DO NOT DO ANY FURTHER FILTERING (E.G. ROOMS, BEDS, TASKS) HERE // THIS NEEDS A SECOND LOOK ONCE PERMISSIONS BECOME MORE FLEXIBLE! - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) taskCheck := hwauthz.NewPermissionCheck(user, wardPerm.WardCanUserGet, wardPerm.Ward(wardID)) if err := authz.Must(ctx, taskCheck); err != nil { return nil, err diff --git a/services/tasks-svc/internal/patient/queries/v1/get_patient_by_bed.go b/services/tasks-svc/internal/patient/queries/v1/get_patient_by_bed.go index d0b2599ee..93c9ef0cd 100644 --- a/services/tasks-svc/internal/patient/queries/v1/get_patient_by_bed.go +++ b/services/tasks-svc/internal/patient/queries/v1/get_patient_by_bed.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "github.com/google/uuid" @@ -23,7 +23,7 @@ func NewGetPatientByBedQueryHandler(authz hwauthz.AuthZ) GetPatientByBedQueryHan patientRepo := patient_repo.New(hwdb.GetDB()) // check bed permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, bedPerm.BedCanUserGet, bedPerm.Bed(bedID)) if err := authz.Must(ctx, check); err != nil { return nil, err diff --git a/services/tasks-svc/internal/patient/queries/v1/get_patient_with_details_by_id.go b/services/tasks-svc/internal/patient/queries/v1/get_patient_with_details_by_id.go index 63919654f..cbc766e48 100644 --- a/services/tasks-svc/internal/patient/queries/v1/get_patient_with_details_by_id.go +++ b/services/tasks-svc/internal/patient/queries/v1/get_patient_with_details_by_id.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "hwes" @@ -27,7 +27,7 @@ func NewGetPatientWithDetailsByIDQueryHandler( taskHandlers := th.NewTaskHandlers(as, authz) // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) taskCheck := hwauthz.NewPermissionCheck(user, perm.PatientCanUserGet, perm.Patient(patientID)) if err := authz.Must(ctx, taskCheck); err != nil { return nil, err diff --git a/services/tasks-svc/internal/patient/queries/v1/get_patients_by_ward.go b/services/tasks-svc/internal/patient/queries/v1/get_patients_by_ward.go index 969b05180..7d1b03592 100644 --- a/services/tasks-svc/internal/patient/queries/v1/get_patients_by_ward.go +++ b/services/tasks-svc/internal/patient/queries/v1/get_patients_by_ward.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "hwutil" @@ -24,7 +24,7 @@ func NewGetPatientsByWardQueryHandler(authz hwauthz.AuthZ) GetPatientsByWardQuer patientRepo := patient_repo.New(hwdb.GetDB()) // ensure get-access to ward - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, wardPerm.WardCanUserGet, wardPerm.Ward(wardID)) if err := authz.Must(ctx, check); err != nil { return nil, err diff --git a/services/tasks-svc/internal/room/room.go b/services/tasks-svc/internal/room/room.go index 1bee3cd98..7c1faaaa7 100644 --- a/services/tasks-svc/internal/room/room.go +++ b/services/tasks-svc/internal/room/room.go @@ -6,7 +6,7 @@ import ( "fmt" pbEventsV1 "gen/libs/events/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "hwes" "hwes/eventstoredb" @@ -65,7 +65,7 @@ func (s ServiceServer) CreateRoom(ctx context.Context, req *pb.CreateRoomRequest } // check permission - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, wardPerm.WardCanUserCreateRoom, wardPerm.Ward(wardID)) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -127,7 +127,7 @@ func (s ServiceServer) GetRoom(ctx context.Context, req *pb.GetRoomRequest) (*pb } // check permission - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.RoomCanUserGet, perm.Room(id)) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -178,7 +178,7 @@ func (s ServiceServer) UpdateRoom(ctx context.Context, req *pb.UpdateRoomRequest } // check permission - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.RoomCanUserUpdate, perm.Room(roomID)) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -258,7 +258,7 @@ func (s ServiceServer) GetRooms(ctx context.Context, req *pb.GetRoomsRequest) (* }) // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) checks := hwutil.Map(rooms, func(r *pb.GetRoomsResponse_Room) hwauthz.PermissionCheck { return hwauthz.NewPermissionCheck(user, perm.RoomCanUserGet, perm.Room(uuid.MustParse(r.Id))) }) @@ -286,7 +286,7 @@ func (s ServiceServer) DeleteRoom(ctx context.Context, req *pb.DeleteRoomRequest } // check permission - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.RoomCanUserDelete, perm.Room(roomID)) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -332,7 +332,7 @@ func (s ServiceServer) GetRoomOverviewsByWard( // CURRENTLY THIS CHECK IMPLIES ACCESS TO ALL OTHER RESOURCES, SO NO FILTERING IS NEEDED // THIS MAY CHANGE IN THE FUTURE! - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, wardPerm.WardCanUserGet, wardPerm.Ward(wardID)) if err := s.authz.Must(ctx, check); err != nil { return nil, err diff --git a/services/tasks-svc/internal/task-template/task_template.go b/services/tasks-svc/internal/task-template/task_template.go index d84473612..63d1cf5ee 100644 --- a/services/tasks-svc/internal/task-template/task_template.go +++ b/services/tasks-svc/internal/task-template/task_template.go @@ -7,7 +7,7 @@ import ( "fmt" pbEventsV1 "gen/libs/events/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "hwes" "hwes/eventstoredb" @@ -61,7 +61,7 @@ func (s ServiceServer) CreateTaskTemplate( log := zlog.Ctx(ctx) db := hwdb.GetDB() - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) wardID, err := hwutil.ParseNullUUID(req.WardId) if err != nil { @@ -171,7 +171,7 @@ func (s ServiceServer) DeleteTaskTemplate( } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.TaskTemplateCanUserDelete, perm.TaskTemplate(id)) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -230,7 +230,7 @@ func (s ServiceServer) DeleteTaskTemplateSubTask( } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.TaskTemplateCanUserUpdate, perm.TaskTemplate(subtask.TaskTemplateID)) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -281,7 +281,7 @@ func (s ServiceServer) UpdateTaskTemplate( } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.TaskTemplateCanUserUpdate, perm.TaskTemplate(id)) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -342,7 +342,7 @@ func (s ServiceServer) UpdateTaskTemplateSubTask( } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.TaskTemplateCanUserUpdate, perm.TaskTemplate(taskTemplateID)) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -391,7 +391,7 @@ func (s ServiceServer) CreateTaskTemplateSubTask( } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.TaskTemplateCanUserUpdate, perm.TaskTemplate(taskTemplateID)) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -438,7 +438,7 @@ func (s ServiceServer) GetAllTaskTemplates( ) (*pb.GetAllTaskTemplatesResponse, error) { templateRepo := task_template_repo.New(hwdb.GetDB()) - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) wardID, err := hwutil.ParseNullUUID(req.WardId) if err != nil { @@ -520,7 +520,7 @@ func (s ServiceServer) GetTaskTemplate( } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.TaskTemplateCanUserGet, perm.TaskTemplate(taskTemplateID)) if err := s.authz.Must(ctx, check); err != nil { return nil, err diff --git a/services/tasks-svc/internal/task/aggregate/aggregate.go b/services/tasks-svc/internal/task/aggregate/aggregate.go index 0eb6bbaa3..362a39f49 100644 --- a/services/tasks-svc/internal/task/aggregate/aggregate.go +++ b/services/tasks-svc/internal/task/aggregate/aggregate.go @@ -68,7 +68,7 @@ func (a *TaskAggregate) initEventListeners() { func (a *TaskAggregate) onTaskCreated(evt hwes.Event) error { var payload taskEventsV1.TaskCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -93,7 +93,7 @@ func (a *TaskAggregate) onTaskCreated(evt hwes.Event) error { func (a *TaskAggregate) onTaskStatusUpdated(evt hwes.Event) error { var payload taskEventsV1.TaskStatusUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -110,7 +110,7 @@ func (a *TaskAggregate) onTaskStatusUpdated(evt hwes.Event) error { func (a *TaskAggregate) onTaskNameUpdated(evt hwes.Event) error { var payload taskEventsV1.TaskNameUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -121,7 +121,7 @@ func (a *TaskAggregate) onTaskNameUpdated(evt hwes.Event) error { func (a *TaskAggregate) onTaskDescriptionUpdated(evt hwes.Event) error { var payload taskEventsV1.TaskDescriptionUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -132,7 +132,7 @@ func (a *TaskAggregate) onTaskDescriptionUpdated(evt hwes.Event) error { func (a *TaskAggregate) onTaskDueAtUpdated(evt hwes.Event) error { var payload taskEventsV1.TaskDueAtUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -147,13 +147,13 @@ func (a *TaskAggregate) onTaskAssigned(evt hwes.Event) error { switch evt.EventType { case taskEventsV1.TaskAssigned: var payload taskEventsV1.TaskAssignedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } userIDStr = payload.UserID case taskEventsV1.TaskSelfAssigned: var payload taskEventsV1.TaskSelfAssignedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } userIDStr = payload.UserID @@ -171,7 +171,7 @@ func (a *TaskAggregate) onTaskAssigned(evt hwes.Event) error { func (a *TaskAggregate) onTaskUnassigned(evt hwes.Event) error { var payload taskEventsV1.TaskUnassignedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -192,7 +192,7 @@ func (a *TaskAggregate) onTaskUnpublished(_ hwes.Event) error { func (a *TaskAggregate) onSubtaskCreated(evt hwes.Event) error { var payload taskEventsV1.SubtaskCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -215,7 +215,7 @@ func (a *TaskAggregate) onSubtaskCreated(evt hwes.Event) error { func (a *TaskAggregate) onSubtaskNameUpdated(evt hwes.Event) error { var payload taskEventsV1.SubtaskNameUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -237,7 +237,7 @@ func (a *TaskAggregate) onSubtaskNameUpdated(evt hwes.Event) error { func (a *TaskAggregate) onSubtaskCompleted(evt hwes.Event) error { var payload taskEventsV1.SubtaskCompletedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -255,7 +255,7 @@ func (a *TaskAggregate) onSubtaskCompleted(evt hwes.Event) error { func (a *TaskAggregate) onSubtaskUncompleted(evt hwes.Event) error { var payload taskEventsV1.SubtaskUncompletedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } @@ -273,7 +273,7 @@ func (a *TaskAggregate) onSubtaskUncompleted(evt hwes.Event) error { func (a *TaskAggregate) onSubtaskDeleted(evt hwes.Event) error { var payload taskEventsV1.SubtaskDeletedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { return err } diff --git a/services/tasks-svc/internal/task/commands/v1/assign_task.go b/services/tasks-svc/internal/task/commands/v1/assign_task.go index cb9d1451d..0534f6443 100644 --- a/services/tasks-svc/internal/task/commands/v1/assign_task.go +++ b/services/tasks-svc/internal/task/commands/v1/assign_task.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "tasks-svc/internal/task/perm" @@ -19,7 +19,7 @@ type AssignTaskCommandHandler func(ctx context.Context, taskID, userID uuid.UUID func NewAssignTaskCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ) AssignTaskCommandHandler { return func(ctx context.Context, taskID, userID uuid.UUID) (common.ConsistencyToken, error) { // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.TaskCanUserAssign, perm.Task(taskID)) if err := authz.Must(ctx, check); err != nil { return 0, err diff --git a/services/tasks-svc/internal/task/commands/v1/create_subtask.go b/services/tasks-svc/internal/task/commands/v1/create_subtask.go index 7bc61e77f..01acf5e9c 100644 --- a/services/tasks-svc/internal/task/commands/v1/create_subtask.go +++ b/services/tasks-svc/internal/task/commands/v1/create_subtask.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "tasks-svc/internal/task/perm" @@ -31,7 +31,7 @@ func NewCreateSubtaskCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ) done bool, ) (common.ConsistencyToken, error) { // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.TaskCanUserCreateSubtask, perm.Task(taskID)) if err := authz.Must(ctx, check); err != nil { return 0, err diff --git a/services/tasks-svc/internal/task/commands/v1/create_task.go b/services/tasks-svc/internal/task/commands/v1/create_task.go index ddb46f29e..31cc93749 100644 --- a/services/tasks-svc/internal/task/commands/v1/create_task.go +++ b/services/tasks-svc/internal/task/commands/v1/create_task.go @@ -5,7 +5,7 @@ import ( "context" pb "gen/services/tasks_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "hwes/errs" @@ -45,7 +45,7 @@ func NewCreateTaskCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ) Cr subtasks []*pb.CreateTaskRequest_SubTask, ) (common.ConsistencyToken, error) { // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.PatientCanUserCreateTask, patientPerm.Patient(patientID)) if err := authz.Must(ctx, check); err != nil { return 0, err diff --git a/services/tasks-svc/internal/task/commands/v1/delete_subtask.go b/services/tasks-svc/internal/task/commands/v1/delete_subtask.go index 4feeb327b..ee4fd5c99 100644 --- a/services/tasks-svc/internal/task/commands/v1/delete_subtask.go +++ b/services/tasks-svc/internal/task/commands/v1/delete_subtask.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "tasks-svc/internal/task/perm" @@ -19,7 +19,7 @@ type DeleteSubtaskCommandHandler func(ctx context.Context, taskID, subtaskID uui func NewDeleteSubtaskCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ) DeleteSubtaskCommandHandler { return func(ctx context.Context, taskID, subtaskID uuid.UUID) (common.ConsistencyToken, error) { // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.TaskCanUserDeleteSubtask, perm.Task(taskID)) if err := authz.Must(ctx, check); err != nil { return 0, err diff --git a/services/tasks-svc/internal/task/commands/v1/delete_task.go b/services/tasks-svc/internal/task/commands/v1/delete_task.go index 9440f587e..e099b4322 100644 --- a/services/tasks-svc/internal/task/commands/v1/delete_task.go +++ b/services/tasks-svc/internal/task/commands/v1/delete_task.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "tasks-svc/internal/task/perm" @@ -19,7 +19,7 @@ type DeleteTaskCommandHandler func(ctx context.Context, taskID uuid.UUID) (commo func NewDeleteTaskCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ) DeleteTaskCommandHandler { return func(ctx context.Context, taskID uuid.UUID) (common.ConsistencyToken, error) { // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.TaskCanUserDelete, perm.Task(taskID)) if err := authz.Must(ctx, check); err != nil { return 0, err diff --git a/services/tasks-svc/internal/task/commands/v1/remove_task_due_at.go b/services/tasks-svc/internal/task/commands/v1/remove_task_due_at.go index 2c34e24d8..9adcf2ff4 100644 --- a/services/tasks-svc/internal/task/commands/v1/remove_task_due_at.go +++ b/services/tasks-svc/internal/task/commands/v1/remove_task_due_at.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "tasks-svc/internal/task/perm" @@ -19,7 +19,7 @@ type RemoveTaskDueAtCommandHandler func(ctx context.Context, taskID uuid.UUID) ( func NewRemoveTaskDueAtCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ) RemoveTaskDueAtCommandHandler { return func(ctx context.Context, taskID uuid.UUID) (common.ConsistencyToken, error) { // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.TaskCanUserUpdate, perm.Task(taskID)) if err := authz.Must(ctx, check); err != nil { return 0, err diff --git a/services/tasks-svc/internal/task/commands/v1/unassign_task.go b/services/tasks-svc/internal/task/commands/v1/unassign_task.go index 018c903e2..9cfe6f4f5 100644 --- a/services/tasks-svc/internal/task/commands/v1/unassign_task.go +++ b/services/tasks-svc/internal/task/commands/v1/unassign_task.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "tasks-svc/internal/task/perm" @@ -19,7 +19,7 @@ type UnassignTaskCommandHandler func(ctx context.Context, taskID, userID uuid.UU func NewUnassignTaskCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ) UnassignTaskCommandHandler { return func(ctx context.Context, taskID, userID uuid.UUID) (common.ConsistencyToken, error) { // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.TaskCanUserAssign, perm.Task(taskID)) if err := authz.Must(ctx, check); err != nil { return 0, err diff --git a/services/tasks-svc/internal/task/commands/v1/update_subtask.go b/services/tasks-svc/internal/task/commands/v1/update_subtask.go index 6d78b9661..8a774c106 100644 --- a/services/tasks-svc/internal/task/commands/v1/update_subtask.go +++ b/services/tasks-svc/internal/task/commands/v1/update_subtask.go @@ -4,7 +4,7 @@ import ( "common" "context" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "tasks-svc/internal/task/errs" @@ -33,7 +33,7 @@ func NewUpdateSubtaskCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ) done *bool, ) (common.ConsistencyToken, error) { // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.TaskCanUserUpdateSubtask, perm.Task(taskID)) if err := authz.Must(ctx, check); err != nil { return 0, err diff --git a/services/tasks-svc/internal/task/commands/v1/update_task.go b/services/tasks-svc/internal/task/commands/v1/update_task.go index bc23e8e3e..3cbf08320 100644 --- a/services/tasks-svc/internal/task/commands/v1/update_task.go +++ b/services/tasks-svc/internal/task/commands/v1/update_task.go @@ -5,7 +5,7 @@ import ( "context" pb "gen/services/tasks_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwes" "tasks-svc/internal/task/perm" @@ -37,7 +37,7 @@ func NewUpdateTaskCommandHandler(as hwes.AggregateStore, authz hwauthz.AuthZ) Up dueAt *timestamppb.Timestamp, ) (common.ConsistencyToken, error) { // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.TaskCanUserUpdate, perm.Task(taskID)) if err := authz.Must(ctx, check); err != nil { return 0, err diff --git a/services/tasks-svc/internal/task/projections/task_postgres_projection/task_postgres_projection.go b/services/tasks-svc/internal/task/projections/task_postgres_projection/task_postgres_projection.go index 116676f92..feb85eccb 100644 --- a/services/tasks-svc/internal/task/projections/task_postgres_projection/task_postgres_projection.go +++ b/services/tasks-svc/internal/task/projections/task_postgres_projection/task_postgres_projection.go @@ -69,7 +69,7 @@ func (p *Projection) onTaskCreated(ctx context.Context, evt hwes.Event) (error, log := zlog.Ctx(ctx) var payload taskEventsV1.TaskCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -117,7 +117,7 @@ func (p *Projection) onTaskStatusUpdated(ctx context.Context, evt hwes.Event) (e log := zlog.Ctx(ctx) var payload taskEventsV1.TaskStatusUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -143,7 +143,7 @@ func (p *Projection) onTaskNameUpdated(ctx context.Context, evt hwes.Event) (err log := zlog.Ctx(ctx) var payload taskEventsV1.TaskNameUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -164,7 +164,7 @@ func (p *Projection) onTaskDescriptionUpdated(ctx context.Context, evt hwes.Even log := zlog.Ctx(ctx) var payload taskEventsV1.TaskDescriptionUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -185,7 +185,7 @@ func (p *Projection) onTaskDueAtUpdated(ctx context.Context, evt hwes.Event) (er log := zlog.Ctx(ctx) var payload taskEventsV1.TaskDueAtUpdatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -210,14 +210,14 @@ func (p *Projection) onTaskAssigned(ctx context.Context, evt hwes.Event) (error, switch evt.EventType { case taskEventsV1.TaskAssigned: var payload taskEventsV1.TaskAssignedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } userIDStr = payload.UserID case taskEventsV1.TaskSelfAssigned: var payload taskEventsV1.TaskSelfAssignedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -245,7 +245,7 @@ func (p *Projection) onTaskUnassigned(ctx context.Context, evt hwes.Event) (erro log := zlog.Ctx(ctx) var payload taskEventsV1.TaskUnassignedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -292,7 +292,7 @@ func (p *Projection) onSubtaskCreated(ctx context.Context, evt hwes.Event) (erro log := zlog.Ctx(ctx) var payload taskEventsV1.SubtaskCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -328,7 +328,7 @@ func (p *Projection) onSubtaskNameUpdated(ctx context.Context, evt hwes.Event) ( log := zlog.Ctx(ctx) var payload taskEventsV1.SubtaskCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -354,7 +354,7 @@ func (p *Projection) onSubtaskCompleted(ctx context.Context, evt hwes.Event) (er log := zlog.Ctx(ctx) var payload taskEventsV1.SubtaskCompletedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -380,7 +380,7 @@ func (p *Projection) onSubtaskUncompleted(ctx context.Context, evt hwes.Event) ( log := zlog.Ctx(ctx) var payload taskEventsV1.SubtaskUncompletedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } @@ -406,7 +406,7 @@ func (p *Projection) onSubtaskDeleted(ctx context.Context, evt hwes.Event) (erro log := zlog.Ctx(ctx) var payload taskEventsV1.SubtaskDeletedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } diff --git a/services/tasks-svc/internal/task/projections/task_spicedb/spicedb.go b/services/tasks-svc/internal/task/projections/task_spicedb/spicedb.go index 8e46f39e2..7f6ec460d 100644 --- a/services/tasks-svc/internal/task/projections/task_spicedb/spicedb.go +++ b/services/tasks-svc/internal/task/projections/task_spicedb/spicedb.go @@ -48,7 +48,7 @@ func (p *Projection) onTaskCreated(ctx context.Context, evt hwes.Event) (error, log := zlog.Ctx(ctx) var payload taskEventsV1.TaskCreatedEvent - if err := evt.GetJsonData(&payload); err != nil { + if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") return err, hwutil.PtrTo(esdb.NackActionPark) } diff --git a/services/tasks-svc/internal/task/queries/v1/get_task_with_patient_by_id.go b/services/tasks-svc/internal/task/queries/v1/get_task_with_patient_by_id.go index 12d475cdc..b8b670ff3 100644 --- a/services/tasks-svc/internal/task/queries/v1/get_task_with_patient_by_id.go +++ b/services/tasks-svc/internal/task/queries/v1/get_task_with_patient_by_id.go @@ -5,7 +5,7 @@ import ( "context" pb "gen/services/tasks_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" patientPerm "tasks-svc/internal/patient/perm" @@ -22,7 +22,7 @@ type GetTaskWithPatientByIDQueryHandler func(ctx context.Context, taskID uuid.UU func NewGetTaskWithPatientByIDQueryHandler(authz hwauthz.AuthZ) GetTaskWithPatientByIDQueryHandler { return func(ctx context.Context, taskID uuid.UUID) (*models.TaskWithPatient, error) { // check task permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) taskCheck := hwauthz.NewPermissionCheck(user, perm.TaskCanUserGet, perm.Task(taskID)) if err := authz.Must(ctx, taskCheck); err != nil { return nil, err diff --git a/services/tasks-svc/internal/task/queries/v1/get_tasks_by_patient.go b/services/tasks-svc/internal/task/queries/v1/get_tasks_by_patient.go index f9132989b..784bbe4a7 100644 --- a/services/tasks-svc/internal/task/queries/v1/get_tasks_by_patient.go +++ b/services/tasks-svc/internal/task/queries/v1/get_tasks_by_patient.go @@ -4,7 +4,7 @@ import ( "common" pb "gen/services/tasks_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "hwutil" @@ -26,7 +26,7 @@ type GetTasksByPatientIDQueryHandler func( func NewGetTasksByPatientIDQueryHandler(authz hwauthz.AuthZ) GetTasksByPatientIDQueryHandler { return func(ctx context.Context, patientID uuid.UUID) ([]*models.TaskWithConsistency, error) { // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) taskCheck := hwauthz.NewPermissionCheck(user, patientPerm.PatientCanUserGet, patientPerm.Patient(patientID)) if err := authz.Must(ctx, taskCheck); err != nil { return nil, err diff --git a/services/tasks-svc/internal/task/queries/v1/get_tasks_with_patients_by_asignee.go b/services/tasks-svc/internal/task/queries/v1/get_tasks_with_patients_by_asignee.go index f307a948a..b145f1966 100644 --- a/services/tasks-svc/internal/task/queries/v1/get_tasks_with_patients_by_asignee.go +++ b/services/tasks-svc/internal/task/queries/v1/get_tasks_with_patients_by_asignee.go @@ -5,7 +5,7 @@ import ( "context" pb "gen/services/tasks_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "hwutil" @@ -27,7 +27,7 @@ func NewGetTasksWithPatientsByAssigneeQueryHandler(authz hwauthz.AuthZ) GetTasks return func(ctx context.Context, assigneeID uuid.UUID) ([]*models.TaskWithPatient, error) { taskRepo := task_repo.New(hwdb.GetDB()) - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) rows, err := taskRepo.GetTasksWithPatientByAssignee(ctx, uuid.NullUUID{ UUID: assigneeID, diff --git a/services/tasks-svc/internal/tracking/tracking.go b/services/tasks-svc/internal/tracking/tracking.go index 93195eb99..97e276b05 100644 --- a/services/tasks-svc/internal/tracking/tracking.go +++ b/services/tasks-svc/internal/tracking/tracking.go @@ -3,7 +3,7 @@ package tracking import ( "common/auth" "context" - "decaying_lru" + "decayinglru" "hwutil" "time" @@ -15,10 +15,10 @@ const ( WardKey = "recently-viewed-ward" ) -var lru decaying_lru.DecayingLRU +var lru decayinglru.DecayingLRU func SetupTracking(ctx context.Context, serviceName string, lruSize int64, decay time.Duration, invP int) { - redisOptions := decaying_lru.DefaultRedisOptions(serviceName) + redisOptions := decayinglru.DefaultRedisOptions(serviceName) // Default ENVs not set? try SECRETSTORE_ versions instead @@ -34,7 +34,7 @@ func SetupTracking(ctx context.Context, serviceName string, lruSize int64, decay redisOptions.Password = hwutil.GetEnvOr("SECRETSTORE_REDIS_PASSWORD", "") } - lru = decaying_lru.CustomSetup(ctx, serviceName, lruSize, decay, invP, redisOptions, nil) + lru = decayinglru.CustomSetup(ctx, serviceName, lruSize, decay, invP, redisOptions, nil) } func getUserID(ctx context.Context) string { @@ -104,6 +104,6 @@ func GetRecentWardsForUser(ctx context.Context) ([]string, error) { } // SetLRU overwrites the lru, to use a custom setup, instead of SetupTracking (e.g., for testing) -func SetLRU(dlru decaying_lru.DecayingLRU) { +func SetLRU(dlru decayinglru.DecayingLRU) { lru = dlru } diff --git a/services/tasks-svc/internal/ward/ward.go b/services/tasks-svc/internal/ward/ward.go index f766cb85b..35bea85b8 100644 --- a/services/tasks-svc/internal/ward/ward.go +++ b/services/tasks-svc/internal/ward/ward.go @@ -6,7 +6,7 @@ import ( "fmt" pb "gen/services/tasks_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "hwes" "hwes/eventstoredb" @@ -60,8 +60,8 @@ func (s *ServiceServer) CreateWard(ctx context.Context, req *pb.CreateWardReques wardRepo := ward_repo.New(hwdb.GetDB()) // check permissions - user := commonPerm.UserFromCtx(ctx) - organization := commonPerm.OrganizationFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) + organization := commonperm.OrganizationFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.OrganizationCanUserCreateWard, organization) if err := s.authz.Must(ctx, check); err != nil { @@ -125,7 +125,7 @@ func (s *ServiceServer) GetWard(ctx context.Context, req *pb.GetWardRequest) (*p } // check permission - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.WardCanUserGet, perm.Ward(id)) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -158,7 +158,7 @@ func (s *ServiceServer) GetWards(ctx context.Context, req *pb.GetWardsRequest) ( return nil, err } - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) checks := hwutil.Map(wards, func(w ward_repo.Ward) hwauthz.PermissionCheck { return hwauthz.NewPermissionCheck(user, perm.WardCanUserGet, perm.Ward(w.ID)) }) @@ -217,7 +217,7 @@ func (s *ServiceServer) GetRecentWards( } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) checks := hwutil.Map(rows, func(w ward_repo.GetWardsWithCountsRow) hwauthz.PermissionCheck { return hwauthz.NewPermissionCheck(user, perm.WardCanUserGet, perm.Ward(w.Ward.ID)) }) @@ -256,7 +256,7 @@ func (s *ServiceServer) UpdateWard(ctx context.Context, req *pb.UpdateWardReques } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.WardCanUserUpdate, perm.Ward(id)) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -302,7 +302,7 @@ func (s *ServiceServer) DeleteWard(ctx context.Context, req *pb.DeleteWardReques } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck(user, perm.WardCanUserDelete, perm.Ward(wardID)) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -363,7 +363,7 @@ func (s *ServiceServer) GetWardOverviews( return nil, err } - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) checks := hwutil.Map(rows, func(w ward_repo.GetWardsWithCountsRow) hwauthz.PermissionCheck { return hwauthz.NewPermissionCheck(user, perm.WardCanUserGet, perm.Ward(w.Ward.ID)) }) @@ -403,7 +403,7 @@ func (s *ServiceServer) GetWardDetails( } // permission check - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) wardCheck := hwauthz.NewPermissionCheck(user, perm.WardCanUserGet, perm.Ward(wardID)) if err := s.authz.Must(ctx, wardCheck); err != nil { return nil, err diff --git a/services/tasks-svc/stories/PatientCRUD_test.go b/services/tasks-svc/stories/PatientCRUD_test.go index 9bc3bff04..0ef9460e3 100644 --- a/services/tasks-svc/stories/PatientCRUD_test.go +++ b/services/tasks-svc/stories/PatientCRUD_test.go @@ -4,7 +4,7 @@ import ( "context" pb "gen/services/tasks_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwauthz/spicedb" "hwtesting" "hwutil" @@ -647,8 +647,8 @@ func TestGetRecentPatients(t *testing.T) { // give new user appropriate permissions authz := spicedb.NewSpiceDBAuthZ() - user := commonPerm.User(userID) - org := commonPerm.Organization(uuid.MustParse(hwtesting.FakeTokenOrganization)) + user := commonperm.User(userID) + org := commonperm.Organization(uuid.MustParse(hwtesting.FakeTokenOrganization)) _, err := authz.Create(hwauthz.NewRelationship(user, "member", org)).Commit(ctx) require.NoError(t, err) diff --git a/services/tasks-svc/stories/TaskCRUD_test.go b/services/tasks-svc/stories/TaskCRUD_test.go index 26698b2c2..02508b62c 100644 --- a/services/tasks-svc/stories/TaskCRUD_test.go +++ b/services/tasks-svc/stories/TaskCRUD_test.go @@ -4,7 +4,7 @@ import ( "context" pb "gen/services/tasks_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwauthz/spicedb" "hwtesting" "hwutil" @@ -349,8 +349,8 @@ func TestGetAssignedTasks(t *testing.T) { // give new user appropriate permissions authz := spicedb.NewSpiceDBAuthZ() - user := commonPerm.User(userID) - org := commonPerm.Organization(uuid.MustParse(hwtesting.FakeTokenOrganization)) + user := commonperm.User(userID) + org := commonperm.Organization(uuid.MustParse(hwtesting.FakeTokenOrganization)) _, err := authz.Create(hwauthz.NewRelationship(user, "member", org)).Commit(ctx) require.NoError(t, err) diff --git a/services/tasks-svc/stories/WardCRUD_test.go b/services/tasks-svc/stories/WardCRUD_test.go index abf387dd4..971e2f2ce 100644 --- a/services/tasks-svc/stories/WardCRUD_test.go +++ b/services/tasks-svc/stories/WardCRUD_test.go @@ -4,7 +4,7 @@ import ( "context" pb "gen/services/tasks_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwauthz/spicedb" "hwtesting" "hwutil" @@ -98,9 +98,9 @@ func TestGetRecentWards(t *testing.T) { authz := spicedb.NewSpiceDBAuthZ() _, err := authz.Create( hwauthz.NewRelationship( - commonPerm.User(userID), + commonperm.User(userID), "member", - commonPerm.Organization(uuid.MustParse(hwtesting.FakeTokenOrganization)), + commonperm.Organization(uuid.MustParse(hwtesting.FakeTokenOrganization)), ), ).Commit(ctx) require.NoError(t, err) diff --git a/services/updates-svc/go.mod b/services/updates-svc/go.mod index c43136086..41dc6071e 100644 --- a/services/updates-svc/go.mod +++ b/services/updates-svc/go.mod @@ -4,7 +4,7 @@ go 1.23 replace ( common => ../../libs/common - decaying_lru => ../../libs/decaying_lru + decayinglru => ../../libs/decaying-lru gen => ../../gen/go hwauthz => ../../libs/hwauthz hwdb => ../../libs/hwdb diff --git a/services/updates-svc/stories/updates_test.go b/services/updates-svc/stories/updates_test.go index 1ef7202fe..7917373d3 100644 --- a/services/updates-svc/stories/updates_test.go +++ b/services/updates-svc/stories/updates_test.go @@ -45,10 +45,10 @@ func TestReceivingEvents(t *testing.T) { updatesClient := updatesServiceClient() - bedId := uuid.New() + bedID := uuid.New() bedType := "bed" - bedAggregate := hwes.NewAggregateBase(eventstoredb.EntityEventPrefix+"bed", bedId) + bedAggregate := hwes.NewAggregateBase(eventstoredb.EntityEventPrefix+"bed", bedID) req := &pb.ReceiveUpdatesRequest{} stream, err := updatesClient.ReceiveUpdates(ctx, req) @@ -62,15 +62,15 @@ func TestReceivingEvents(t *testing.T) { resEntityEvent := res.GetEvent() requireTrue(t, assert.NotNil(t, resEntityEvent)) requireTrue(t, assert.Equal(t, bedType, resEntityEvent.GetAggregateType())) - requireTrue(t, assert.Equal(t, bedId.String(), resEntityEvent.GetAggregateId())) + requireTrue(t, assert.Equal(t, bedID.String(), resEntityEvent.GetAggregateId())) requireTrue(t, assert.Equal(t, "BED_CREATED_v1", resEntityEvent.GetEventType())) - bedId2 := uuid.New() - bed2Aggregate := hwes.NewAggregateBase(eventstoredb.EntityEventPrefix+"bed", bedId2) + bedID2 := uuid.New() + bed2Aggregate := hwes.NewAggregateBase(eventstoredb.EntityEventPrefix+"bed", bedID2) // store event if err := eventstoredb.SaveEntityEventForAggregate(ctx, es, bed2Aggregate, - &pbEventsV1.BedCreatedEvent{Id: bedId2.String()}, + &pbEventsV1.BedCreatedEvent{Id: bedID2.String()}, ); err != nil { requireTrue(t, assert.NoError(t, err)) } @@ -88,13 +88,13 @@ func TestReceivingEvents(t *testing.T) { res2EntityEvent := res2.GetEvent() requireTrue(t, assert.NotNil(t, res2EntityEvent)) requireTrue(t, assert.Equal(t, bedType, res2EntityEvent.GetAggregateType())) - requireTrue(t, assert.Equal(t, bedId2.String(), res2EntityEvent.GetAggregateId())) + requireTrue(t, assert.Equal(t, bedID2.String(), res2EntityEvent.GetAggregateId())) requireTrue(t, assert.Equal(t, "BED_CREATED_v1", res2EntityEvent.GetEventType())) }() // store event if err := eventstoredb.SaveEntityEventForAggregate(ctx, es, bedAggregate, - &pbEventsV1.BedCreatedEvent{Id: bedId.String()}, + &pbEventsV1.BedCreatedEvent{Id: bedID.String()}, ); err != nil { require.NoError(t, err) } diff --git a/services/user-svc/internal/hwkc/client.go b/services/user-svc/internal/hwkc/client.go index a72ea7beb..dabc62216 100644 --- a/services/user-svc/internal/hwkc/client.go +++ b/services/user-svc/internal/hwkc/client.go @@ -35,7 +35,7 @@ type Client struct { func NewClientFromEnv(ctx context.Context) (*Client, error) { clientSecret := hwutil.MustGetEnv("OAUTH_KC_CLIENT_SECRET") realm := hwutil.GetEnvOr("OAUTH_KC_REALM", "helpwave") - return NewClient(ctx, realm, auth.GetOAuthIssuerUrl(), auth.GetOAuthClientId(), clientSecret) + return NewClient(ctx, realm, auth.GetOAuthIssuerURL(), auth.GetOAuthClientID(), clientSecret) } func NewClient(ctx context.Context, realm, issuerUrl, clientId, clientSecret string) (*Client, error) { diff --git a/services/user-svc/internal/organization/organization.go b/services/user-svc/internal/organization/organization.go index 1e1e9cb71..28bbfa7c5 100644 --- a/services/user-svc/internal/organization/organization.go +++ b/services/user-svc/internal/organization/organization.go @@ -8,7 +8,7 @@ import ( "fmt" pb "gen/services/user_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "hwlocale" "hwutil" @@ -86,8 +86,8 @@ func (s ServiceServer) GetOrganization( return nil, status.Error(codes.InvalidArgument, err.Error()) } - user := commonPerm.UserFromCtx(ctx) - organizationPerm := commonPerm.Organization(id) + user := commonperm.UserFromCtx(ctx) + organizationPerm := commonperm.Organization(id) check := hwauthz.NewPermissionCheck(user, perm.OrganizationCanUserGet, organizationPerm) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -213,12 +213,12 @@ func GetOrganizationsByUserId( ) // filter out orgs which the requesting user is not allowed to see - requestingUser := commonPerm.UserFromCtx(ctx) + requestingUser := commonperm.UserFromCtx(ctx) checks := hwutil.Map(organizationsResponse, func(o OrganizationWithMembers) hwauthz.PermissionCheck { return hwauthz.NewPermissionCheck( requestingUser, perm.OrganizationCanUserGet, - commonPerm.Organization(o.Organization.ID), + commonperm.Organization(o.Organization.ID), ) }) allowed, err := authz.BulkCheck(ctx, checks) @@ -273,8 +273,8 @@ func (s ServiceServer) UpdateOrganization( ctx context.Context, req *pb.UpdateOrganizationRequest, ) (*pb.UpdateOrganizationResponse, error) { - userPerm := commonPerm.UserFromCtx(ctx) - orgPerm := commonPerm.Organization(uuid.MustParse(req.GetId())) + userPerm := commonperm.UserFromCtx(ctx) + orgPerm := commonperm.Organization(uuid.MustParse(req.GetId())) check := hwauthz.NewPermissionCheck(userPerm, perm.OrganizationCanUserUpdate, orgPerm) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -307,8 +307,8 @@ func (s ServiceServer) DeleteOrganization( ctx context.Context, req *pb.DeleteOrganizationRequest, ) (*pb.DeleteOrganizationResponse, error) { - permUser := commonPerm.UserFromCtx(ctx) - permOrg := commonPerm.Organization(uuid.MustParse(req.GetId())) + permUser := commonperm.UserFromCtx(ctx) + permOrg := commonperm.Organization(uuid.MustParse(req.GetId())) check := hwauthz.NewPermissionCheck(permUser, perm.OrganizationCanUserDelete, permOrg) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -334,7 +334,7 @@ func (s ServiceServer) DeleteOrganization( } // delete from permission graph - if err := s.authz.DeleteObject(ctx, commonPerm.Organization(organizationID)); err != nil { + if err := s.authz.DeleteObject(ctx, commonperm.Organization(organizationID)); err != nil { return nil, fmt.Errorf("could not delete organization from spicedb: %w", err) } @@ -345,8 +345,8 @@ func (s ServiceServer) RemoveMember( ctx context.Context, req *pb.RemoveMemberRequest, ) (*pb.RemoveMemberResponse, error) { - permUser := commonPerm.UserFromCtx(ctx) - permOrg := commonPerm.Organization(uuid.MustParse(req.GetId())) + permUser := commonperm.UserFromCtx(ctx) + permOrg := commonperm.Organization(uuid.MustParse(req.GetId())) check := hwauthz.NewPermissionCheck(permUser, perm.OrganizationCanUserRemoveMember, permOrg) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -378,7 +378,7 @@ func (s ServiceServer) RemoveMember( return nil, err } - deletedUser := commonPerm.User(userID) + deletedUser := commonperm.User(userID) if _, err := s.authz. Delete(hwauthz.NewRelationship(deletedUser, perm.OrganizationMember, permOrg)). Delete(hwauthz.NewRelationship(deletedUser, perm.OrganizationLeader, permOrg)). @@ -403,8 +403,8 @@ func (s ServiceServer) InviteMember( organizationRepo := organization_repo.New(hwdb.GetDB()) // check permissions - permUser := commonPerm.UserFromCtx(ctx) - permOrg := commonPerm.Organization(uuid.MustParse(req.GetOrganizationId())) + permUser := commonperm.UserFromCtx(ctx) + permOrg := commonperm.Organization(uuid.MustParse(req.GetOrganizationId())) check := hwauthz.NewPermissionCheck(permUser, perm.OrganizationCanUserInviteMember, permOrg) if err := s.authz.Must(ctx, check); err != nil { return nil, err @@ -456,9 +456,9 @@ func (s ServiceServer) InviteMember( // for more info in this read the comment in the core spicedb schema file var subj hwauthz.Object = perm.Email(req.Email) if invitation.UserID.Valid { - subj = commonPerm.User(invitation.UserID.UUID) + subj = commonperm.User(invitation.UserID.UUID) } - org := commonPerm.Organization(organizationId) + org := commonperm.Organization(organizationId) resc := perm.Invite(invitation.InvitationID) if _, err := s.authz. Create(hwauthz.NewRelationship(subj, perm.InviteInvitee, resc)). @@ -511,7 +511,7 @@ func (s ServiceServer) GetInvitationsByOrganization( } // filter out invitations where permissions are missing - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) email := perm.Email(claims.Email) checks := make([]hwauthz.PermissionCheck, 0, 2*len(invitations)) @@ -570,7 +570,7 @@ func (s ServiceServer) GetInvitationsByUser( type rowType = organization_repo.GetInvitationsWithOrganizationByUserRow // filter out invitations where permissions are missing - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) email := perm.Email(claims.Email) checks := make([]hwauthz.PermissionCheck, 0, 2*len(invitations)) @@ -621,9 +621,9 @@ func (s ServiceServer) GetMembersByOrganization( } // check permission - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) check := hwauthz.NewPermissionCheck( - user, perm.OrganizationCanUserGetMembers, commonPerm.Organization(organizationID)) + user, perm.OrganizationCanUserGetMembers, commonperm.Organization(organizationID)) if err := s.authz.Must(ctx, check); err != nil { return nil, err } @@ -666,7 +666,7 @@ func (s ServiceServer) AcceptInvitation( } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) email := perm.Email(claims.Email) invite := perm.Invite(invitationId) @@ -745,7 +745,7 @@ func (s ServiceServer) DeclineInvitation( } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) email := perm.Email(claims.Email) invite := perm.Invite(invitationId) @@ -807,7 +807,7 @@ func (s ServiceServer) RevokeInvitation( } // check permissions - user := commonPerm.UserFromCtx(ctx) + user := commonperm.UserFromCtx(ctx) invite := perm.Invite(invitationId) check := hwauthz.NewPermissionCheck(user, perm.InviteCanUserCancel, invite) @@ -939,8 +939,8 @@ func AddUserToOrganization( } // add user to org in spice - permUser := commonPerm.User(userID) - permOrg := commonPerm.Organization(organizationID) + permUser := commonperm.User(userID) + permOrg := commonperm.Organization(organizationID) rel := hwauthz.NewRelationship(permUser, perm.OrganizationLeader, permOrg) backRel := hwauthz.NewRelationship(permOrg, userPerm.UserOrganization, permUser) if _, err := authz.Create(rel).Create(backRel).Commit(ctx); err != nil { diff --git a/services/user-svc/internal/user/user.go b/services/user-svc/internal/user/user.go index dddae2d57..56426a11f 100644 --- a/services/user-svc/internal/user/user.go +++ b/services/user-svc/internal/user/user.go @@ -5,7 +5,7 @@ import ( events "gen/libs/events/v1" pb "gen/services/user_svc/v1" "hwauthz" - "hwauthz/commonPerm" + "hwauthz/commonperm" "hwdb" "user-svc/internal/user/perm" @@ -49,8 +49,8 @@ func (s ServiceServer) ReadPublicProfile( } // check permissions - reqestingUser := commonPerm.UserFromCtx(ctx) - requestedUser := commonPerm.User(userID) + reqestingUser := commonperm.UserFromCtx(ctx) + requestedUser := commonperm.User(userID) check := hwauthz.NewPermissionCheck(reqestingUser, perm.UserCanUserGetPublicProfile, requestedUser) if err := s.authz.Must(ctx, check); err != nil { return nil, err From 1a8b07dc7050092b13ed9c26c6e08d5d7a2505a5 Mon Sep 17 00:00:00 2001 From: Max Baumann Date: Fri, 27 Dec 2024 14:55:23 +0100 Subject: [PATCH 2/8] stylecheck --- services/tasks-svc/internal/bed/bed.go | 18 +-- .../patient_postgres_projection.go | 36 ++--- services/tasks-svc/locale/locale.go | 4 +- services/tasks-svc/stories/BedCRUD_test.go | 30 ++-- .../tasks-svc/stories/PatientCRUD_test.go | 128 +++++++++--------- services/tasks-svc/stories/RoomCRUD_test.go | 8 +- services/tasks-svc/stories/TaskCRUD_test.go | 46 +++---- .../stories/TaskTemplateCRUD_test.go | 24 ++-- services/tasks-svc/stories/WardCRUD_test.go | 20 +-- services/tasks-svc/stories/setup_test.go | 4 +- services/user-svc/internal/hwkc/client.go | 52 +++---- .../user-svc/internal/hwkc/noop_client.go | 4 +- .../internal/organization/organization.go | 50 +++---- services/user-svc/internal/user/user.go | 4 +- 14 files changed, 214 insertions(+), 214 deletions(-) diff --git a/services/tasks-svc/internal/bed/bed.go b/services/tasks-svc/internal/bed/bed.go index 30d0b5984..cbb91b2cb 100644 --- a/services/tasks-svc/internal/bed/bed.go +++ b/services/tasks-svc/internal/bed/bed.go @@ -65,21 +65,21 @@ func (s ServiceServer) CreateBed(ctx context.Context, req *pb.CreateBedRequest) bedRepo := bed_repo.New(hwdb.GetDB()) // parse inputs - roomId, err := uuid.Parse(req.GetRoomId()) + roomID, err := uuid.Parse(req.GetRoomId()) if err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } // check permissions user := commonperm.UserFromCtx(ctx) - check := hwauthz.NewPermissionCheck(user, roomPerm.RoomCanUserCreateBed, roomPerm.Room(roomId)) + check := hwauthz.NewPermissionCheck(user, roomPerm.RoomCanUserCreateBed, roomPerm.Room(roomID)) if err := s.authz.Must(ctx, check); err != nil { return nil, err } // do query bed, err := bedRepo.CreateBed(ctx, bed_repo.CreateBedParams{ - RoomID: roomId, + RoomID: roomID, Name: req.GetName(), }) err = hwdb.Error(ctx, err, @@ -87,12 +87,12 @@ func (s ServiceServer) CreateBed(ctx context.Context, req *pb.CreateBedRequest) return hwerr.NewStatusError(ctx, codes.InvalidArgument, pgErr.Error(), - locale.InvalidRoomIdError(ctx), + locale.InvalidRoomIDError(ctx), &errdetails.BadRequest{ FieldViolations: []*errdetails.BadRequest_FieldViolation{ { Field: "room_id", - Description: hwlocale.Localize(ctx, locale.InvalidRoomIdError(ctx)), + Description: hwlocale.Localize(ctx, locale.InvalidRoomIDError(ctx)), }, }, }) @@ -109,7 +109,7 @@ func (s ServiceServer) CreateBed(ctx context.Context, req *pb.CreateBedRequest) // update permission graph relationship := hwauthz.NewRelationship( - roomPerm.Room(roomId), + roomPerm.Room(roomID), perm.BedRoom, perm.Bed(bed.ID), ) @@ -177,12 +177,12 @@ func (s ServiceServer) GetBedByPatient( ) (*pb.GetBedByPatientResponse, error) { bedRepo := bed_repo.New(hwdb.GetDB()) - patientId, err := uuid.Parse(req.GetPatientId()) + patientID, err := uuid.Parse(req.GetPatientId()) if err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } - result, err := hwdb.Optional(bedRepo.GetBedWithRoomByPatient)(ctx, patientId) + result, err := hwdb.Optional(bedRepo.GetBedWithRoomByPatient)(ctx, patientID) err = hwdb.Error(ctx, err) if err != nil { return nil, err @@ -192,7 +192,7 @@ func (s ServiceServer) GetBedByPatient( user := commonperm.UserFromCtx(ctx) checks := make([]hwauthz.PermissionCheck, 0) checks = append(checks, - hwauthz.NewPermissionCheck(user, patientPerm.PatientCanUserGet, patientPerm.Patient(patientId))) + hwauthz.NewPermissionCheck(user, patientPerm.PatientCanUserGet, patientPerm.Patient(patientID))) if result != nil { checks = append(checks, diff --git a/services/tasks-svc/internal/patient/projections/patientPostgresProjection/patient_postgres_projection.go b/services/tasks-svc/internal/patient/projections/patientPostgresProjection/patient_postgres_projection.go index 558a63ca6..637d334a7 100644 --- a/services/tasks-svc/internal/patient/projections/patientPostgresProjection/patient_postgres_projection.go +++ b/services/tasks-svc/internal/patient/projections/patientPostgresProjection/patient_postgres_projection.go @@ -48,7 +48,7 @@ func (p *Projection) initEventListeners() { } // Event handlers -func (a *Projection) onPatientCreated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPatientCreated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { log := zlog.Ctx(ctx) var payload patientEventsV1.PatientCreatedEvent @@ -67,7 +67,7 @@ func (a *Projection) onPatientCreated(ctx context.Context, evt hwes.Event) (erro } organizationID := *evt.OrganizationID - err = a.patientRepo.CreatePatient(ctx, patient_repo.CreatePatientParams{ + err = p.patientRepo.CreatePatient(ctx, patient_repo.CreatePatientParams{ ID: patientID, HumanReadableIdentifier: payload.HumanReadableIdentifier, Notes: payload.Notes, @@ -83,7 +83,7 @@ func (a *Projection) onPatientCreated(ctx context.Context, evt hwes.Event) (erro return nil, nil } -func (a *Projection) onBedAssigned(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onBedAssigned(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { log := zlog.Ctx(ctx) var payload patientEventsV1.BedAssignedEvent @@ -92,14 +92,14 @@ func (a *Projection) onBedAssigned(ctx context.Context, evt hwes.Event) (error, return err, hwutil.PtrTo(esdb.NackActionPark) } - bedId, err := hwutil.ParseNullUUID(&payload.BedID) + bedID, err := hwutil.ParseNullUUID(&payload.BedID) if err != nil { return err, hwutil.PtrTo(esdb.NackActionPark) } - err = a.patientRepo.UpdatePatientBedId(ctx, patient_repo.UpdatePatientBedIdParams{ + err = p.patientRepo.UpdatePatientBedId(ctx, patient_repo.UpdatePatientBedIdParams{ ID: evt.AggregateID, - BedID: bedId, + BedID: bedID, UpdatedAt: hwdb.TimeToTimestamp(evt.Timestamp), Consistency: int64(evt.GetVersion()), //nolint:gosec }) @@ -110,8 +110,8 @@ func (a *Projection) onBedAssigned(ctx context.Context, evt hwes.Event) (error, return nil, nil } -func (a *Projection) onBedUnassigned(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { - err := a.patientRepo.UpdatePatientBedId(ctx, patient_repo.UpdatePatientBedIdParams{ +func (p *Projection) onBedUnassigned(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { + err := p.patientRepo.UpdatePatientBedId(ctx, patient_repo.UpdatePatientBedIdParams{ ID: evt.AggregateID, BedID: uuid.NullUUID{}, UpdatedAt: hwdb.TimeToTimestamp(evt.Timestamp), @@ -124,8 +124,8 @@ func (a *Projection) onBedUnassigned(ctx context.Context, evt hwes.Event) (error return nil, nil } -func (a *Projection) onPatientDischarged(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { - err := a.patientRepo.UpdatePatient(ctx, patient_repo.UpdatePatientParams{ +func (p *Projection) onPatientDischarged(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { + err := p.patientRepo.UpdatePatient(ctx, patient_repo.UpdatePatientParams{ ID: evt.AggregateID, IsDischarged: hwutil.PtrTo(true), UpdatedAt: hwdb.TimeToTimestamp(evt.Timestamp), @@ -138,7 +138,7 @@ func (a *Projection) onPatientDischarged(ctx context.Context, evt hwes.Event) (e return nil, nil } -func (a *Projection) onNotesUpdated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onNotesUpdated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { log := zlog.Ctx(ctx) var payload patientEventsV1.NotesUpdatedEvent @@ -147,7 +147,7 @@ func (a *Projection) onNotesUpdated(ctx context.Context, evt hwes.Event) (error, return err, hwutil.PtrTo(esdb.NackActionPark) } - err := a.patientRepo.UpdatePatient(ctx, patient_repo.UpdatePatientParams{ + err := p.patientRepo.UpdatePatient(ctx, patient_repo.UpdatePatientParams{ ID: evt.AggregateID, Notes: &payload.Notes, UpdatedAt: hwdb.TimeToTimestamp(evt.Timestamp), @@ -160,7 +160,7 @@ func (a *Projection) onNotesUpdated(ctx context.Context, evt hwes.Event) (error, return nil, nil } -func (a *Projection) onHumanReadableIdentifierUpdated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onHumanReadableIdentifierUpdated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { log := zlog.Ctx(ctx) var payload patientEventsV1.HumanReadableIdentifierUpdatedEvent @@ -169,7 +169,7 @@ func (a *Projection) onHumanReadableIdentifierUpdated(ctx context.Context, evt h return err, hwutil.PtrTo(esdb.NackActionPark) } - err := a.patientRepo.UpdatePatient(ctx, patient_repo.UpdatePatientParams{ + err := p.patientRepo.UpdatePatient(ctx, patient_repo.UpdatePatientParams{ ID: evt.AggregateID, HumanReadableIdentfier: &payload.HumanReadableIdentifier, UpdatedAt: hwdb.TimeToTimestamp(evt.Timestamp), @@ -182,8 +182,8 @@ func (a *Projection) onHumanReadableIdentifierUpdated(ctx context.Context, evt h return nil, nil } -func (a *Projection) onPatientReadmitted(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { - err := a.patientRepo.UpdatePatient(ctx, patient_repo.UpdatePatientParams{ +func (p *Projection) onPatientReadmitted(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { + err := p.patientRepo.UpdatePatient(ctx, patient_repo.UpdatePatientParams{ ID: evt.AggregateID, IsDischarged: hwutil.PtrTo(false), UpdatedAt: hwdb.TimeToTimestamp(evt.Timestamp), @@ -196,8 +196,8 @@ func (a *Projection) onPatientReadmitted(ctx context.Context, evt hwes.Event) (e return nil, nil } -func (a *Projection) onPatientDeleted(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { - err := a.patientRepo.DeletePatient(ctx, evt.AggregateID) +func (p *Projection) onPatientDeleted(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { + err := p.patientRepo.DeletePatient(ctx, evt.AggregateID) if err := hwdb.Error(ctx, err); err != nil { return err, hwutil.PtrTo(esdb.NackActionRetry) } diff --git a/services/tasks-svc/locale/locale.go b/services/tasks-svc/locale/locale.go index d1f83f8f2..14a596aa4 100644 --- a/services/tasks-svc/locale/locale.go +++ b/services/tasks-svc/locale/locale.go @@ -12,9 +12,9 @@ import ( var localeFS embed.FS var lazy = hwlocale.NewLazyLocaleBundle(&localeFS) -func InvalidRoomIdError(ctx context.Context) hwlocale.Locale { +func InvalidRoomIDError(ctx context.Context) hwlocale.Locale { return hwlocale.Locale{ Bundle: lazy.Bundle(ctx), - Config: &i18n.LocalizeConfig{MessageID: "InvalidRoomIdError"}, + Config: &i18n.LocalizeConfig{MessageID: "InvalidRoomIDError"}, } } diff --git a/services/tasks-svc/stories/BedCRUD_test.go b/services/tasks-svc/stories/BedCRUD_test.go index dbd39237b..c966660f7 100644 --- a/services/tasks-svc/stories/BedCRUD_test.go +++ b/services/tasks-svc/stories/BedCRUD_test.go @@ -21,13 +21,13 @@ func TestCreateUpdateGetBed(t *testing.T) { // first, prepare room wardID, _ := prepareWard(t, ctx, "1") - roomId, _ := prepareRoom(t, ctx, wardID, "1") + roomID, _ := prepareRoom(t, ctx, wardID, "1") // // create new bed // createReq := &pb.CreateBedRequest{ - RoomId: roomId, + RoomId: roomID, Name: t.Name() + " bed", } createRes, err := bedClient.CreateBed(ctx, createReq) @@ -82,11 +82,11 @@ func TestGetBedByPatient(t *testing.T) { // first, prepare room wardID, _ := prepareWard(t, ctx, "1") - roomId, roomConsistency := prepareRoom(t, ctx, wardID, "") + roomID, roomConsistency := prepareRoom(t, ctx, wardID, "") // creating two beds - unrelatedBedID, _ := prepareBed(t, ctx, roomId, "unrelated") - patientsBedID, bedConsistency := prepareBed(t, ctx, roomId, "patient") + unrelatedBedID, _ := prepareBed(t, ctx, roomID, "unrelated") + patientsBedID, bedConsistency := prepareBed(t, ctx, roomID, "patient") // create a patient patientID := preparePatient(t, ctx, "") @@ -113,7 +113,7 @@ func TestGetBedByPatient(t *testing.T) { assert.Equal(t, patientsBedID, res.Bed.Id) assert.Equal(t, bedConsistency, res.Bed.Consistency) - assert.Equal(t, roomId, res.Room.Id) + assert.Equal(t, roomID, res.Room.Id) assert.Equal(t, roomConsistency, res.Room.Consistency) } @@ -135,13 +135,13 @@ func TestGetBeds(t *testing.T) { for i, bedSfxs := range suffixMatrix { roomSuffix := strconv.Itoa(i + 1) - roomId, _ := prepareRoom(t, ctx, wardID, roomSuffix) - roomBedsMap[roomId] = make([]string, 0) + roomID, _ := prepareRoom(t, ctx, wardID, roomSuffix) + roomBedsMap[roomID] = make([]string, 0) for _, bedSuffix := range bedSfxs { - bedId, bedConsistency := prepareBed(t, ctx, roomId, bedSuffix) - bedRoomMap[bedId] = roomId - bedConsistencyMap[bedId] = bedConsistency - roomBedsMap[roomId] = append(roomBedsMap[roomId], bedId) + bedID, bedConsistency := prepareBed(t, ctx, roomID, bedSuffix) + bedRoomMap[bedID] = roomID + bedConsistencyMap[bedID] = bedConsistency + roomBedsMap[roomID] = append(roomBedsMap[roomID], bedID) } } @@ -165,8 +165,8 @@ func TestGetBeds(t *testing.T) { // Part 2: GetBedsByRoom - for roomId, expectedBedIDs := range roomBedsMap { - res, err := bedClient.GetBedsByRoom(ctx, &pb.GetBedsByRoomRequest{RoomId: roomId}) + for roomID, expectedBedIDs := range roomBedsMap { + res, err := bedClient.GetBedsByRoom(ctx, &pb.GetBedsByRoomRequest{RoomId: roomID}) require.NoError(t, err, "could not get beds for room 1") assert.Len(t, res.Beds, len(expectedBedIDs)) @@ -174,6 +174,6 @@ func TestGetBeds(t *testing.T) { bedIds := hwutil.Map(res.Beds, func(bed *pb.GetBedsByRoomResponse_Bed) string { return bed.Id }) - assert.Subset(t, expectedBedIDs, bedIds, "actual bedIDs are not a subset of expected for room %s", roomId) + assert.Subset(t, expectedBedIDs, bedIds, "actual bedIDs are not a subset of expected for room %s", roomID) } } diff --git a/services/tasks-svc/stories/PatientCRUD_test.go b/services/tasks-svc/stories/PatientCRUD_test.go index 0ef9460e3..0dc970b1f 100644 --- a/services/tasks-svc/stories/PatientCRUD_test.go +++ b/services/tasks-svc/stories/PatientCRUD_test.go @@ -36,13 +36,13 @@ func TestCreateUpdateGetPatient(t *testing.T) { hwtesting.WaitForProjectionsToSettle() - patientId := createRes.GetId() + patientID := createRes.GetId() // // get new patient // - getPatientRes, err := patientClient.GetPatient(ctx, &pb.GetPatientRequest{Id: patientId}) + getPatientRes, err := patientClient.GetPatient(ctx, &pb.GetPatientRequest{Id: patientID}) require.NoError(t, err, "could not get after creation") assert.Equal(t, createReq.GetHumanReadableIdentifier(), getPatientRes.GetHumanReadableIdentifier()) @@ -54,7 +54,7 @@ func TestCreateUpdateGetPatient(t *testing.T) { // updateReq := &pb.UpdatePatientRequest{ - Id: patientId, + Id: patientID, HumanReadableIdentifier: hwutil.PtrTo(t.Name() + " patient 1"), Consistency: &getPatientRes.Consistency, } @@ -67,7 +67,7 @@ func TestCreateUpdateGetPatient(t *testing.T) { // get updated patient // - getPatientRes, err = patientClient.GetPatient(ctx, &pb.GetPatientRequest{Id: patientId}) + getPatientRes, err = patientClient.GetPatient(ctx, &pb.GetPatientRequest{Id: patientID}) require.NoError(t, err, "could not get after update") assert.Equal(t, updateReq.GetHumanReadableIdentifier(), getPatientRes.GetHumanReadableIdentifier()) @@ -77,7 +77,7 @@ func TestCreateUpdateGetPatient(t *testing.T) { // discharge patient // - dischargeRes, err := patientClient.DischargePatient(ctx, &pb.DischargePatientRequest{Id: patientId}) + dischargeRes, err := patientClient.DischargePatient(ctx, &pb.DischargePatientRequest{Id: patientID}) require.NoError(t, err) assert.NotEqual(t, getPatientRes.Consistency, dischargeRes.Consistency) @@ -87,7 +87,7 @@ func TestCreateUpdateGetPatient(t *testing.T) { // get discharged patient // - getPatientDetailsRes, err := patientClient.GetPatientDetails(ctx, &pb.GetPatientDetailsRequest{Id: patientId}) + getPatientDetailsRes, err := patientClient.GetPatientDetails(ctx, &pb.GetPatientDetailsRequest{Id: patientID}) require.NoError(t, err, "could not get after discharge") assert.True(t, getPatientDetailsRes.IsDischarged) @@ -97,7 +97,7 @@ func TestCreateUpdateGetPatient(t *testing.T) { // re-admit patient // - readmitRes, err := patientClient.ReadmitPatient(ctx, &pb.ReadmitPatientRequest{PatientId: patientId}) + readmitRes, err := patientClient.ReadmitPatient(ctx, &pb.ReadmitPatientRequest{PatientId: patientID}) require.NoError(t, err) assert.NotEqual(t, getPatientRes.Consistency, readmitRes.Consistency) @@ -105,7 +105,7 @@ func TestCreateUpdateGetPatient(t *testing.T) { // get re-admitted patient // - getPatientDetailsRes, err = patientClient.GetPatientDetails(ctx, &pb.GetPatientDetailsRequest{Id: patientId}) + getPatientDetailsRes, err = patientClient.GetPatientDetails(ctx, &pb.GetPatientDetailsRequest{Id: patientID}) require.NoError(t, err, "could not get after re-admit") assert.False(t, getPatientDetailsRes.IsDischarged) @@ -116,12 +116,12 @@ func TestCreateUpdateGetPatient(t *testing.T) { // wardID, _ := prepareWard(t, ctx, "") - roomId, _ := prepareRoom(t, ctx, wardID, "") - bedId, _ := prepareBed(t, ctx, roomId, "") + roomID, _ := prepareRoom(t, ctx, wardID, "") + bedID, _ := prepareBed(t, ctx, roomID, "") assignRes, err := patientClient.AssignBed(ctx, &pb.AssignBedRequest{ - Id: patientId, - BedId: bedId, + Id: patientID, + BedId: bedID, Consistency: &getPatientRes.Consistency, }) require.NoError(t, err) @@ -131,16 +131,16 @@ func TestCreateUpdateGetPatient(t *testing.T) { // get assigned patient // - getPatientRes, err = patientClient.GetPatient(ctx, &pb.GetPatientRequest{Id: patientId}) + getPatientRes, err = patientClient.GetPatient(ctx, &pb.GetPatientRequest{Id: patientID}) require.NoError(t, err, "could not get after bed assignment") zlog.Debug().Interface("patient", getPatientRes).Msg("patient") assert.NotNil(t, getPatientRes.Bed) - assert.Equal(t, bedId, getPatientRes.Bed.Id) + assert.Equal(t, bedID, getPatientRes.Bed.Id) assert.NotNil(t, getPatientRes.Room) - assert.Equal(t, roomId, getPatientRes.Room.Id) + assert.Equal(t, roomID, getPatientRes.Room.Id) assert.Equal(t, wardID, getPatientRes.Room.WardId) assert.Equal(t, assignRes.Consistency, getPatientRes.Consistency) @@ -150,7 +150,7 @@ func TestCreateUpdateGetPatient(t *testing.T) { // unassignRes, err := patientClient.UnassignBed(ctx, &pb.UnassignBedRequest{ - Id: patientId, + Id: patientID, Consistency: &getPatientRes.Consistency, }) require.NoError(t, err) @@ -160,7 +160,7 @@ func TestCreateUpdateGetPatient(t *testing.T) { // get unassigned patient // - getPatientRes, err = patientClient.GetPatient(ctx, &pb.GetPatientRequest{Id: patientId}) + getPatientRes, err = patientClient.GetPatient(ctx, &pb.GetPatientRequest{Id: patientID}) require.NoError(t, err, "could not get after bed assignment") zlog.Debug().Interface("patient", getPatientRes).Msg("patient") @@ -181,8 +181,8 @@ func TestGetPatientByBed(t *testing.T) { // wardID, _ := prepareWard(t, ctx, "") - roomId, _ := prepareRoom(t, ctx, wardID, "") - bedId, _ := prepareBed(t, ctx, roomId, "") + roomID, _ := prepareRoom(t, ctx, wardID, "") + bedID, _ := prepareBed(t, ctx, roomID, "") createReq := &pb.CreatePatientRequest{ HumanReadableIdentifier: t.Name() + " patient", @@ -191,11 +191,11 @@ func TestGetPatientByBed(t *testing.T) { createRes, err := patientClient.CreatePatient(ctx, createReq) require.NoError(t, err, "could not create patient") - patientId := createRes.GetId() + patientID := createRes.GetId() assRes, err := patientClient.AssignBed(ctx, &pb.AssignBedRequest{ - Id: patientId, - BedId: bedId, + Id: patientID, + BedId: bedID, Consistency: &createRes.Consistency, }) require.NoError(t, err) @@ -205,12 +205,12 @@ func TestGetPatientByBed(t *testing.T) { // getRes, err := patientClient.GetPatientByBed(ctx, &pb.GetPatientByBedRequest{ - BedId: bedId, + BedId: bedID, }) require.NoError(t, err) assert.Equal(t, createRes.Id, getRes.Id) - assert.Equal(t, bedId, getRes.BedId) + assert.Equal(t, bedID, getRes.BedId) assert.Equal(t, createReq.GetHumanReadableIdentifier(), getRes.GetHumanReadableIdentifier()) assert.Equal(t, createReq.GetNotes(), getRes.GetNotes()) assert.Equal(t, assRes.GetConsistency(), getRes.GetConsistency()) @@ -226,9 +226,9 @@ func TestGetPatientsByWard(t *testing.T) { // wardID, _ := prepareWard(t, ctx, "") - roomId, _ := prepareRoom(t, ctx, wardID, "") - bedId1, _ := prepareBed(t, ctx, roomId, "1") - bedId2, _ := prepareBed(t, ctx, roomId, "2") + roomID, _ := prepareRoom(t, ctx, wardID, "") + bedID1, _ := prepareBed(t, ctx, roomID, "1") + bedID2, _ := prepareBed(t, ctx, roomID, "2") createReq1 := &pb.CreatePatientRequest{ HumanReadableIdentifier: t.Name() + " patient 1", @@ -237,12 +237,12 @@ func TestGetPatientsByWard(t *testing.T) { createRes1, err := patientClient.CreatePatient(ctx, createReq1) require.NoError(t, err, "could not create patient") - patientId1 := createRes1.GetId() + patientID1 := createRes1.GetId() hwtesting.WaitForProjectionsToSettle() assRes1, err := patientClient.AssignBed(ctx, &pb.AssignBedRequest{ - Id: patientId1, - BedId: bedId1, + Id: patientID1, + BedId: bedID1, Consistency: &createRes1.Consistency, }) require.NoError(t, err) @@ -257,11 +257,11 @@ func TestGetPatientsByWard(t *testing.T) { hwtesting.WaitForProjectionsToSettle() - patientId2 := createRes2.GetId() + patientID2 := createRes2.GetId() assRes2, err := patientClient.AssignBed(ctx, &pb.AssignBedRequest{ - Id: patientId2, - BedId: bedId2, + Id: patientID2, + BedId: bedID2, Consistency: &createRes2.Consistency, }) require.NoError(t, err) @@ -286,13 +286,13 @@ func TestGetPatientsByWard(t *testing.T) { } assert.Equal(t, createRes1.Id, patient1.Id) - assert.Equal(t, &bedId1, patient1.BedId) + assert.Equal(t, &bedID1, patient1.BedId) assert.Equal(t, createReq1.HumanReadableIdentifier, patient1.HumanReadableIdentifier) assert.Equal(t, *createReq1.Notes, patient1.Notes) assert.Equal(t, assRes1.Consistency, patient1.Consistency) assert.Equal(t, createRes2.Id, patient2.Id) - assert.Equal(t, &bedId2, patient2.BedId) + assert.Equal(t, &bedID2, patient2.BedId) assert.Equal(t, createReq2.HumanReadableIdentifier, patient2.HumanReadableIdentifier) assert.Equal(t, *createReq2.Notes, patient2.Notes) assert.Equal(t, assRes2.Consistency, patient2.Consistency) @@ -321,24 +321,24 @@ func TestGetPatientAssignmentByWard(t *testing.T) { for i, bedSfxs := range suffixMatrix { roomSuffix := strconv.Itoa(i + 1) - roomId, roomConsistency := prepareRoom(t, ctx, wardID, roomSuffix) - roomIds = append(roomIds, roomId) - roomConsistencies[roomId] = roomConsistency - bedsForRoom[roomId] = make([]string, 0) + roomID, roomConsistency := prepareRoom(t, ctx, wardID, roomSuffix) + roomIds = append(roomIds, roomID) + roomConsistencies[roomID] = roomConsistency + bedsForRoom[roomID] = make([]string, 0) for _, bedSuffix := range bedSfxs { - bedId, bedConsistency := prepareBed(t, ctx, roomId, bedSuffix) - bedConsistencies[bedId] = bedConsistency - bedsForRoom[roomId] = append(bedsForRoom[roomId], bedId) + bedID, bedConsistency := prepareBed(t, ctx, roomID, bedSuffix) + bedConsistencies[bedID] = bedConsistency + bedsForRoom[roomID] = append(bedsForRoom[roomID], bedID) - patientId := preparePatient(t, ctx, bedSuffix) + patientID := preparePatient(t, ctx, bedSuffix) res, err := patientClient.AssignBed(ctx, &pb.AssignBedRequest{ - Id: patientId, - BedId: bedId, + Id: patientID, + BedId: bedID, }) require.NoError(t, err) - patientConsistencies[patientId] = res.Consistency - patientForBed[bedId] = patientId + patientConsistencies[patientID] = res.Consistency + patientForBed[bedID] = patientID } } @@ -545,8 +545,8 @@ func TestGetPatientDetails(t *testing.T) { // wardID, _ := prepareWard(t, ctx, "") - roomId, _ := prepareRoom(t, ctx, wardID, "") - bedId, _ := prepareBed(t, ctx, roomId, "") + roomID, _ := prepareRoom(t, ctx, wardID, "") + bedID, _ := prepareBed(t, ctx, roomID, "") createReq := &pb.CreatePatientRequest{ HumanReadableIdentifier: t.Name() + " patient", @@ -557,11 +557,11 @@ func TestGetPatientDetails(t *testing.T) { hwtesting.WaitForProjectionsToSettle() - patientId := createRes.GetId() + patientID := createRes.GetId() assRes, err := patientClient.AssignBed(ctx, &pb.AssignBedRequest{ - Id: patientId, - BedId: bedId, + Id: patientID, + BedId: bedID, Consistency: &createRes.Consistency, }) require.NoError(t, err) @@ -591,7 +591,7 @@ func TestGetPatientDetails(t *testing.T) { taskRes, err := taskClient.CreateTask(ctx, &pb.CreateTaskRequest{ Name: t.Name() + " task " + taskSuffix, Description: nil, - PatientId: patientId, + PatientId: patientID, Public: hwutil.PtrTo(true), DueAt: nil, // behold: peak enginering: @@ -612,7 +612,7 @@ func TestGetPatientDetails(t *testing.T) { // getRes, err := patientClient.GetPatientDetails(ctx, &pb.GetPatientDetailsRequest{ - Id: patientId, + Id: patientID, }) require.NoError(t, err) @@ -634,8 +634,8 @@ func TestGetPatientDetails(t *testing.T) { return tsk.Id })) - assert.Equal(t, roomId, getRes.GetRoom().GetId()) - assert.Equal(t, bedId, getRes.GetBed().GetId()) + assert.Equal(t, roomID, getRes.GetRoom().GetId()) + assert.Equal(t, bedID, getRes.GetBed().GetId()) assert.False(t, getRes.GetIsDischarged()) assert.Equal(t, assRes.GetConsistency(), getRes.GetConsistency()) } @@ -655,9 +655,9 @@ func TestGetRecentPatients(t *testing.T) { patientClient := pb.NewPatientServiceClient(hwtesting.GetGrpcConn(userID.String())) wardID, _ := prepareWard(t, ctx, "") - roomId, roomConsistency := prepareRoom(t, ctx, wardID, "") - bedId, bedConsitency := prepareBed(t, ctx, roomId, "") - patientWithBedId := "" + roomID, roomConsistency := prepareRoom(t, ctx, wardID, "") + bedID, bedConsitency := prepareBed(t, ctx, roomID, "") + patientWithBedID := "" N := 11 // cap is ten @@ -677,11 +677,11 @@ func TestGetRecentPatients(t *testing.T) { if i == N { assRes, err := patientClient.AssignBed(ctx, &pb.AssignBedRequest{ Id: patientRes.Id, - BedId: bedId, + BedId: bedID, Consistency: &patientRes.Consistency, }) require.NoError(t, err) - patientWithBedId = patientRes.Id + patientWithBedID = patientRes.Id consistencies[patientRes.Id] = assRes.Consistency } @@ -698,10 +698,10 @@ func TestGetRecentPatients(t *testing.T) { assert.Len(t, recent.RecentPatients, 10) foundIds := hwutil.Map(recent.RecentPatients, func(p *pb.GetRecentPatientsResponse_Patient) string { id := p.Id - if id == patientWithBedId { - assert.Equal(t, bedId, p.Bed.Id) + if id == patientWithBedID { + assert.Equal(t, bedID, p.Bed.Id) assert.Equal(t, bedConsitency, p.Bed.Consistency) - assert.Equal(t, roomId, p.Room.Id) + assert.Equal(t, roomID, p.Room.Id) assert.Equal(t, roomConsistency, p.Room.Consistency) } assert.Equal(t, consistencies[p.Id], p.Consistency) diff --git a/services/tasks-svc/stories/RoomCRUD_test.go b/services/tasks-svc/stories/RoomCRUD_test.go index cd9721cdd..04a20ca9e 100644 --- a/services/tasks-svc/stories/RoomCRUD_test.go +++ b/services/tasks-svc/stories/RoomCRUD_test.go @@ -93,10 +93,10 @@ func TestGetRooms(t *testing.T) { wardID, _ := prepareWard(t, ctx, wardSuffix) wardRoomsMap[wardID] = make([]string, 0) for _, bedSuffix := range roomSfxs { - roomId, roomConsistency := prepareRoom(t, ctx, wardID, bedSuffix) - roomWardMap[roomId] = wardID - roomConsistencyMap[roomId] = roomConsistency - wardRoomsMap[wardID] = append(wardRoomsMap[wardID], roomId) + roomID, roomConsistency := prepareRoom(t, ctx, wardID, bedSuffix) + roomWardMap[roomID] = wardID + roomConsistencyMap[roomID] = roomConsistency + wardRoomsMap[wardID] = append(wardRoomsMap[wardID], roomID) } } diff --git a/services/tasks-svc/stories/TaskCRUD_test.go b/services/tasks-svc/stories/TaskCRUD_test.go index 02508b62c..a5b647284 100644 --- a/services/tasks-svc/stories/TaskCRUD_test.go +++ b/services/tasks-svc/stories/TaskCRUD_test.go @@ -23,7 +23,7 @@ func TestCreateUpdateGetTask(t *testing.T) { taskClient := taskServiceClient() // prepare patient - patientId := preparePatient(t, ctx, "") + patientID := preparePatient(t, ctx, "") dueDate := time.Now().Add(time.Hour).UTC() @@ -37,7 +37,7 @@ func TestCreateUpdateGetTask(t *testing.T) { createReq := &pb.CreateTaskRequest{ Name: t.Name() + " task", Description: hwutil.PtrTo("Some Description"), - PatientId: patientId, + PatientId: patientID, Public: hwutil.PtrTo(true), DueAt: timestamppb.New(dueDate), InitialStatus: nil, @@ -51,13 +51,13 @@ func TestCreateUpdateGetTask(t *testing.T) { require.NoError(t, err, "could not create") - taskId := createRes.GetId() + taskID := createRes.GetId() hwtesting.WaitForProjectionsToSettle() // get new task - task, err := taskClient.GetTask(ctx, &pb.GetTaskRequest{Id: taskId}) + task, err := taskClient.GetTask(ctx, &pb.GetTaskRequest{Id: taskID}) require.NoError(t, err) assert.Equal(t, createReq.GetName(), task.GetName()) @@ -69,7 +69,7 @@ func TestCreateUpdateGetTask(t *testing.T) { assert.WithinDuration(t, dueDate, task.GetDueAt().AsTime(), time.Second) // actually we differ by some microseconds assert.Equal(t, "", task.GetAssignedUserId()) - assert.Equal(t, patientId, task.GetPatient().GetId()) + assert.Equal(t, patientID, task.GetPatient().GetId()) assert.Len(t, task.GetSubtasks(), 2) found := 0 @@ -94,7 +94,7 @@ func TestCreateUpdateGetTask(t *testing.T) { // updateReq := &pb.UpdateTaskRequest{ - Id: taskId, + Id: taskID, Name: hwutil.PtrTo("New Name"), Description: nil, DueAt: nil, @@ -111,7 +111,7 @@ func TestCreateUpdateGetTask(t *testing.T) { // get updated task - task, err = taskClient.GetTask(ctx, &pb.GetTaskRequest{Id: taskId}) + task, err = taskClient.GetTask(ctx, &pb.GetTaskRequest{Id: taskID}) require.NoError(t, err) assert.Equal(t, updateReq.GetName(), task.GetName()) @@ -123,7 +123,7 @@ func TestCreateUpdateGetTask(t *testing.T) { // createStRes, err := taskClient.CreateSubtask(ctx, &pb.CreateSubtaskRequest{ - TaskId: taskId, + TaskId: taskID, Subtask: &pb.CreateSubtaskRequest_Subtask{ Name: "ST 3", }, @@ -135,7 +135,7 @@ func TestCreateUpdateGetTask(t *testing.T) { // get updated task - task, err = taskClient.GetTask(ctx, &pb.GetTaskRequest{Id: taskId}) + task, err = taskClient.GetTask(ctx, &pb.GetTaskRequest{Id: taskID}) require.NoError(t, err) assert.Len(t, task.GetSubtasks(), 3) @@ -157,7 +157,7 @@ func TestCreateUpdateGetTask(t *testing.T) { // update subtask updateStRes, err := taskClient.UpdateSubtask(ctx, &pb.UpdateSubtaskRequest{ - TaskId: taskId, + TaskId: taskID, SubtaskId: createStRes.GetSubtaskId(), Subtask: &pb.UpdateSubtaskRequest_Subtask{ Done: hwutil.PtrTo(true), @@ -170,7 +170,7 @@ func TestCreateUpdateGetTask(t *testing.T) { // get updated task - task, err = taskClient.GetTask(ctx, &pb.GetTaskRequest{Id: taskId}) + task, err = taskClient.GetTask(ctx, &pb.GetTaskRequest{Id: taskID}) require.NoError(t, err) assert.Contains(t, hwutil.Map(task.Subtasks, func(st *pb.GetTaskResponse_SubTask) string { @@ -188,7 +188,7 @@ func TestCreateUpdateGetTask(t *testing.T) { assignedUser := uuid.New() assignRes, err := taskClient.AssignTask(ctx, &pb.AssignTaskRequest{ - TaskId: taskId, + TaskId: taskID, UserId: assignedUser.String(), Consistency: &task.Consistency, }) @@ -199,7 +199,7 @@ func TestCreateUpdateGetTask(t *testing.T) { // get updated task - task, err = taskClient.GetTask(ctx, &pb.GetTaskRequest{Id: taskId}) + task, err = taskClient.GetTask(ctx, &pb.GetTaskRequest{Id: taskID}) require.NoError(t, err) assert.Equal(t, assignedUser.String(), task.GetAssignedUserId()) @@ -210,7 +210,7 @@ func TestCreateUpdateGetTask(t *testing.T) { // unassignRes, err := taskClient.UnassignTask(ctx, &pb.UnassignTaskRequest{ - TaskId: taskId, + TaskId: taskID, UserId: assignedUser.String(), Consistency: &task.Consistency, }) @@ -221,7 +221,7 @@ func TestCreateUpdateGetTask(t *testing.T) { // get updated task - task, err = taskClient.GetTask(ctx, &pb.GetTaskRequest{Id: taskId}) + task, err = taskClient.GetTask(ctx, &pb.GetTaskRequest{Id: taskID}) require.NoError(t, err) assert.Equal(t, "", task.GetAssignedUserId()) @@ -232,7 +232,7 @@ func TestCreateUpdateGetTask(t *testing.T) { // rmDueRes, err := taskClient.RemoveTaskDueDate(ctx, &pb.RemoveTaskDueDateRequest{ - TaskId: taskId, + TaskId: taskID, }) require.NoError(t, err) @@ -241,7 +241,7 @@ func TestCreateUpdateGetTask(t *testing.T) { // get updated task - task, err = taskClient.GetTask(ctx, &pb.GetTaskRequest{Id: taskId}) + task, err = taskClient.GetTask(ctx, &pb.GetTaskRequest{Id: taskID}) require.NoError(t, err) assert.Nil(t, task.GetDueAt()) @@ -252,7 +252,7 @@ func TestGetTasksByPatient(t *testing.T) { taskClient := taskServiceClient() ctx := context.Background() - patientId := preparePatient(t, ctx, "") + patientID := preparePatient(t, ctx, "") suffixMap := [][]string{ {"1 A", "1 B", "1 C"}, // Task 1 @@ -276,7 +276,7 @@ func TestGetTasksByPatient(t *testing.T) { taskRes, err := taskClient.CreateTask(ctx, &pb.CreateTaskRequest{ Name: t.Name() + " task " + taskSuffix, Description: nil, - PatientId: patientId, + PatientId: patientID, Public: hwutil.PtrTo(true), DueAt: nil, // behold: peak enginering: @@ -292,7 +292,7 @@ func TestGetTasksByPatient(t *testing.T) { hwtesting.WaitForProjectionsToSettle() - res, err := taskClient.GetTasksByPatient(ctx, &pb.GetTasksByPatientRequest{PatientId: patientId}) + res, err := taskClient.GetTasksByPatient(ctx, &pb.GetTasksByPatientRequest{PatientId: patientID}) require.NoError(t, err) assert.Len(t, res.Tasks, len(suffixMap)) @@ -313,7 +313,7 @@ func TestGetTasksByPatient(t *testing.T) { // GetTasksByPatientSortedByStatus resByStatus, err := taskClient.GetTasksByPatientSortedByStatus(ctx, &pb.GetTasksByPatientSortedByStatusRequest{ - PatientId: patientId, + PatientId: patientID, }) require.NoError(t, err) @@ -337,7 +337,7 @@ func TestGetAssignedTasks(t *testing.T) { taskClient := taskServiceClient() ctx := context.Background() - patientId := preparePatient(t, ctx, "") + patientID := preparePatient(t, ctx, "") suffixMap := [][]string{ {"1 A", "1 B", "1 C"}, // Task 1 @@ -370,7 +370,7 @@ func TestGetAssignedTasks(t *testing.T) { taskRes, err := taskClient.CreateTask(ctx, &pb.CreateTaskRequest{ Name: t.Name() + " task " + taskSuffix, Description: nil, - PatientId: patientId, + PatientId: patientID, Public: hwutil.PtrTo(true), DueAt: nil, // behold: peak enginering: diff --git a/services/tasks-svc/stories/TaskTemplateCRUD_test.go b/services/tasks-svc/stories/TaskTemplateCRUD_test.go index 083e27138..208951859 100644 --- a/services/tasks-svc/stories/TaskTemplateCRUD_test.go +++ b/services/tasks-svc/stories/TaskTemplateCRUD_test.go @@ -36,14 +36,14 @@ func TestCreateUpdateGetTaskTemplate(t *testing.T) { wardRes, err := wardServiceClient.CreateWard(ctx, createWardReq) require.NoError(t, err, "could not create ward") - // wardId will be used for scoping - wardId := wardRes.GetId() + // wardID will be used for scoping + wardID := wardRes.GetId() // // create new template // createReq := &pb.CreateTaskTemplateRequest{ - WardId: &wardId, + WardId: &wardID, Description: hwutil.PtrTo("Some Description"), Subtasks: make([]*pb.CreateTaskTemplateRequest_SubTask, 0), Name: t.Name() + " tt", @@ -52,7 +52,7 @@ func TestCreateUpdateGetTaskTemplate(t *testing.T) { require.NoError(t, err, "could not create task template") - templateId := createRes.GetId() + templateID := createRes.GetId() hwtesting.WaitForProjectionsToSettle() @@ -60,7 +60,7 @@ func TestCreateUpdateGetTaskTemplate(t *testing.T) { // get new template // - template := getTaskTemplate(t, ctx, templateId) + template := getTaskTemplate(t, ctx, templateID) assert.Equal(t, createReq.Name, template.Name) assert.Equal(t, *createReq.Description, template.Description) @@ -73,7 +73,7 @@ func TestCreateUpdateGetTaskTemplate(t *testing.T) { // updateReq := &pb.UpdateTaskTemplateRequest{ - Id: templateId, + Id: templateID, Name: hwutil.PtrTo("New Name"), Description: nil, Consistency: &createRes.Consistency, @@ -89,7 +89,7 @@ func TestCreateUpdateGetTaskTemplate(t *testing.T) { // get updated template // - template = getTaskTemplate(t, ctx, templateId) + template = getTaskTemplate(t, ctx, templateID) assert.Equal(t, *updateReq.Name, template.Name) assert.Equal(t, updateRes.Consistency, template.Consistency) @@ -99,7 +99,7 @@ func TestCreateUpdateGetTaskTemplate(t *testing.T) { // createStRes, err := taskTemplateClient.CreateTaskTemplateSubTask(ctx, &pb.CreateTaskTemplateSubTaskRequest{ - TaskTemplateId: templateId, + TaskTemplateId: templateID, Name: t.Name() + " ST 1", }) require.NoError(t, err) @@ -109,7 +109,7 @@ func TestCreateUpdateGetTaskTemplate(t *testing.T) { // get updated template // - template = getTaskTemplate(t, ctx, templateId) + template = getTaskTemplate(t, ctx, templateID) assert.Len(t, template.Subtasks, 1) assert.Equal(t, createStRes.Id, template.Subtasks[0].Id) @@ -130,7 +130,7 @@ func TestCreateUpdateGetTaskTemplate(t *testing.T) { // get updated template // - template = getTaskTemplate(t, ctx, templateId) + template = getTaskTemplate(t, ctx, templateID) assert.Len(t, template.Subtasks, 1) assert.Equal(t, createStRes.Id, template.Subtasks[0].Id) @@ -141,7 +141,7 @@ func TestCreateUpdateGetTaskTemplate(t *testing.T) { // create another template // createReq = &pb.CreateTaskTemplateRequest{ - WardId: &wardId, + WardId: &wardID, Description: hwutil.PtrTo("Some Description"), Subtasks: make([]*pb.CreateTaskTemplateRequest_SubTask, 0), Name: t.Name() + " tt", @@ -155,7 +155,7 @@ func TestCreateUpdateGetTaskTemplate(t *testing.T) { // templates, err := taskTemplateClient.GetAllTaskTemplates(ctx, &pb.GetAllTaskTemplatesRequest{ - WardId: &wardId, + WardId: &wardID, }) require.NoError(t, err) diff --git a/services/tasks-svc/stories/WardCRUD_test.go b/services/tasks-svc/stories/WardCRUD_test.go index 971e2f2ce..380b4c4ab 100644 --- a/services/tasks-svc/stories/WardCRUD_test.go +++ b/services/tasks-svc/stories/WardCRUD_test.go @@ -121,13 +121,13 @@ func TestGetRecentWards(t *testing.T) { } for i, bedSfxs := range suffixMatrix { roomSuffix := strconv.Itoa(i + 1) - roomId, _ := prepareRoom(t, ctx, taskCountWardID, roomSuffix) + roomID, _ := prepareRoom(t, ctx, taskCountWardID, roomSuffix) for j, bedSuffix := range bedSfxs { - bedId, _ := prepareBed(t, ctx, roomId, bedSuffix) + bedID, _ := prepareBed(t, ctx, roomID, bedSuffix) patientID := preparePatient(t, ctx, bedSuffix) _, err := patientClient.AssignBed(ctx, &pb.AssignBedRequest{ Id: patientID, - BedId: bedId, + BedId: bedID, }) require.NoError(t, err, "could not assign bed to patient") _, err = taskClient.CreateTask(ctx, &pb.CreateTaskRequest{ @@ -229,13 +229,13 @@ func TestGetWardOverviews(t *testing.T) { for i, bedSfxs := range suffixMatrix { roomSuffix := strconv.Itoa(i + 1) - roomId, _ := prepareRoom(t, ctx, wardID, roomSuffix) + roomID, _ := prepareRoom(t, ctx, wardID, roomSuffix) for j, bedSuffix := range bedSfxs { - bedId, _ := prepareBed(t, ctx, roomId, bedSuffix) + bedID, _ := prepareBed(t, ctx, roomID, bedSuffix) patientID := preparePatient(t, ctx, bedSuffix) _, err := patientClient.AssignBed(ctx, &pb.AssignBedRequest{ Id: patientID, - BedId: bedId, + BedId: bedID, }) require.NoError(t, err, "could not assign bed to patient") _, err = taskClient.CreateTask(ctx, &pb.CreateTaskRequest{ @@ -336,17 +336,17 @@ func TestGetWardDetails(t *testing.T) { rooms := make([]map[string]interface{}, 0) for i, bedSfxs := range suffixMatrix { roomSuffix := strconv.Itoa(i + 1) - roomId, roomConsistency := prepareRoom(t, ctx, wardID, roomSuffix) + roomID, roomConsistency := prepareRoom(t, ctx, wardID, roomSuffix) expectedRoom := map[string]interface{}{ - "id": roomId, + "id": roomID, "name": t.Name() + " room " + roomSuffix, "consistency": roomConsistency, } beds := make([]map[string]interface{}, 0) for _, bedSuffix := range bedSfxs { - bedId, bedConsistency := prepareBed(t, ctx, roomId, bedSuffix) + bedID, bedConsistency := prepareBed(t, ctx, roomID, bedSuffix) beds = append(beds, map[string]interface{}{ - "id": bedId, + "id": bedID, "name": t.Name() + " bed " + bedSuffix, "consistency": bedConsistency, }) diff --git a/services/tasks-svc/stories/setup_test.go b/services/tasks-svc/stories/setup_test.go index b9c2a570e..639a86cb5 100644 --- a/services/tasks-svc/stories/setup_test.go +++ b/services/tasks-svc/stories/setup_test.go @@ -115,11 +115,11 @@ func prepareRoom(t *testing.T, ctx context.Context, wardID, suffix string) (room return roomRes.Id, roomRes.Consistency } -func prepareBed(t *testing.T, ctx context.Context, roomId, suffix string) (bedID, consistency string) { +func prepareBed(t *testing.T, ctx context.Context, roomID, suffix string) (bedID, consistency string) { t.Helper() createRes, err := bedServiceClient().CreateBed(ctx, &pb.CreateBedRequest{ - RoomId: roomId, + RoomId: roomID, Name: t.Name() + " bed " + suffix, }) require.NoError(t, err, "prepareBed: could not create bed", suffix) diff --git a/services/user-svc/internal/hwkc/client.go b/services/user-svc/internal/hwkc/client.go index dabc62216..ff2c49f5c 100644 --- a/services/user-svc/internal/hwkc/client.go +++ b/services/user-svc/internal/hwkc/client.go @@ -17,8 +17,8 @@ import ( ) type IClient interface { - GetUserById(ctx context.Context, userID uuid.UUID) (*User, error) - GetOrganizationsOfUserById(ctx context.Context, userID uuid.UUID) ([]*Organization, error) + GetUserByID(ctx context.Context, userID uuid.UUID) (*User, error) + GetOrganizationsOfUserByID(ctx context.Context, userID uuid.UUID) ([]*Organization, error) CreateOrganization(ctx context.Context, name, displayName string, isPersonal bool) (*Organization, error) UpdateOrganization(ctx context.Context, organizationID uuid.UUID, organization Organization) error DeleteOrganization(ctx context.Context, organizationID uuid.UUID) error @@ -27,8 +27,8 @@ type IClient interface { } type Client struct { - adminApiBaseUrl *url.URL - realmBaseUrl *url.URL + adminAPIBaseURL *url.URL + realmBaseURL *url.URL http *http.Client } @@ -38,14 +38,14 @@ func NewClientFromEnv(ctx context.Context) (*Client, error) { return NewClient(ctx, realm, auth.GetOAuthIssuerURL(), auth.GetOAuthClientID(), clientSecret) } -func NewClient(ctx context.Context, realm, issuerUrl, clientId, clientSecret string) (*Client, error) { - provider, err := oidc.NewProvider(context.Background(), issuerUrl) +func NewClient(ctx context.Context, realm, issuerURL, clientID, clientSecret string) (*Client, error) { + provider, err := oidc.NewProvider(context.Background(), issuerURL) if err != nil { return nil, fmt.Errorf("cannot lookup oidc provider: %w", err) } config := clientcredentials.Config{ - ClientID: clientId, + ClientID: clientID, ClientSecret: clientSecret, TokenURL: provider.Endpoint().TokenURL, } @@ -54,28 +54,28 @@ func NewClient(ctx context.Context, realm, issuerUrl, clientId, clientSecret str return nil, fmt.Errorf("token exchange failed: %w", err) } - parsedIssuerUrl, err := url.Parse(issuerUrl) + parsedIssuerURL, err := url.Parse(issuerURL) if err != nil { - return nil, fmt.Errorf("cannot parse issuer url ('%s'): %w", issuerUrl, err) + return nil, fmt.Errorf("cannot parse issuer url ('%s'): %w", issuerURL, err) } - adminApiBaseUrl, err := url.Parse( - fmt.Sprintf("%s://%s/admin/realms/%s", parsedIssuerUrl.Scheme, parsedIssuerUrl.Host, realm)) + adminAPIBaseURL, err := url.Parse( + fmt.Sprintf("%s://%s/admin/realms/%s", parsedIssuerURL.Scheme, parsedIssuerURL.Host, realm)) if err != nil { return nil, fmt.Errorf( - "cannot parse newly created admin api base url from issuer url ('%s'): %w", issuerUrl, err) + "cannot parse newly created admin api base url from issuer url ('%s'): %w", issuerURL, err) } - realmBaseUrl, err := url.Parse( - fmt.Sprintf("%s://%s/realms/%s", parsedIssuerUrl.Scheme, parsedIssuerUrl.Host, realm)) + realmBaseURL, err := url.Parse( + fmt.Sprintf("%s://%s/realms/%s", parsedIssuerURL.Scheme, parsedIssuerURL.Host, realm)) if err != nil { return nil, fmt.Errorf( - "cannot parse newly created admin api base url from issuer url ('%s'): %w", issuerUrl, err) + "cannot parse newly created admin api base url from issuer url ('%s'): %w", issuerURL, err) } client := &Client{ - adminApiBaseUrl: adminApiBaseUrl, - realmBaseUrl: realmBaseUrl, + adminAPIBaseURL: adminAPIBaseURL, + realmBaseURL: realmBaseURL, http: config.Client(ctx), } @@ -92,9 +92,9 @@ func (c *Client) ensureSuccessfulResponse(res *http.Response) error { return BadResponseError{Res: res} } -func (c *Client) GetUserById(ctx context.Context, userID uuid.UUID) (*User, error) { +func (c *Client) GetUserByID(ctx context.Context, userID uuid.UUID) (*User, error) { // https://www.keycloak.org/docs-api/26.0.0/rest-api/index.html#_get_adminrealmsrealmusersuser_id - u := c.adminApiBaseUrl.JoinPath("users", userID.String()) + u := c.adminAPIBaseURL.JoinPath("users", userID.String()) req, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil) if err != nil { @@ -119,9 +119,9 @@ func (c *Client) GetUserById(ctx context.Context, userID uuid.UUID) (*User, erro return user, nil } -func (c *Client) GetOrganizationsOfUserById(ctx context.Context, userID uuid.UUID) ([]*Organization, error) { +func (c *Client) GetOrganizationsOfUserByID(ctx context.Context, userID uuid.UUID) ([]*Organization, error) { // Users -> GET /{realm}/users/{userId}/orgs https://t.ly/cgwOO - u := c.realmBaseUrl.JoinPath("users", userID.String(), "orgs") + u := c.realmBaseURL.JoinPath("users", userID.String(), "orgs") req, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil) if err != nil { @@ -153,7 +153,7 @@ func (c *Client) CreateOrganization( isPersonal bool, ) (*Organization, error) { // Organizations -> POST /{realm}/orgs https://t.ly/cgwOO - u := c.realmBaseUrl.JoinPath("orgs") + u := c.realmBaseURL.JoinPath("orgs") payload := Organization{ Name: hwutil.StrPtr(name), @@ -209,7 +209,7 @@ func (c *Client) CreateOrganization( func (c *Client) UpdateOrganization(ctx context.Context, organizationID uuid.UUID, organization Organization) error { // Organizations -> PUT /{realm}/orgs/{orgId} https://t.ly/cgwOO - u := c.realmBaseUrl.JoinPath("orgs", organizationID.String()) + u := c.realmBaseURL.JoinPath("orgs", organizationID.String()) jsonPayload, err := json.Marshal(organization) if err != nil { @@ -236,7 +236,7 @@ func (c *Client) UpdateOrganization(ctx context.Context, organizationID uuid.UUI func (c *Client) DeleteOrganization(ctx context.Context, organizationID uuid.UUID) error { // Organizations -> DELETE /{realm}/orgs/{orgId} https://t.ly/cgwOO - u := c.realmBaseUrl.JoinPath("orgs", organizationID.String()) + u := c.realmBaseURL.JoinPath("orgs", organizationID.String()) req, err := http.NewRequestWithContext(ctx, http.MethodDelete, u.String(), nil) if err != nil { @@ -258,7 +258,7 @@ func (c *Client) DeleteOrganization(ctx context.Context, organizationID uuid.UUI func (c *Client) AddUserToOrganization(ctx context.Context, userID, organizationID uuid.UUID) error { // Organization Memberships -> PUT /{realm}/orgs/{orgId}/members/{userId} https://t.ly/cgwOO - u := c.realmBaseUrl.JoinPath("orgs", organizationID.String(), "members", userID.String()) + u := c.realmBaseURL.JoinPath("orgs", organizationID.String(), "members", userID.String()) req, err := http.NewRequestWithContext(ctx, http.MethodPut, u.String(), nil) if err != nil { @@ -280,7 +280,7 @@ func (c *Client) AddUserToOrganization(ctx context.Context, userID, organization func (c *Client) RemoveUserFromOrganization(ctx context.Context, userID, organizationID uuid.UUID) error { // Organization Memberships -> DELETE /{realm}/orgs/{orgId}/members/{userId} https://t.ly/R0Suf - u := c.realmBaseUrl.JoinPath("orgs", organizationID.String(), "members", userID.String()) + u := c.realmBaseURL.JoinPath("orgs", organizationID.String(), "members", userID.String()) req, err := http.NewRequestWithContext(ctx, http.MethodDelete, u.String(), nil) if err != nil { diff --git a/services/user-svc/internal/hwkc/noop_client.go b/services/user-svc/internal/hwkc/noop_client.go index 6dff5701c..5e3bdb485 100644 --- a/services/user-svc/internal/hwkc/noop_client.go +++ b/services/user-svc/internal/hwkc/noop_client.go @@ -19,13 +19,13 @@ func NewNoOpClient() *NoOpClient { return &NoOpClient{} } -func (c *NoOpClient) GetUserById(_ context.Context, userID uuid.UUID) (*User, error) { +func (c *NoOpClient) GetUserByID(_ context.Context, userID uuid.UUID) (*User, error) { return &User{ ID: hwutil.PtrTo(userID.String()), }, nil } -func (c *NoOpClient) GetOrganizationsOfUserById(_ context.Context, userID uuid.UUID) ([]*Organization, error) { +func (c *NoOpClient) GetOrganizationsOfUserByID(_ context.Context, _ uuid.UUID) ([]*Organization, error) { return []*Organization{ { ID: hwutil.PtrTo(uuid.NewString()), diff --git a/services/user-svc/internal/organization/organization.go b/services/user-svc/internal/organization/organization.go index 28bbfa7c5..da0bcd905 100644 --- a/services/user-svc/internal/organization/organization.go +++ b/services/user-svc/internal/organization/organization.go @@ -132,7 +132,7 @@ func (s ServiceServer) GetOrganizationsByUser( ) (*pb.GetOrganizationsByUserResponse, error) { userID := uuid.MustParse(req.UserId) - organizations, err := GetOrganizationsByUserId(ctx, userID, s.authz) + organizations, err := GetOrganizationsByUserID(ctx, userID, s.authz) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } @@ -168,12 +168,12 @@ type OrganizationWithMembers struct { Members []organization_repo.User } -func GetOrganizationsByUserId( - ctx context.Context, userId uuid.UUID, authz hwauthz.AuthZ, +func GetOrganizationsByUserID( + ctx context.Context, userID uuid.UUID, authz hwauthz.AuthZ, ) ([]OrganizationWithMembers, error) { organizationRepo := organization_repo.New(hwdb.GetDB()) - rows, err := organizationRepo.GetOrganizationsWithMembersByUser(ctx, userId) + rows, err := organizationRepo.GetOrganizationsWithMembersByUser(ctx, userID) err = hwdb.Error(ctx, err) if err != nil { return nil, err @@ -238,7 +238,7 @@ func (s ServiceServer) GetOrganizationsForUser( ) (*pb.GetOrganizationsForUserResponse, error) { userID := auth.MustGetUserID(ctx) - organizations, err := GetOrganizationsByUserId(ctx, userID, s.authz) + organizations, err := GetOrganizationsByUserID(ctx, userID, s.authz) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } @@ -410,14 +410,14 @@ func (s ServiceServer) InviteMember( return nil, err } - organizationId, err := uuid.Parse(req.OrganizationId) + organizationID, err := uuid.Parse(req.OrganizationId) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } // sanity checks conditions, err := organizationRepo.GetInvitationConditions(ctx, organization_repo.GetInvitationConditionsParams{ - OrganizationID: organizationId, + OrganizationID: organizationID, Email: req.Email, States: []int32{ int32(pb.InvitationState_INVITATION_STATE_ACCEPTED.Number()), @@ -442,7 +442,7 @@ func (s ServiceServer) InviteMember( // do invite invitation, err := organizationRepo.InviteMember(ctx, organization_repo.InviteMemberParams{ Email: req.Email, - OrganizationID: organizationId, + OrganizationID: organizationID, State: int32(pb.InvitationState_INVITATION_STATE_PENDING.Number()), }) err = hwdb.Error(ctx, err) @@ -458,7 +458,7 @@ func (s ServiceServer) InviteMember( if invitation.UserID.Valid { subj = commonperm.User(invitation.UserID.UUID) } - org := commonperm.Organization(organizationId) + org := commonperm.Organization(organizationID) resc := perm.Invite(invitation.InvitationID) if _, err := s.authz. Create(hwauthz.NewRelationship(subj, perm.InviteInvitee, resc)). @@ -468,7 +468,7 @@ func (s ServiceServer) InviteMember( log.Info(). Str("email", req.Email). // TODO: privacy issues? - Str("organizationID", organizationId.String()). + Str("organizationID", organizationID.String()). Msg("user invited to organization") return &pb.InviteMemberResponse{ @@ -655,7 +655,7 @@ func (s ServiceServer) AcceptInvitation( ) (*pb.AcceptInvitationResponse, error) { organizationRepo := organization_repo.New(hwdb.GetDB()) - invitationId, err := uuid.Parse(req.InvitationId) + invitationID, err := uuid.Parse(req.InvitationId) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } @@ -668,7 +668,7 @@ func (s ServiceServer) AcceptInvitation( // check permissions user := commonperm.UserFromCtx(ctx) email := perm.Email(claims.Email) - invite := perm.Invite(invitationId) + invite := perm.Invite(invitationID) checks := []hwauthz.PermissionCheck{ hwauthz.NewPermissionCheck(user, perm.InviteCanUserAccept, invite), // either the user as access @@ -684,7 +684,7 @@ func (s ServiceServer) AcceptInvitation( // Check if invite exists rows, err := organizationRepo.GetInvitations(ctx, organization_repo.GetInvitationsParams{ - ID: uuid.NullUUID{UUID: invitationId, Valid: true}, + ID: uuid.NullUUID{UUID: invitationID, Valid: true}, Email: &claims.Email, }) err = hwdb.Error(ctx, err) @@ -703,7 +703,7 @@ func (s ServiceServer) AcceptInvitation( // Update Invitation State err = organizationRepo.UpdateInvitationState(ctx, organization_repo.UpdateInvitationStateParams{ - ID: invitationId, + ID: invitationID, State: int32(pb.InvitationState_INVITATION_STATE_ACCEPTED.Number()), }) err = hwdb.Error(ctx, err) @@ -734,7 +734,7 @@ func (s ServiceServer) DeclineInvitation( ) (*pb.DeclineInvitationResponse, error) { organizationRepo := organization_repo.New(hwdb.GetDB()) - invitationId, err := uuid.Parse(req.InvitationId) + invitationID, err := uuid.Parse(req.InvitationId) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } @@ -747,7 +747,7 @@ func (s ServiceServer) DeclineInvitation( // check permissions user := commonperm.UserFromCtx(ctx) email := perm.Email(claims.Email) - invite := perm.Invite(invitationId) + invite := perm.Invite(invitationID) checks := []hwauthz.PermissionCheck{ hwauthz.NewPermissionCheck(user, perm.InviteCanUserDeny, invite), // either the user as access @@ -763,7 +763,7 @@ func (s ServiceServer) DeclineInvitation( // Check if invite exists rows, err := organizationRepo.GetInvitations(ctx, organization_repo.GetInvitationsParams{ - ID: uuid.NullUUID{UUID: invitationId, Valid: true}, + ID: uuid.NullUUID{UUID: invitationID, Valid: true}, Email: &claims.Email, }) err = hwdb.Error(ctx, err) @@ -782,7 +782,7 @@ func (s ServiceServer) DeclineInvitation( // Update invitation state err = organizationRepo.UpdateInvitationState(ctx, organization_repo.UpdateInvitationStateParams{ - ID: invitationId, + ID: invitationID, State: int32(pb.InvitationState_INVITATION_STATE_REJECTED.Number()), }) err = hwdb.Error(ctx, err) @@ -801,14 +801,14 @@ func (s ServiceServer) RevokeInvitation( log := zlog.Ctx(ctx) - invitationId, err := uuid.Parse(req.InvitationId) + invitationID, err := uuid.Parse(req.InvitationId) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } // check permissions user := commonperm.UserFromCtx(ctx) - invite := perm.Invite(invitationId) + invite := perm.Invite(invitationID) check := hwauthz.NewPermissionCheck(user, perm.InviteCanUserCancel, invite) if err := s.authz.Must(ctx, check); err != nil { @@ -816,7 +816,7 @@ func (s ServiceServer) RevokeInvitation( } rows, err := organizationRepo.GetInvitations(ctx, organization_repo.GetInvitationsParams{ - ID: uuid.NullUUID{UUID: invitationId, Valid: true}, + ID: uuid.NullUUID{UUID: invitationID, Valid: true}, }) err = hwdb.Error(ctx, err) if err != nil { @@ -835,7 +835,7 @@ func (s ServiceServer) RevokeInvitation( // Update invitation state err = organizationRepo.UpdateInvitationState(ctx, organization_repo.UpdateInvitationStateParams{ - ID: invitationId, + ID: invitationID, State: int32(pb.InvitationState_INVITATION_STATE_REVOKED.Number()), }) err = hwdb.Error(ctx, err) @@ -973,7 +973,7 @@ func (s ServiceServer) CreatePersonalOrganization( return nil, err } - organisations, err := kc.GetOrganizationsOfUserById(ctx, userID) + organisations, err := kc.GetOrganizationsOfUserByID(ctx, userID) if err != nil { return nil, err } @@ -1006,7 +1006,7 @@ func (s ServiceServer) CreatePersonalOrganization( return nil, err } else if userResult == nil { hash := sha256.Sum256([]byte(userID.String())) - avatarUrl := fmt.Sprintf( + avatarURL := fmt.Sprintf( "%s%s", "https://source.boringavatars.com/marble/128/", hex.EncodeToString(hash[:]), @@ -1017,7 +1017,7 @@ func (s ServiceServer) CreatePersonalOrganization( Email: userClaims.Email, Nickname: userClaims.PreferredUsername, Name: userClaims.Name, - AvatarUrl: &avatarUrl, + AvatarUrl: &avatarURL, }) if err = hwdb.Error(ctx, err); err != nil { return nil, err diff --git a/services/user-svc/internal/user/user.go b/services/user-svc/internal/user/user.go index 56426a11f..bc6098b67 100644 --- a/services/user-svc/internal/user/user.go +++ b/services/user-svc/internal/user/user.go @@ -82,14 +82,14 @@ func HandleUserUpdatedEvent(ctx context.Context, evt *daprcmn.TopicEvent) (retry return true, err } - userId, err := uuid.Parse(payload.Id) + userID, err := uuid.Parse(payload.Id) if err != nil { log.Error().Err(err).Send() return true, err } err = userRepo.UpdateUser(ctx, user_repo.UpdateUserParams{ - ID: userId, + ID: userID, Email: payload.Email, Name: payload.Name, Nickname: payload.Nickname, From 6a90e6179ae508c0df435cafe4d8fd4ade64b316 Mon Sep 17 00:00:00 2001 From: Max Baumann Date: Fri, 27 Dec 2024 15:27:34 +0100 Subject: [PATCH 3/8] stylecheck --- services/property-svc/cmd/service/main.go | 14 +++++++------- services/property-svc/cmd/service/replay.go | 8 ++++---- .../set_spicedb_projection.go | 2 +- .../property_value_postgres_projection.go | 2 +- .../property_rules_postgres.go | 2 +- .../property_rules_postgres_test.go | 2 +- .../postgres_projection.go | 2 +- .../property_spicedb_projection.go | 2 +- services/tasks-svc/cmd/service/main.go | 15 +++++++-------- .../patient_postgres_projection.go | 2 +- .../patient_spicedb_projection.go | 2 +- .../internal/task-template/task_template.go | 2 +- .../task_postgres_projection.go | 2 +- .../spicedb.go | 2 +- 14 files changed, 29 insertions(+), 30 deletions(-) rename services/property-svc/internal/property-set/projections/{spiceDBProjection => spicedb-projection}/set_spicedb_projection.go (98%) rename services/property-svc/internal/property-value/projections/{property_value_postgres_projection => postgres-projection}/property_value_postgres_projection.go (99%) rename services/property-svc/internal/property-view/projections/{property_rules_postgres => postgres-projection}/property_rules_postgres.go (99%) rename services/property-svc/internal/property-view/projections/{property_rules_postgres => postgres-projection}/property_rules_postgres_test.go (99%) rename services/property-svc/internal/property/projections/{postgres_projection => postgres-projection}/postgres_projection.go (99%) rename services/property-svc/internal/property/projections/{spiceDBProjection => spicedb-projection}/property_spicedb_projection.go (98%) rename services/tasks-svc/internal/patient/projections/{patientPostgresProjection => postgres-projection}/patient_postgres_projection.go (99%) rename services/tasks-svc/internal/patient/projections/{patientSpiceDBProjection => spicedb-projection}/patient_spicedb_projection.go (98%) rename services/tasks-svc/internal/task/projections/{task_postgres_projection => postgres-projection}/task_postgres_projection.go (99%) rename services/tasks-svc/internal/task/projections/{task_spicedb => spicedb-projection}/spicedb.go (98%) diff --git a/services/property-svc/cmd/service/main.go b/services/property-svc/cmd/service/main.go index 62451d966..1a10bb52f 100644 --- a/services/property-svc/cmd/service/main.go +++ b/services/property-svc/cmd/service/main.go @@ -13,17 +13,17 @@ import ( hwspicedb "hwauthz/spicedb" propertySet "property-svc/internal/property-set/api" psh "property-svc/internal/property-set/handlers" - propertySetSpiceDBProjection "property-svc/internal/property-set/projections/spiceDBProjection" + propertySetSpiceDBProjection "property-svc/internal/property-set/projections/spicedb-projection" propertyValue "property-svc/internal/property-value/api" pvh "property-svc/internal/property-value/handlers" - "property-svc/internal/property-value/projections/property_value_postgres_projection" + propertyValuePostgresProjection "property-svc/internal/property-value/projections/postgres-projection" propertyViews "property-svc/internal/property-view/api" pvih "property-svc/internal/property-view/handlers" - "property-svc/internal/property-view/projections/property_rules_postgres" + propertyRulesPostgresProjection "property-svc/internal/property-view/projections/postgres-projection" property "property-svc/internal/property/api" ph "property-svc/internal/property/handlers" - propertyPostgresProjection "property-svc/internal/property/projections/postgres_projection" - propertySpiceDBProjection "property-svc/internal/property/projections/spiceDBProjection" + propertyPostgresProjection "property-svc/internal/property/projections/postgres-projection" + propertySpiceDBProjection "property-svc/internal/property/projections/spicedb-projection" ) const ServiceName = "property-svc" @@ -57,8 +57,8 @@ func Main(version string, ready func()) { propertySpiceDBProjection.NewProjection(eventStore, ServiceName, authz), propertySetSpiceDBProjection.NewProjection(eventStore, ServiceName, authz), propertyPostgresProjection.NewProjection(eventStore, ServiceName, hwdb.GetDB()), - property_value_postgres_projection.NewProjection(eventStore, ServiceName, hwdb.GetDB()), - property_rules_postgres.NewProjection(eventStore, ServiceName), + propertyValuePostgresProjection.NewProjection(eventStore, ServiceName, hwdb.GetDB()), + propertyRulesPostgresProjection.NewProjection(eventStore, ServiceName), ) propertyHandlers := ph.NewPropertyHandlers(aggregateStore, authz) diff --git a/services/property-svc/cmd/service/replay.go b/services/property-svc/cmd/service/replay.go index e89838cfe..846ba9de8 100644 --- a/services/property-svc/cmd/service/replay.go +++ b/services/property-svc/cmd/service/replay.go @@ -11,9 +11,9 @@ import ( "github.com/EventStore/EventStore-Client-Go/v4/esdb" propertyValueAggregate "property-svc/internal/property-value/aggregate" - "property-svc/internal/property-value/projections/property_value_postgres_projection" + propertyValuePostgresProjection "property-svc/internal/property-value/projections/postgres-projection" propertyAggregate "property-svc/internal/property/aggregate" - "property-svc/internal/property/projections/postgres_projection" + propertyPostgresProjection "property-svc/internal/property/projections/postgres-projection" ) // replay mechanism for projections of the property-svc @@ -39,8 +39,8 @@ func replay(ctx context.Context, eventStore *esdb.Client) error { log.Info().Msg("starting event replay") - propertyPostgresProjection := postgres_projection.NewProjection(eventStore, ServiceName, tx) - propertyValuePostgresProjection := property_value_postgres_projection.NewProjection(eventStore, ServiceName, tx) + propertyPostgresProjection := propertyPostgresProjection.NewProjection(eventStore, ServiceName, tx) + propertyValuePostgresProjection := propertyValuePostgresProjection.NewProjection(eventStore, ServiceName, tx) err = eventstoredb.Replay( ctx, diff --git a/services/property-svc/internal/property-set/projections/spiceDBProjection/set_spicedb_projection.go b/services/property-svc/internal/property-set/projections/spicedb-projection/set_spicedb_projection.go similarity index 98% rename from services/property-svc/internal/property-set/projections/spiceDBProjection/set_spicedb_projection.go rename to services/property-svc/internal/property-set/projections/spicedb-projection/set_spicedb_projection.go index 07432d8fc..3529bfc1a 100644 --- a/services/property-svc/internal/property-set/projections/spiceDBProjection/set_spicedb_projection.go +++ b/services/property-svc/internal/property-set/projections/spicedb-projection/set_spicedb_projection.go @@ -1,4 +1,4 @@ -package spiceDBProjection +package spicedbprojection import ( "context" diff --git a/services/property-svc/internal/property-value/projections/property_value_postgres_projection/property_value_postgres_projection.go b/services/property-svc/internal/property-value/projections/postgres-projection/property_value_postgres_projection.go similarity index 99% rename from services/property-svc/internal/property-value/projections/property_value_postgres_projection/property_value_postgres_projection.go rename to services/property-svc/internal/property-value/projections/postgres-projection/property_value_postgres_projection.go index 13de08ae1..f37411470 100644 --- a/services/property-svc/internal/property-value/projections/property_value_postgres_projection/property_value_postgres_projection.go +++ b/services/property-svc/internal/property-value/projections/postgres-projection/property_value_postgres_projection.go @@ -1,4 +1,4 @@ -package property_value_postgres_projection +package postgresprojection import ( "context" diff --git a/services/property-svc/internal/property-view/projections/property_rules_postgres/property_rules_postgres.go b/services/property-svc/internal/property-view/projections/postgres-projection/property_rules_postgres.go similarity index 99% rename from services/property-svc/internal/property-view/projections/property_rules_postgres/property_rules_postgres.go rename to services/property-svc/internal/property-view/projections/postgres-projection/property_rules_postgres.go index ff5a434dd..3bb6792b6 100644 --- a/services/property-svc/internal/property-view/projections/property_rules_postgres/property_rules_postgres.go +++ b/services/property-svc/internal/property-view/projections/postgres-projection/property_rules_postgres.go @@ -1,4 +1,4 @@ -package property_rules_postgres +package postgresprojection import ( "context" diff --git a/services/property-svc/internal/property-view/projections/property_rules_postgres/property_rules_postgres_test.go b/services/property-svc/internal/property-view/projections/postgres-projection/property_rules_postgres_test.go similarity index 99% rename from services/property-svc/internal/property-view/projections/property_rules_postgres/property_rules_postgres_test.go rename to services/property-svc/internal/property-view/projections/postgres-projection/property_rules_postgres_test.go index 74ffde3ea..9b743a7c3 100644 --- a/services/property-svc/internal/property-view/projections/property_rules_postgres/property_rules_postgres_test.go +++ b/services/property-svc/internal/property-view/projections/postgres-projection/property_rules_postgres_test.go @@ -1,4 +1,4 @@ -package property_rules_postgres +package postgresprojection import ( "bytes" diff --git a/services/property-svc/internal/property/projections/postgres_projection/postgres_projection.go b/services/property-svc/internal/property/projections/postgres-projection/postgres_projection.go similarity index 99% rename from services/property-svc/internal/property/projections/postgres_projection/postgres_projection.go rename to services/property-svc/internal/property/projections/postgres-projection/postgres_projection.go index 1ffe09d3a..6487a5cc4 100644 --- a/services/property-svc/internal/property/projections/postgres_projection/postgres_projection.go +++ b/services/property-svc/internal/property/projections/postgres-projection/postgres_projection.go @@ -1,4 +1,4 @@ -package postgres_projection +package postgresprojection import ( "context" diff --git a/services/property-svc/internal/property/projections/spiceDBProjection/property_spicedb_projection.go b/services/property-svc/internal/property/projections/spicedb-projection/property_spicedb_projection.go similarity index 98% rename from services/property-svc/internal/property/projections/spiceDBProjection/property_spicedb_projection.go rename to services/property-svc/internal/property/projections/spicedb-projection/property_spicedb_projection.go index c6b7928f8..b2a53edc7 100644 --- a/services/property-svc/internal/property/projections/spiceDBProjection/property_spicedb_projection.go +++ b/services/property-svc/internal/property/projections/spicedb-projection/property_spicedb_projection.go @@ -1,4 +1,4 @@ -package spiceDBProjection +package spicedbprojection import ( "context" diff --git a/services/tasks-svc/cmd/service/main.go b/services/tasks-svc/cmd/service/main.go index 8fd6f145b..c181c1827 100644 --- a/services/tasks-svc/cmd/service/main.go +++ b/services/tasks-svc/cmd/service/main.go @@ -10,13 +10,12 @@ import ( "hwes/eventstoredb/projections" "time" - "tasks-svc/internal/patient/projections/patientSpiceDBProjection" - ph "tasks-svc/internal/patient/handlers" - "tasks-svc/internal/patient/projections/patientPostgresProjection" + patientPostgresProjection "tasks-svc/internal/patient/projections/postgres-projection" + patientSpiceDBProjection "tasks-svc/internal/patient/projections/spicedb-projection" th "tasks-svc/internal/task/handlers" - "tasks-svc/internal/task/projections/task_postgres_projection" - "tasks-svc/internal/task/projections/task_spicedb" + taskPostgresProjection "tasks-svc/internal/task/projections/postgres-projection" + taskSpiceDBProjection "tasks-svc/internal/task/projections/spicedb-projection" "tasks-svc/internal/tracking" daprd "github.com/dapr/go-sdk/service/grpc" @@ -49,8 +48,8 @@ func Main(version string, ready func()) { go projections.StartProjections( ctx, common.Shutdown, - task_spicedb.NewSpiceDBProjection(eventStore, authz, ServiceName), - task_postgres_projection.NewProjection(eventStore, ServiceName), + taskSpiceDBProjection.NewSpiceDBProjection(eventStore, authz, ServiceName), + taskPostgresProjection.NewProjection(eventStore, ServiceName), patientPostgresProjection.NewProjection(eventStore, ServiceName), patientSpiceDBProjection.NewProjection(eventStore, authz, ServiceName), ) @@ -63,7 +62,7 @@ func Main(version string, ready func()) { pb.RegisterBedServiceServer(grpcServer, bed.NewServiceServer(authz, eventStore)) pb.RegisterRoomServiceServer(grpcServer, room.NewServiceServer(authz, eventStore)) pb.RegisterWardServiceServer(grpcServer, ward.NewServiceServer(authz, eventStore)) - pb.RegisterTaskTemplateServiceServer(grpcServer, task_template.NewServiceServer(authz, eventStore)) + pb.RegisterTaskTemplateServiceServer(grpcServer, tasktemplate.NewServiceServer(authz, eventStore)) if ready != nil { ready() diff --git a/services/tasks-svc/internal/patient/projections/patientPostgresProjection/patient_postgres_projection.go b/services/tasks-svc/internal/patient/projections/postgres-projection/patient_postgres_projection.go similarity index 99% rename from services/tasks-svc/internal/patient/projections/patientPostgresProjection/patient_postgres_projection.go rename to services/tasks-svc/internal/patient/projections/postgres-projection/patient_postgres_projection.go index 637d334a7..7a7068e90 100644 --- a/services/tasks-svc/internal/patient/projections/patientPostgresProjection/patient_postgres_projection.go +++ b/services/tasks-svc/internal/patient/projections/postgres-projection/patient_postgres_projection.go @@ -1,4 +1,4 @@ -package patientPostgresProjection +package postgresprojection import ( "context" diff --git a/services/tasks-svc/internal/patient/projections/patientSpiceDBProjection/patient_spicedb_projection.go b/services/tasks-svc/internal/patient/projections/spicedb-projection/patient_spicedb_projection.go similarity index 98% rename from services/tasks-svc/internal/patient/projections/patientSpiceDBProjection/patient_spicedb_projection.go rename to services/tasks-svc/internal/patient/projections/spicedb-projection/patient_spicedb_projection.go index 72e2cb087..59ebb158f 100644 --- a/services/tasks-svc/internal/patient/projections/patientSpiceDBProjection/patient_spicedb_projection.go +++ b/services/tasks-svc/internal/patient/projections/spicedb-projection/patient_spicedb_projection.go @@ -1,4 +1,4 @@ -package patientSpiceDBProjection +package spicedbprojection import ( "context" diff --git a/services/tasks-svc/internal/task-template/task_template.go b/services/tasks-svc/internal/task-template/task_template.go index 63d1cf5ee..34f74913d 100644 --- a/services/tasks-svc/internal/task-template/task_template.go +++ b/services/tasks-svc/internal/task-template/task_template.go @@ -1,4 +1,4 @@ -package task_template +package tasktemplate import ( "common" diff --git a/services/tasks-svc/internal/task/projections/task_postgres_projection/task_postgres_projection.go b/services/tasks-svc/internal/task/projections/postgres-projection/task_postgres_projection.go similarity index 99% rename from services/tasks-svc/internal/task/projections/task_postgres_projection/task_postgres_projection.go rename to services/tasks-svc/internal/task/projections/postgres-projection/task_postgres_projection.go index feb85eccb..1defe67fb 100644 --- a/services/tasks-svc/internal/task/projections/task_postgres_projection/task_postgres_projection.go +++ b/services/tasks-svc/internal/task/projections/postgres-projection/task_postgres_projection.go @@ -1,4 +1,4 @@ -package task_postgres_projection +package postgresprojection import ( "common/hwerr" diff --git a/services/tasks-svc/internal/task/projections/task_spicedb/spicedb.go b/services/tasks-svc/internal/task/projections/spicedb-projection/spicedb.go similarity index 98% rename from services/tasks-svc/internal/task/projections/task_spicedb/spicedb.go rename to services/tasks-svc/internal/task/projections/spicedb-projection/spicedb.go index 7f6ec460d..98500bd98 100644 --- a/services/tasks-svc/internal/task/projections/task_spicedb/spicedb.go +++ b/services/tasks-svc/internal/task/projections/spicedb-projection/spicedb.go @@ -1,4 +1,4 @@ -package task_spicedb +package spicedbprojection import ( "context" From a20f1c1b7a57dbf8faa07a7fe75c5950d2c43bae Mon Sep 17 00:00:00 2001 From: Max Baumann Date: Fri, 27 Dec 2024 15:50:18 +0100 Subject: [PATCH 4/8] swap error and action --- .../eventstoredb/projections/custom/custom.go | 8 +- services/property-svc/cmd/service/replay.go | 4 +- .../set_spicedb_projection.go | 12 +- .../property_value_postgres_projection.go | 84 ++++++------ .../property_rules_postgres.go | 36 ++--- .../property_rules_postgres_test.go | 8 +- .../postgres_projection.go | 126 +++++++++--------- .../property_spicedb_projection.go | 12 +- .../patient_postgres_projection.go | 46 +++---- .../patient_spicedb_projection.go | 12 +- .../task_postgres_projection.go | 114 ++++++++-------- .../projections/spicedb-projection/spicedb.go | 17 +-- 12 files changed, 240 insertions(+), 239 deletions(-) diff --git a/libs/hwes/eventstoredb/projections/custom/custom.go b/libs/hwes/eventstoredb/projections/custom/custom.go index e706ff3e9..d94f7a254 100644 --- a/libs/hwes/eventstoredb/projections/custom/custom.go +++ b/libs/hwes/eventstoredb/projections/custom/custom.go @@ -27,7 +27,7 @@ type EventStoreClient interface { ) error } -type eventHandler func(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) +type eventHandler func(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) // ICustomProjection is an interface, implemented by CustomProjection, // and thus also implemented by all types that struct-embed CustomProjection @@ -108,7 +108,7 @@ func (p *CustomProjection) RegisterEventListener(eventType string, eventHandler return p } -func (p *CustomProjection) HandleEvent(ctx context.Context, event hwes.Event) (error, *esdb.NackAction) { +func (p *CustomProjection) HandleEvent(ctx context.Context, event hwes.Event) (*esdb.NackAction, error) { ctx, span, log := telemetry.StartSpan( ctx, "custom_projection."+p.subscriptionGroupName+".handleEvent."+event.EventType, @@ -121,7 +121,7 @@ func (p *CustomProjection) HandleEvent(ctx context.Context, event hwes.Event) (e Str("subscriptionGroupName", p.subscriptionGroupName). Dict("event", event.GetZerologDict()). Msg("event handler for event type not found, skip") - return nil, hwutil.PtrTo(esdb.NackActionUnknown) + return hwutil.PtrTo(esdb.NackActionUnknown), nil } return eventHandler(ctx, event) } @@ -251,7 +251,7 @@ func (p *CustomProjection) processReceivedEventFromStream( log.Debug().Dict("event", event.GetZerologDict()).Msg("process event") - err, nackAction := p.HandleEvent(ctx, event) + nackAction, err := p.HandleEvent(ctx, event) if err == nil && nackAction == nil { // ack event log.Debug().Dict("event", event.GetZerologDict()).Msg("ack event") diff --git a/services/property-svc/cmd/service/replay.go b/services/property-svc/cmd/service/replay.go index 846ba9de8..fac140a0d 100644 --- a/services/property-svc/cmd/service/replay.go +++ b/services/property-svc/cmd/service/replay.go @@ -46,10 +46,10 @@ func replay(ctx context.Context, eventStore *esdb.Client) error { ctx, eventStore, func(ctx context.Context, event hwes.Event) (err error) { - if err, _ = propertyPostgresProjection.HandleEvent(ctx, event); err != nil { + if _, err = propertyPostgresProjection.HandleEvent(ctx, event); err != nil { return } - if err, _ = propertyValuePostgresProjection.HandleEvent(ctx, event); err != nil { + if _, err = propertyValuePostgresProjection.HandleEvent(ctx, event); err != nil { return } return diff --git a/services/property-svc/internal/property-set/projections/spicedb-projection/set_spicedb_projection.go b/services/property-svc/internal/property-set/projections/spicedb-projection/set_spicedb_projection.go index 3529bfc1a..c538ed122 100644 --- a/services/property-svc/internal/property-set/projections/spicedb-projection/set_spicedb_projection.go +++ b/services/property-svc/internal/property-set/projections/spicedb-projection/set_spicedb_projection.go @@ -43,23 +43,23 @@ func (p *Projection) initEventListeners() { p.RegisterEventListener(propertySetEventsV1.PropertySetCreated, p.onPropertySetCreated) } -func (p *Projection) onPropertySetCreated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPropertySetCreated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) // Parse Values var payload propertySetEventsV1.PropertySetCreatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } propertySetID, err := uuid.Parse(payload.ID) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } if evt.OrganizationID == nil { - return errs.ErrOrganizationMissing, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), errs.ErrOrganizationMissing } organizationID := *evt.OrganizationID @@ -74,8 +74,8 @@ func (p *Projection) onPropertySetCreated(ctx context.Context, evt hwes.Event) ( Create(relationship). Commit(ctx) if err != nil { - return fmt.Errorf("could not create spice relationship %s: %w", relationship.String(), err), - hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), + fmt.Errorf("could not create spice relationship %s: %w", relationship.String(), err) } log.Debug(). diff --git a/services/property-svc/internal/property-value/projections/postgres-projection/property_value_postgres_projection.go b/services/property-svc/internal/property-value/projections/postgres-projection/property_value_postgres_projection.go index f37411470..6498beaa4 100644 --- a/services/property-svc/internal/property-value/projections/postgres-projection/property_value_postgres_projection.go +++ b/services/property-svc/internal/property-value/projections/postgres-projection/property_value_postgres_projection.go @@ -47,47 +47,47 @@ func (p *Projection) initEventListeners() { p.RegisterEventListener(propertyValueEventsV1.PropertyValueUpdated, p.onPropertyValueUpdated) } -func (p *Projection) onPropertyValueCreated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPropertyValueCreated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload propertyValueEventsV1.PropertyValueCreatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } change := payload.Change propertyID, err := uuid.Parse(payload.PropertyID) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } subjectID, err := uuid.Parse(payload.SubjectID) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } // GetProperty for the fieldType property, err := hwdb.Optional(p.propertyRepo.GetPropertyById)(ctx, propertyID) if property == nil { - return PropertyNotFoundForValueError(propertyID), hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), PropertyNotFoundForValueError(propertyID) } if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } tx, rollback, err := hwdb.BeginTx(p.db, ctx) if err != nil { - return fmt.Errorf("could not start tx: %w", err), hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), fmt.Errorf("could not start tx: %w", err) } defer rollback() repo := p.propertyValueRepo.WithTx(tx) - err, ack := createBasicPropertyValue(ctx, evt, repo, change, propertyID, evt.AggregateID, subjectID) + ack, err := createBasicPropertyValue(ctx, evt, repo, change, propertyID, evt.AggregateID, subjectID) if err != nil { - return fmt.Errorf("onPropertyValueCreated: could not createbasicPropertyValue: %w", err), ack + return ack, fmt.Errorf("onPropertyValueCreated: could not createbasicPropertyValue: %w", err) } // for selects we are going to add options into the appropriate tables as well @@ -100,7 +100,7 @@ func (p *Projection) onPropertyValueCreated(ctx context.Context, evt hwes.Event) if isSingleSelectChange { id, err := uuid.Parse(*change.SingleSelectValue) if err != nil { - return fmt.Errorf("option change is not a uuid: %w", err), hwutil.PtrTo(esdb.NackActionSkip) + return hwutil.PtrTo(esdb.NackActionSkip), fmt.Errorf("option change is not a uuid: %w", err) } selectsToAdd = []property_value_repo.ConnectValueWithSelectOptionsParams{ {ValueID: evt.AggregateID, SelectOption: id}, @@ -109,8 +109,8 @@ func (p *Projection) onPropertyValueCreated(ctx context.Context, evt hwes.Event) multiSelectChange := change.MultiSelectValues ids, err := hwutil.StringsToUUIDs(multiSelectChange.SelectValues) if err != nil { - return fmt.Errorf("onPropertyValueCreated: at least one select option uuid could not be parsed: %w", err), - hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), + fmt.Errorf("onPropertyValueCreated: at least one select option uuid could not be parsed: %w", err) } selectsToAdd = hwutil.Map(ids, func(id uuid.UUID) property_value_repo.ConnectValueWithSelectOptionsParams { return property_value_repo.ConnectValueWithSelectOptionsParams{ @@ -122,13 +122,13 @@ func (p *Projection) onPropertyValueCreated(ctx context.Context, evt hwes.Event) err = hwdb.ExecBatch(repo.ConnectValueWithSelectOptions(ctx, selectsToAdd)) if err != nil { - return fmt.Errorf("onPropertyValueCreated: could not connect value with select options: %w", err), - hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), + fmt.Errorf("onPropertyValueCreated: could not connect value with select options: %w", err) } } if err := tx.Commit(ctx); err != nil { - return fmt.Errorf("could not commit transaction: %w", err), hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), fmt.Errorf("could not commit transaction: %w", err) } return nil, nil @@ -143,7 +143,7 @@ func createBasicPropertyValue( propertyID, aggregateID, subjectID uuid.UUID, -) (error, *esdb.NackAction) { +) (*esdb.NackAction, error) { createPropertyValueParams := property_value_repo.CreateBasicPropertyValueParams{ ID: aggregateID, PropertyID: propertyID, @@ -158,7 +158,7 @@ func createBasicPropertyValue( // create value err := repo.CreateBasicPropertyValue(ctx, createPropertyValueParams) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil @@ -176,13 +176,13 @@ func (e PropertyNotFoundForValueError) Error() string { return fmt.Sprintf("property with id %s not found for propertyValue", uuid.UUID(e).String()) } -func (p *Projection) onPropertyValueUpdated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPropertyValueUpdated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload propertyValueEventsV1.PropertyValueUpdatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } change := payload.Change @@ -191,7 +191,7 @@ func (p *Projection) onPropertyValueUpdated(ctx context.Context, evt hwes.Event) // Delete PropertyValue err := p.propertyValueRepo.DeletePropertyValue(ctx, evt.AggregateID) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } @@ -211,12 +211,12 @@ func updateSelectPropertyValue( db hwdb.DBTX, evt hwes.Event, valueChange models.TypedValueChange, -) (error, *esdb.NackAction) { +) (*esdb.NackAction, error) { aggregateID := evt.AggregateID tx, rollback, err := hwdb.BeginTx(db, ctx) if err != nil { - return fmt.Errorf("could not start tx: %w", err), hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), fmt.Errorf("could not start tx: %w", err) } defer rollback() @@ -226,7 +226,7 @@ func updateSelectPropertyValue( if valueChange.SingleSelectValue != nil { parsedID, err := uuid.Parse(*valueChange.SingleSelectValue) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } toAdd = []uuid.UUID{parsedID} @@ -234,16 +234,16 @@ func updateSelectPropertyValue( // delete any other connection err = propertyValueRepo.DisconnectValueFromAllSelectOptions(ctx, aggregateID) if err != nil { - return fmt.Errorf("onPropertyValueUpdated: could not disconnectvalue from all options: %w", err), - hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), + fmt.Errorf("onPropertyValueUpdated: could not disconnectvalue from all options: %w", err) } } else if valueChange.MultiSelectValues != nil { val := *valueChange.MultiSelectValues toAdd, err = hwutil.StringsToUUIDs(val.SelectValues) if err != nil { - return fmt.Errorf("onPropertyValueUpdated: could not parse SelectValues: %w", err), - hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), + fmt.Errorf("onPropertyValueUpdated: could not parse SelectValues: %w", err) } // delete requested options @@ -260,12 +260,12 @@ func updateSelectPropertyValue( }, nil }) if err != nil { - return fmt.Errorf("onPropertyValueUpdated: could not parse RemoveSelectValues: %w", err), - hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), + fmt.Errorf("onPropertyValueUpdated: could not parse RemoveSelectValues: %w", err) } if err := hwdb.ExecBatch(propertyValueRepo.DisconnectValueFromSelectOptions(ctx, arr)); err != nil { - return fmt.Errorf("onPropertyValueUpdated: could not disconnect desired options: %w", err), - hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), + fmt.Errorf("onPropertyValueUpdated: could not disconnect desired options: %w", err) } } } @@ -278,8 +278,8 @@ func updateSelectPropertyValue( } }) if err := hwdb.ExecBatch(propertyValueRepo.ConnectValueWithSelectOptions(ctx, args)); err != nil { - return fmt.Errorf("onPropertyValueUpdated: could not connect select options: %w", err), - hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), + fmt.Errorf("onPropertyValueUpdated: could not connect select options: %w", err) } // update consistency @@ -288,13 +288,13 @@ func updateSelectPropertyValue( Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return fmt.Errorf("onPropertyValueUpdated: could not update consistency of value: %w", err), - hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), + fmt.Errorf("onPropertyValueUpdated: could not update consistency of value: %w", err) } if err := tx.Commit(ctx); err != nil { - return fmt.Errorf("onPropertyValueUpdated: could not commit tx: %w", err), - hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), + fmt.Errorf("onPropertyValueUpdated: could not commit tx: %w", err) } return nil, nil } @@ -305,7 +305,7 @@ func updateBasicPropertyValue( evt hwes.Event, repo *property_value_repo.Queries, valueChange models.TypedValueChange, -) (error, *esdb.NackAction) { +) (*esdb.NackAction, error) { aggregateID := evt.AggregateID updatePropertyValueParams := property_value_repo.UpdatePropertyValueByIDParams{ @@ -314,14 +314,14 @@ func updateBasicPropertyValue( } if err := valueChange.SetBasicValues(&updatePropertyValueParams); err != nil { - return fmt.Errorf("updateBasicPropertyValue: could not set setBasicFromChange: %w", err), - hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), + fmt.Errorf("updateBasicPropertyValue: could not set setBasicFromChange: %w", err) } err := repo.UpdatePropertyValueByID(ctx, updatePropertyValueParams) if err := hwdb.Error(ctx, err); err != nil { - return fmt.Errorf("updateBasicPropertyValue: could not update property value in pq: %w", err), - hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), + fmt.Errorf("updateBasicPropertyValue: could not update property value in pq: %w", err) } return nil, nil diff --git a/services/property-svc/internal/property-view/projections/postgres-projection/property_rules_postgres.go b/services/property-svc/internal/property-view/projections/postgres-projection/property_rules_postgres.go index 3bb6792b6..b490e9ce3 100644 --- a/services/property-svc/internal/property-view/projections/postgres-projection/property_rules_postgres.go +++ b/services/property-svc/internal/property-view/projections/postgres-projection/property_rules_postgres.go @@ -60,22 +60,22 @@ func (e UnexpectedMatchersTypeError) Error() string { return fmt.Sprintf("unexpected matchers type, got %T", e.typ) } -func (p *Projection) onPropertyRuleCreated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPropertyRuleCreated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload eventsV1.PropertyRuleCreatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } if payload.RuleID == uuid.Nil { - return errs.ErrMissingRuleID, hwutil.PtrTo(esdb.NackActionSkip) + return hwutil.PtrTo(esdb.NackActionSkip), errs.ErrMissingRuleID } tx, rollback, err := hwdb.BeginTx(p.db, ctx) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } defer rollback() @@ -85,7 +85,7 @@ func (p *Projection) onPropertyRuleCreated(ctx context.Context, evt hwes.Event) err = viewsQuery.CreateRule(ctx, payload.RuleID) if err != nil { log.Error().Err(err).Msg("could not create view rule") - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } // Decide on matchers @@ -99,7 +99,7 @@ func (p *Projection) onPropertyRuleCreated(ctx context.Context, evt hwes.Event) }) if err != nil { log.Error().Err(err).Msg("could not create task rule") - return fmt.Errorf("could not create patient rule: %w", err), hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), fmt.Errorf("could not create patient rule: %w", err) } case models.PatientPropertyMatchers: patientViewsQuery := p.patientViewsRepo.WithTx(tx) @@ -110,10 +110,10 @@ func (p *Projection) onPropertyRuleCreated(ctx context.Context, evt hwes.Event) }) if err != nil { log.Error().Err(err).Msg("could not create patient rule") - return fmt.Errorf("could not create patient rule: %w", err), hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), fmt.Errorf("could not create patient rule: %w", err) } default: - return UnexpectedMatchersTypeError{typ: payload.Matchers}, hwutil.PtrTo(esdb.NackActionSkip) + return hwutil.PtrTo(esdb.NackActionSkip), UnexpectedMatchersTypeError{typ: payload.Matchers} } // handle (dont)alwaysInclude logic @@ -130,35 +130,35 @@ func (p *Projection) onPropertyRuleCreated(ctx context.Context, evt hwes.Event) _, err = viewsQuery.AddToAlwaysInclude(ctx, hwutil.Map(payload.AlwaysInclude, mapper(false))) if err != nil { log.Error().Err(err).Msg("could not insert always include list") - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } _, err = viewsQuery.AddToAlwaysInclude(ctx, hwutil.Map(payload.DontAlwaysInclude, mapper(true))) if err != nil { log.Error().Err(err).Msg("could not insert dont always include list") - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } err = tx.Commit(ctx) if err != nil { log.Error().Err(err).Msg("could not commit") - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onPropertyRuleListsUpdated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPropertyRuleListsUpdated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload eventsV1.PropertyRuleListsUpdatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionSkip) + return hwutil.PtrTo(esdb.NackActionSkip), err } tx, rollback, err := hwdb.BeginTx(p.db, ctx) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } defer rollback() @@ -200,14 +200,14 @@ func (p *Projection) onPropertyRuleListsUpdated(ctx context.Context, evt hwes.Ev }) if err != nil { log.Error().Err(err).Msg("failed to clean up before appending to dont always include list") - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } // now, add the new items _, err = viewsQuery.AddToAlwaysInclude(ctx, toAppend) if err != nil { log.Error().Err(err).Msg("failed to append to lists") - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } // finally, remove things from the lists @@ -218,13 +218,13 @@ func (p *Projection) onPropertyRuleListsUpdated(ctx context.Context, evt hwes.Ev }) if err != nil { log.Error().Err(err).Msg("failed to delete from always include list") - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } err = tx.Commit(ctx) if err != nil { log.Error().Err(err).Msg("could not commit") - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil diff --git a/services/property-svc/internal/property-view/projections/postgres-projection/property_rules_postgres_test.go b/services/property-svc/internal/property-view/projections/postgres-projection/property_rules_postgres_test.go index 9b743a7c3..88b66a85a 100644 --- a/services/property-svc/internal/property-view/projections/postgres-projection/property_rules_postgres_test.go +++ b/services/property-svc/internal/property-view/projections/postgres-projection/property_rules_postgres_test.go @@ -89,7 +89,7 @@ func TestPropertyViewPropertyRulesProjection_Create_TaskPropertyMatcher_GreenPat "RuleID": "96e7ffe9-8b18-4e58-b2e1-a756fdbe1273" }`) - err, action := projection.onPropertyRuleCreated(ctx, hwes.Event{ + action, err := projection.onPropertyRuleCreated(ctx, hwes.Event{ EventID: uuid.MustParse("227592bd-7aa0-4018-bcd4-c68fb06090ee"), EventType: v1.PropertyRuleCreated, AggregateID: uuid.MustParse("96e7ffe9-8b18-4e58-b2e1-a756fdbe1273"), @@ -155,7 +155,7 @@ func TestPropertyViewPropertyRulesProjection_Update_GreenPath(t *testing.T) { ) data := buf.Bytes() - err, action := projection.onPropertyRuleListsUpdated(ctx, hwes.Event{ + action, err := projection.onPropertyRuleListsUpdated(ctx, hwes.Event{ EventID: uuid.MustParse("227592bd-7aa0-4018-bcd4-c68fb06090ee"), EventType: v1.PropertyRuleListsUpdated, AggregateID: uuid.MustParse("96e7ffe9-8b18-4e58-b2e1-a756fdbe1273"), @@ -207,7 +207,7 @@ func TestPropertyViewPropertyRulesProjection_Create_PatientPropertyMatcher_Green "RuleID": "c976b4fa-ee37-4aff-b7f9-c88fe5c8d238" }`) - err, action := projection.onPropertyRuleCreated(ctx, hwes.Event{ + action, err := projection.onPropertyRuleCreated(ctx, hwes.Event{ EventID: uuid.MustParse("227592bd-7aa0-4018-bcd4-c68fb06090ee"), EventType: v1.PropertyRuleCreated, AggregateID: uuid.MustParse("c976b4fa-ee37-4aff-b7f9-c88fe5c8d238"), @@ -237,7 +237,7 @@ func TestPropertyViewPropertyRulesProjection_Create_InvalidPropertyMatcher(t *te "RuleID": "c976b4fa-ee37-4aff-b7f9-c88fe5c8d238" }`) - err, action := projection.onPropertyRuleCreated(ctx, hwes.Event{ + action, err := projection.onPropertyRuleCreated(ctx, hwes.Event{ EventID: uuid.MustParse("227592bd-7aa0-4018-bcd4-c68fb06090ee"), EventType: v1.PropertyRuleCreated, AggregateID: uuid.MustParse("c976b4fa-ee37-4aff-b7f9-c88fe5c8d238"), diff --git a/services/property-svc/internal/property/projections/postgres-projection/postgres_projection.go b/services/property-svc/internal/property/projections/postgres-projection/postgres_projection.go index 6487a5cc4..83df38b3e 100644 --- a/services/property-svc/internal/property/projections/postgres-projection/postgres_projection.go +++ b/services/property-svc/internal/property/projections/postgres-projection/postgres_projection.go @@ -71,30 +71,30 @@ func (p *Projection) initEventListeners() { p.onFieldTypeDataSelectOptionsUpserted) } -func (p *Projection) onPropertyCreated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPropertyCreated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload propertyEventsV1.PropertyCreatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } // Create Property propertyID, err := uuid.Parse(payload.ID) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } subjectType, err := util.ParseSubjectType(payload.SubjectType) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } fieldType, err := util.ParseFieldType(payload.FieldType) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } // create query @@ -106,23 +106,23 @@ func (p *Projection) onPropertyCreated(ctx context.Context, evt hwes.Event) (err Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } if err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onPropertyDescriptionUpdated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPropertyDescriptionUpdated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload propertyEventsV1.PropertyDescriptionUpdatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } err := p.propertyRepo.UpdateProperty(ctx, property_repo.UpdatePropertyParams{ @@ -132,25 +132,25 @@ func (p *Projection) onPropertyDescriptionUpdated(ctx context.Context, evt hwes. }) err = hwdb.Error(ctx, err) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onPropertySetIDUpdated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPropertySetIDUpdated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload propertyEventsV1.PropertySetIDUpdatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } setID := uuid.NullUUID{UUID: uuid.Nil, Valid: false} if payload.SetID != "" { if parsedID, err := hwutil.ParseNullUUID(&payload.SetID); err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } else { setID = parsedID } @@ -163,24 +163,24 @@ func (p *Projection) onPropertySetIDUpdated(ctx context.Context, evt hwes.Event) }) err = hwdb.Error(ctx, err) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onSubjectTypeUpdated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onSubjectTypeUpdated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload propertyEventsV1.PropertySubjectTypeUpdatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } subjectType, err := util.ParseSubjectType(payload.SubjectType) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } err = p.propertyRepo.UpdateProperty(ctx, property_repo.UpdatePropertyParams{ @@ -190,19 +190,19 @@ func (p *Projection) onSubjectTypeUpdated(ctx context.Context, evt hwes.Event) ( }) err = hwdb.Error(ctx, err) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onNameUpdated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onNameUpdated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload propertyEventsV1.PropertyNameUpdatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } err := p.propertyRepo.UpdateProperty(ctx, property_repo.UpdatePropertyParams{ @@ -212,43 +212,43 @@ func (p *Projection) onNameUpdated(ctx context.Context, evt hwes.Event) (error, }) err = hwdb.Error(ctx, err) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onPropertyArchived(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPropertyArchived(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { err := p.propertyRepo.UpdateProperty(ctx, property_repo.UpdatePropertyParams{ ID: evt.GetAggregateID(), IsArchived: hwutil.PtrTo(true), Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onPropertyRetrieved(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPropertyRetrieved(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { err := p.propertyRepo.UpdateProperty(ctx, property_repo.UpdatePropertyParams{ ID: evt.GetAggregateID(), IsArchived: hwutil.PtrTo(false), Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onPropertyFieldTypeDataCreated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPropertyFieldTypeDataCreated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) tx, rollback, err := hwdb.BeginTx(p.db, ctx) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } defer rollback() propertyRepo := p.propertyRepo.WithTx(tx) @@ -256,13 +256,13 @@ func (p *Projection) onPropertyFieldTypeDataCreated(ctx context.Context, evt hwe var payload propertyEventsV1.FieldTypeDataCreatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } if payload.FieldTypeData.SelectData != nil { selectDataID, err := propertyRepo.CreateSelectData(ctx, payload.FieldTypeData.SelectData.AllowFreetext) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } for _, option := range payload.FieldTypeData.SelectData.SelectOptions { err := propertyRepo.CreateSelectOption(ctx, property_repo.CreateSelectOptionParams{ @@ -273,7 +273,7 @@ func (p *Projection) onPropertyFieldTypeDataCreated(ctx context.Context, evt hwe SelectDataID: selectDataID, }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } } @@ -284,22 +284,22 @@ func (p *Projection) onPropertyFieldTypeDataCreated(ctx context.Context, evt hwe Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } } if err := tx.Commit(ctx); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onAllowFreetextUpdated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onAllowFreetextUpdated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) tx, rollback, err := hwdb.BeginTx(p.db, ctx) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } defer rollback() propertyRepo := p.propertyRepo.WithTx(tx) @@ -307,12 +307,12 @@ func (p *Projection) onAllowFreetextUpdated(ctx context.Context, evt hwes.Event) var payload propertyEventsV1.FieldTypeDataAllowFreetextUpdatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } property, err := propertyRepo.GetPropertyById(ctx, evt.AggregateID) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } if property.SelectDataID.Valid { @@ -322,14 +322,14 @@ func (p *Projection) onAllowFreetextUpdated(ctx context.Context, evt hwes.Event) Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } } else if property.FieldType == int32(pb.FieldType_FIELD_TYPE_SELECT) || property.FieldType == int32(pb.FieldType_FIELD_TYPE_MULTI_SELECT) { // if the property was created with field_type_select but selectData wasn't created initially we have to do it here sdID, err := propertyRepo.CreateSelectData(ctx, payload.NewAllowFreetext) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } err = propertyRepo.UpdatePropertySelectDataID(ctx, property_repo.UpdatePropertySelectDataIDParams{ ID: evt.AggregateID, @@ -337,12 +337,12 @@ func (p *Projection) onAllowFreetextUpdated(ctx context.Context, evt hwes.Event) Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } } if err := tx.Commit(ctx); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil @@ -351,11 +351,11 @@ func (p *Projection) onAllowFreetextUpdated(ctx context.Context, evt hwes.Event) func (p *Projection) onFieldTypeDataSelectOptionsUpserted( ctx context.Context, evt hwes.Event, -) (error, *esdb.NackAction) { +) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) tx, rollback, err := hwdb.BeginTx(p.db, ctx) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } defer rollback() propertyRepo := p.propertyRepo.WithTx(tx) @@ -363,13 +363,13 @@ func (p *Projection) onFieldTypeDataSelectOptionsUpserted( var payload propertyEventsV1.FieldTypeDataSelectOptionsUpsertedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } property, err := propertyRepo.GetPropertyById(ctx, evt.AggregateID) err = hwdb.Error(ctx, err) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } var selectDataID uuid.UUID @@ -377,7 +377,7 @@ func (p *Projection) onFieldTypeDataSelectOptionsUpserted( // Create SelectData and reference from property sdID, err := propertyRepo.CreateSelectData(ctx, false) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } err = propertyRepo.UpdatePropertySelectDataID(ctx, property_repo.UpdatePropertySelectDataIDParams{ ID: evt.AggregateID, @@ -385,7 +385,7 @@ func (p *Projection) onFieldTypeDataSelectOptionsUpserted( Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } selectDataID = sdID } else { @@ -417,11 +417,11 @@ func (p *Projection) onFieldTypeDataSelectOptionsUpserted( }) if existsBatchErr != nil { - return existsBatchErr, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), existsBatchErr } if err := existsBatch.Close(); err != nil { log.Err(err).Msg("failed while closing existsBatch.") - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } var existingSelectOptions []property_repo.UpdateSelectOptionsBatchParams @@ -438,8 +438,8 @@ func (p *Projection) onFieldTypeDataSelectOptionsUpserted( } else { if selOpt.Name == nil { log.Error().Msg("selectOption name has to be set on create") - // existsSelectOptions gets modified by a database result. Thats why we are retrying here. - return nil, hwutil.PtrTo(esdb.NackActionRetry) + // existsSelectOptions gets modified by a database result. That's why we are retrying here. + return hwutil.PtrTo(esdb.NackActionRetry), nil } newSelectOptions = append(newSelectOptions, property_repo.InsertSelectOptionsBatchParams{ ID: selOpt.ID, @@ -461,11 +461,11 @@ func (p *Projection) onFieldTypeDataSelectOptionsUpserted( } }) if batchUpdateErr != nil { - return batchUpdateErr, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), batchUpdateErr } if err := batchUpdate.Close(); err != nil { log.Err(err).Msg("failed while closing updateBatch.") - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } // Insert @@ -478,11 +478,11 @@ func (p *Projection) onFieldTypeDataSelectOptionsUpserted( } }) if batchInsertErr != nil { - return batchInsertErr, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), batchInsertErr } if err := batchInsert.Close(); err != nil { log.Err(err).Msg("failed while closing insertBatch.") - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } // update property consistency @@ -491,11 +491,11 @@ func (p *Projection) onFieldTypeDataSelectOptionsUpserted( Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } if err := tx.Commit(ctx); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil @@ -504,11 +504,11 @@ func (p *Projection) onFieldTypeDataSelectOptionsUpserted( func (p *Projection) onFieldTypeDataSelectOptionsRemoved( ctx context.Context, evt hwes.Event, -) (error, *esdb.NackAction) { +) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) tx, rollback, err := hwdb.BeginTx(p.db, ctx) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } defer rollback() propertyRepo := p.propertyRepo.WithTx(tx) @@ -516,7 +516,7 @@ func (p *Projection) onFieldTypeDataSelectOptionsRemoved( var payload propertyEventsV1.FieldTypeDataSelectOptionsRemovedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } parsedIDs := hwutil.FlatMap(payload.RemovedSelectOptions, func(s string) *uuid.UUID { @@ -538,12 +538,12 @@ func (p *Projection) onFieldTypeDataSelectOptionsRemoved( }) if batchErr != nil { log.Error().Err(batchErr).Msg("batch execution failed.") - return batchErr, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), batchErr } if err := batch.Close(); err != nil { log.Err(err).Msg("failed while closing batch.") - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } // update property consistency @@ -552,11 +552,11 @@ func (p *Projection) onFieldTypeDataSelectOptionsRemoved( Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } if err := tx.Commit(ctx); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil diff --git a/services/property-svc/internal/property/projections/spicedb-projection/property_spicedb_projection.go b/services/property-svc/internal/property/projections/spicedb-projection/property_spicedb_projection.go index b2a53edc7..eca90946b 100644 --- a/services/property-svc/internal/property/projections/spicedb-projection/property_spicedb_projection.go +++ b/services/property-svc/internal/property/projections/spicedb-projection/property_spicedb_projection.go @@ -43,23 +43,23 @@ func (p *Projection) initEventListeners() { p.RegisterEventListener(propertyEventsV1.PropertyCreated, p.onPropertyCreated) } -func (p *Projection) onPropertyCreated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPropertyCreated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) // Parse Values var payload propertyEventsV1.PropertyCreatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } propertyID, err := uuid.Parse(payload.ID) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } if evt.OrganizationID == nil { - return errs.ErrOrganizationMissing, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), errs.ErrOrganizationMissing } organizationID := *evt.OrganizationID @@ -74,8 +74,8 @@ func (p *Projection) onPropertyCreated(ctx context.Context, evt hwes.Event) (err Create(relationship). Commit(ctx) if err != nil { - return fmt.Errorf("could not create spice relationship %s: %w", relationship.String(), err), - hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), + fmt.Errorf("could not create spice relationship %s: %w", relationship.String(), err) } log.Debug(). diff --git a/services/tasks-svc/internal/patient/projections/postgres-projection/patient_postgres_projection.go b/services/tasks-svc/internal/patient/projections/postgres-projection/patient_postgres_projection.go index 7a7068e90..548c9e3c4 100644 --- a/services/tasks-svc/internal/patient/projections/postgres-projection/patient_postgres_projection.go +++ b/services/tasks-svc/internal/patient/projections/postgres-projection/patient_postgres_projection.go @@ -48,22 +48,22 @@ func (p *Projection) initEventListeners() { } // Event handlers -func (p *Projection) onPatientCreated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPatientCreated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload patientEventsV1.PatientCreatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } patientID, err := uuid.Parse(payload.ID) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } if evt.OrganizationID == nil { - return errs.ErrOrganizationMissing, hwutil.PtrTo(esdb.NackActionSkip) + return hwutil.PtrTo(esdb.NackActionSkip), errs.ErrOrganizationMissing } organizationID := *evt.OrganizationID @@ -77,24 +77,24 @@ func (p *Projection) onPatientCreated(ctx context.Context, evt hwes.Event) (erro OrganizationID: organizationID, }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onBedAssigned(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onBedAssigned(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload patientEventsV1.BedAssignedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } bedID, err := hwutil.ParseNullUUID(&payload.BedID) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } err = p.patientRepo.UpdatePatientBedId(ctx, patient_repo.UpdatePatientBedIdParams{ @@ -104,13 +104,13 @@ func (p *Projection) onBedAssigned(ctx context.Context, evt hwes.Event) (error, Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onBedUnassigned(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onBedUnassigned(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { err := p.patientRepo.UpdatePatientBedId(ctx, patient_repo.UpdatePatientBedIdParams{ ID: evt.AggregateID, BedID: uuid.NullUUID{}, @@ -118,13 +118,13 @@ func (p *Projection) onBedUnassigned(ctx context.Context, evt hwes.Event) (error Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onPatientDischarged(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPatientDischarged(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { err := p.patientRepo.UpdatePatient(ctx, patient_repo.UpdatePatientParams{ ID: evt.AggregateID, IsDischarged: hwutil.PtrTo(true), @@ -132,19 +132,19 @@ func (p *Projection) onPatientDischarged(ctx context.Context, evt hwes.Event) (e Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onNotesUpdated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onNotesUpdated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload patientEventsV1.NotesUpdatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } err := p.patientRepo.UpdatePatient(ctx, patient_repo.UpdatePatientParams{ @@ -154,19 +154,19 @@ func (p *Projection) onNotesUpdated(ctx context.Context, evt hwes.Event) (error, Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onHumanReadableIdentifierUpdated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onHumanReadableIdentifierUpdated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload patientEventsV1.HumanReadableIdentifierUpdatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } err := p.patientRepo.UpdatePatient(ctx, patient_repo.UpdatePatientParams{ @@ -176,13 +176,13 @@ func (p *Projection) onHumanReadableIdentifierUpdated(ctx context.Context, evt h Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onPatientReadmitted(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPatientReadmitted(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { err := p.patientRepo.UpdatePatient(ctx, patient_repo.UpdatePatientParams{ ID: evt.AggregateID, IsDischarged: hwutil.PtrTo(false), @@ -190,16 +190,16 @@ func (p *Projection) onPatientReadmitted(ctx context.Context, evt hwes.Event) (e Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onPatientDeleted(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPatientDeleted(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { err := p.patientRepo.DeletePatient(ctx, evt.AggregateID) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } diff --git a/services/tasks-svc/internal/patient/projections/spicedb-projection/patient_spicedb_projection.go b/services/tasks-svc/internal/patient/projections/spicedb-projection/patient_spicedb_projection.go index 59ebb158f..97528e334 100644 --- a/services/tasks-svc/internal/patient/projections/spicedb-projection/patient_spicedb_projection.go +++ b/services/tasks-svc/internal/patient/projections/spicedb-projection/patient_spicedb_projection.go @@ -42,9 +42,9 @@ func (p *Projection) initEventListeners() { } // Event handlers -func (p *Projection) onPatientCreated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPatientCreated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { if evt.OrganizationID == nil { - return errs.ErrOrganizationMissing, hwutil.PtrTo(esdb.NackActionSkip) + return hwutil.PtrTo(esdb.NackActionSkip), errs.ErrOrganizationMissing } organization := commonperm.Organization(*evt.OrganizationID) @@ -53,16 +53,16 @@ func (p *Projection) onPatientCreated(ctx context.Context, evt hwes.Event) (erro _, err := p.authz.Create(relationship).Commit(ctx) if err != nil { - return fmt.Errorf("onPatientCreated: could not write spicedb relationship: %w", err), - hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), + fmt.Errorf("onPatientCreated: could not write spicedb relationship: %w", err) } return nil, nil } -func (p *Projection) onPatientDeleted(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onPatientDeleted(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { if err := p.authz.DeleteObject(ctx, perm.Patient(evt.AggregateID)); err != nil { - return fmt.Errorf("could not delete patient from spicedb: %w", err), hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), fmt.Errorf("could not delete patient from spicedb: %w", err) } return nil, nil } diff --git a/services/tasks-svc/internal/task/projections/postgres-projection/task_postgres_projection.go b/services/tasks-svc/internal/task/projections/postgres-projection/task_postgres_projection.go index 1defe67fb..991dfac23 100644 --- a/services/tasks-svc/internal/task/projections/postgres-projection/task_postgres_projection.go +++ b/services/tasks-svc/internal/task/projections/postgres-projection/task_postgres_projection.go @@ -65,35 +65,35 @@ func parseTaskStatus(status string) (pb.TaskStatus, error) { return (pb.TaskStatus)(value), nil } -func (p *Projection) onTaskCreated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onTaskCreated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload taskEventsV1.TaskCreatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } taskID, err := uuid.Parse(payload.ID) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } patientID, err := uuid.Parse(payload.PatientID) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } status, err := parseTaskStatus(payload.Status) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } var committerID uuid.UUID if evt.CommitterUserID != nil { committerID = *evt.CommitterUserID } else { - return esErrs.ErrCommitterMissing, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), esErrs.ErrCommitterMissing } // Add to db @@ -107,24 +107,24 @@ func (p *Projection) onTaskCreated(ctx context.Context, evt hwes.Event) (error, Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onTaskStatusUpdated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onTaskStatusUpdated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload taskEventsV1.TaskStatusUpdatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } status, err := parseTaskStatus(payload.Status) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } err = p.taskRepo.UpdateTask(ctx, task_repo.UpdateTaskParams{ @@ -133,19 +133,19 @@ func (p *Projection) onTaskStatusUpdated(ctx context.Context, evt hwes.Event) (e Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err = hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onTaskNameUpdated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onTaskNameUpdated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload taskEventsV1.TaskNameUpdatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } err := p.taskRepo.UpdateTask(ctx, task_repo.UpdateTaskParams{ @@ -154,19 +154,19 @@ func (p *Projection) onTaskNameUpdated(ctx context.Context, evt hwes.Event) (err Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err = hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onTaskDescriptionUpdated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onTaskDescriptionUpdated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload taskEventsV1.TaskDescriptionUpdatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } err := p.taskRepo.UpdateTask(ctx, task_repo.UpdateTaskParams{ @@ -175,19 +175,19 @@ func (p *Projection) onTaskDescriptionUpdated(ctx context.Context, evt hwes.Even Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err = hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onTaskDueAtUpdated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onTaskDueAtUpdated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload taskEventsV1.TaskDueAtUpdatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } err := p.taskRepo.UpdateTask(ctx, task_repo.UpdateTaskParams{ @@ -196,13 +196,13 @@ func (p *Projection) onTaskDueAtUpdated(ctx context.Context, evt hwes.Event) (er Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err = hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onTaskAssigned(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onTaskAssigned(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var userIDStr string @@ -212,21 +212,21 @@ func (p *Projection) onTaskAssigned(ctx context.Context, evt hwes.Event) (error, var payload taskEventsV1.TaskAssignedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } userIDStr = payload.UserID case taskEventsV1.TaskSelfAssigned: var payload taskEventsV1.TaskSelfAssignedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } userIDStr = payload.UserID } userID, err := hwutil.ParseNullUUID(&userIDStr) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } err = p.taskRepo.UpdateTaskAssignedUser(ctx, task_repo.UpdateTaskAssignedUserParams{ @@ -235,19 +235,19 @@ func (p *Projection) onTaskAssigned(ctx context.Context, evt hwes.Event) (error, Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err = hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onTaskUnassigned(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onTaskUnassigned(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload taskEventsV1.TaskUnassignedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } err := p.taskRepo.UpdateTaskAssignedUser(ctx, task_repo.UpdateTaskAssignedUserParams{ @@ -256,57 +256,57 @@ func (p *Projection) onTaskUnassigned(ctx context.Context, evt hwes.Event) (erro Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err = hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onTaskPublished(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onTaskPublished(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { err := p.taskRepo.UpdateTask(ctx, task_repo.UpdateTaskParams{ ID: evt.AggregateID, Public: hwutil.PtrTo(true), Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err = hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onTaskUnpublished(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onTaskUnpublished(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { err := p.taskRepo.UpdateTask(ctx, task_repo.UpdateTaskParams{ ID: evt.AggregateID, Public: hwutil.PtrTo(false), Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onSubtaskCreated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onSubtaskCreated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload taskEventsV1.SubtaskCreatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } var committerID uuid.UUID if evt.CommitterUserID != nil { committerID = *evt.CommitterUserID } else { - return esErrs.ErrCommitterMissing, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), esErrs.ErrCommitterMissing } subtaskID, err := uuid.Parse(payload.SubtaskID) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } err = p.taskRepo.CreateSubtask(ctx, task_repo.CreateSubtaskParams{ @@ -318,24 +318,24 @@ func (p *Projection) onSubtaskCreated(ctx context.Context, evt hwes.Event) (erro Done: payload.Done, }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onSubtaskNameUpdated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onSubtaskNameUpdated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload taskEventsV1.SubtaskCreatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } subtaskID, err := uuid.Parse(payload.SubtaskID) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } err = p.taskRepo.UpdateSubtask(ctx, task_repo.UpdateSubtaskParams{ @@ -344,24 +344,24 @@ func (p *Projection) onSubtaskNameUpdated(ctx context.Context, evt hwes.Event) ( Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err = hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onSubtaskCompleted(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onSubtaskCompleted(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload taskEventsV1.SubtaskCompletedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } subtaskID, err := uuid.Parse(payload.SubtaskID) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } err = p.taskRepo.UpdateSubtask(ctx, task_repo.UpdateSubtaskParams{ @@ -370,24 +370,24 @@ func (p *Projection) onSubtaskCompleted(ctx context.Context, evt hwes.Event) (er Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onSubtaskUncompleted(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onSubtaskUncompleted(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload taskEventsV1.SubtaskUncompletedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } subtaskID, err := uuid.Parse(payload.SubtaskID) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } err = p.taskRepo.UpdateSubtask(ctx, task_repo.UpdateSubtaskParams{ @@ -396,24 +396,24 @@ func (p *Projection) onSubtaskUncompleted(ctx context.Context, evt hwes.Event) ( Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onSubtaskDeleted(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onSubtaskDeleted(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload taskEventsV1.SubtaskDeletedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } subtaskID, err := uuid.Parse(payload.SubtaskID) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } err = p.taskRepo.DeleteSubtask(ctx, task_repo.DeleteSubtaskParams{ @@ -421,26 +421,26 @@ func (p *Projection) onSubtaskDeleted(ctx context.Context, evt hwes.Event) (erro Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onTaskDueAtRemoved(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onTaskDueAtRemoved(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { err := p.taskRepo.RemoveTaskDueAt(ctx, task_repo.RemoveTaskDueAtParams{ ID: evt.AggregateID, Consistency: int64(evt.GetVersion()), //nolint:gosec }) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } -func (p *Projection) onTaskDeleted(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onTaskDeleted(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { err := p.taskRepo.DeleteTask(ctx, evt.AggregateID) if err := hwdb.Error(ctx, err); err != nil { - return err, hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), err } return nil, nil } diff --git a/services/tasks-svc/internal/task/projections/spicedb-projection/spicedb.go b/services/tasks-svc/internal/task/projections/spicedb-projection/spicedb.go index 98500bd98..be4c80fa3 100644 --- a/services/tasks-svc/internal/task/projections/spicedb-projection/spicedb.go +++ b/services/tasks-svc/internal/task/projections/spicedb-projection/spicedb.go @@ -44,23 +44,23 @@ func (p *Projection) initEventListeners() { p.RegisterEventListener(taskEventsV1.TaskDeleted, p.onTaskDeleted) } -func (p *Projection) onTaskCreated(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onTaskCreated(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { log := zlog.Ctx(ctx) var payload taskEventsV1.TaskCreatedEvent if err := evt.GetJSONData(&payload); err != nil { log.Error().Err(err).Msg("unmarshal failed") - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } taskID, err := uuid.Parse(payload.ID) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } patientID, err := uuid.Parse(payload.PatientID) if err != nil { - return err, hwutil.PtrTo(esdb.NackActionPark) + return hwutil.PtrTo(esdb.NackActionPark), err } task := perm.Task(taskID) @@ -70,16 +70,17 @@ func (p *Projection) onTaskCreated(ctx context.Context, evt hwes.Event) (error, _, err = p.authz.Create(relationship).Commit(ctx) if err != nil { - return fmt.Errorf("onTaskCreated: could not write spicedb relationship: %w", err), - hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), + fmt.Errorf("onTaskCreated: could not write spicedb relationship: %w", err) } return nil, nil } -func (p *Projection) onTaskDeleted(ctx context.Context, evt hwes.Event) (error, *esdb.NackAction) { +func (p *Projection) onTaskDeleted(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { if err := p.authz.DeleteObject(ctx, perm.Task(evt.AggregateID)); err != nil { - return fmt.Errorf("could not delete task from spicedb: %w", err), hwutil.PtrTo(esdb.NackActionRetry) + return hwutil.PtrTo(esdb.NackActionRetry), + fmt.Errorf("could not delete task from spicedb: %w", err) } return nil, nil } From b4184e633428adf745899a2a78e8da78e5bed33b Mon Sep 17 00:00:00 2001 From: Max Baumann Date: Fri, 27 Dec 2024 16:18:11 +0100 Subject: [PATCH 5/8] rename repos --- .../commands/v1/attach_property_value.go | 6 +- .../property_value_postgres_projection.go | 42 ++++---- .../v1/get_property_values_by_subject_id.go | 6 +- .../models/patient_property_matcher.go | 18 ++-- .../models/task_property_matchers.go | 18 ++-- .../property_rules_postgres.go | 38 ++++---- .../postgres_projection.go | 44 ++++----- .../v1/get_properties_by_subject_type.go | 6 +- .../property/queries/v1/get_property_by_id.go | 6 +- .../db.go | 2 +- .../models.go | 2 +- .../patient_views_repo.sql.go | 2 +- .../repos/patient_views_repo/db.go | 32 ------- .../{property_repo => property-repo}/batch.go | 2 +- .../{property_repo => property-repo}/db.go | 2 +- .../models.go | 2 +- .../property_repo.sql.go | 2 +- .../batch.go | 2 +- .../db.go | 2 +- .../interfaces.go | 6 +- .../repos/property-value-repo/models.go | 79 +++++++++++++++ .../property_value_repo.sql.go | 2 +- .../repos/property_value_repo/models.go | 79 --------------- .../repos/task-views-repo}/db.go | 2 +- .../models.go | 2 +- .../task_views_repo.sql.go | 2 +- .../{views_repo => views-repo}/copyfrom.go | 2 +- .../repos/{views_repo => views-repo}/db.go | 2 +- .../{views_repo => views-repo}/models.go | 2 +- .../views_repo.sql.go | 2 +- services/property-svc/sqlc.yaml | 20 ++-- services/tasks-svc/internal/bed/bed.go | 34 +++---- .../tasks-svc/internal/patient/api/grpc.go | 6 +- .../patient_postgres_projection.go | 20 ++-- .../v1/get_all_patients_with_details.go | 4 +- .../v1/get_patient_assignment_by_ward.go | 8 +- .../patient/queries/v1/get_patient_by_bed.go | 4 +- .../v1/get_patient_with_details_by_id.go | 4 +- .../queries/v1/get_patients_by_ward.go | 8 +- services/tasks-svc/internal/room/room.go | 28 +++--- .../internal/task-template/task_template.go | 38 ++++---- .../task_postgres_projection.go | 36 +++---- .../queries/v1/get_task_with_patient_by_id.go | 4 +- .../task/queries/v1/get_tasks_by_patient.go | 4 +- .../v1/get_tasks_with_patients_by_asignee.go | 4 +- services/tasks-svc/internal/ward/ward.go | 42 ++++---- .../{bed_repo => bed-repo}/bed_repo.sql.go | 2 +- .../repos/{bed_repo => bed-repo}/db.go | 2 +- .../repos/{bed_repo => bed-repo}/models.go | 4 +- services/tasks-svc/repos/patient-repo/db.go | 32 +++++++ .../tasks-svc/repos/patient-repo/models.go | 87 +++++++++++++++++ .../patient_repo.sql.go | 20 +++- .../repos/{room_repo => room-repo}/db.go | 2 +- .../{patient_repo => room-repo}/models.go | 4 +- .../{room_repo => room-repo}/room_repo.sql.go | 2 +- .../repos/{task_repo => task-repo}/db.go | 2 +- .../repos/{room_repo => task-repo}/models.go | 4 +- .../{task_repo => task-repo}/task_repo.sql.go | 10 +- .../copyfrom.go | 2 +- .../db.go | 2 +- .../repos/task-template-repo/models.go | 87 +++++++++++++++++ .../task_template_repo.sql.go | 2 +- .../repos/task_template_repo/models.go | 85 ---------------- .../repos/{ward_repo => ward-repo}/db.go | 2 +- .../repos/{task_repo => ward-repo}/models.go | 4 +- .../{ward_repo => ward-repo}/ward_repo.sql.go | 2 +- services/tasks-svc/repos/ward_repo/models.go | 85 ---------------- services/tasks-svc/schema.sql | 4 +- services/tasks-svc/sqlc.yaml | 24 ++--- .../internal/organization/organization.go | 96 +++++++++---------- services/user-svc/internal/user/user.go | 8 +- .../user-svc/repos/organization-repo/db.go | 32 +++++++ .../models.go | 2 +- .../organization_repo.sql.go | 2 +- .../user-svc/repos/organization_repo/db.go | 32 ------- services/user-svc/repos/user-repo/db.go | 32 +++++++ .../repos/{user_repo => user-repo}/models.go | 2 +- .../{user_repo => user-repo}/user_repo.sql.go | 2 +- services/user-svc/repos/user_repo/db.go | 32 ------- services/user-svc/sqlc.yaml | 8 +- 80 files changed, 713 insertions(+), 683 deletions(-) rename services/property-svc/repos/{task_views_repo => patient-views-repo}/db.go (95%) rename services/property-svc/repos/{patient_views_repo => patient-views-repo}/models.go (98%) rename services/property-svc/repos/{patient_views_repo => patient-views-repo}/patient_views_repo.sql.go (99%) delete mode 100644 services/property-svc/repos/patient_views_repo/db.go rename services/property-svc/repos/{property_repo => property-repo}/batch.go (99%) rename services/property-svc/repos/{property_repo => property-repo}/db.go (96%) rename services/property-svc/repos/{property_repo => property-repo}/models.go (98%) rename services/property-svc/repos/{property_repo => property-repo}/property_repo.sql.go (99%) rename services/property-svc/repos/{property_value_repo => property-value-repo}/batch.go (98%) rename services/property-svc/repos/{property_value_repo => property-value-repo}/db.go (95%) rename services/property-svc/repos/{property_value_repo => property-value-repo}/interfaces.go (94%) create mode 100644 services/property-svc/repos/property-value-repo/models.go rename services/property-svc/repos/{property_value_repo => property-value-repo}/property_value_repo.sql.go (99%) delete mode 100644 services/property-svc/repos/property_value_repo/models.go rename services/{tasks-svc/repos/patient_repo => property-svc/repos/task-views-repo}/db.go (96%) rename services/property-svc/repos/{task_views_repo => task-views-repo}/models.go (98%) rename services/property-svc/repos/{task_views_repo => task-views-repo}/task_views_repo.sql.go (99%) rename services/property-svc/repos/{views_repo => views-repo}/copyfrom.go (98%) rename services/property-svc/repos/{views_repo => views-repo}/db.go (97%) rename services/property-svc/repos/{views_repo => views-repo}/models.go (98%) rename services/property-svc/repos/{views_repo => views-repo}/views_repo.sql.go (98%) rename services/tasks-svc/repos/{bed_repo => bed-repo}/bed_repo.sql.go (99%) rename services/tasks-svc/repos/{bed_repo => bed-repo}/db.go (97%) rename services/tasks-svc/repos/{bed_repo => bed-repo}/models.go (94%) create mode 100644 services/tasks-svc/repos/patient-repo/db.go create mode 100644 services/tasks-svc/repos/patient-repo/models.go rename services/tasks-svc/repos/{patient_repo => patient-repo}/patient_repo.sql.go (95%) rename services/tasks-svc/repos/{room_repo => room-repo}/db.go (96%) rename services/tasks-svc/repos/{patient_repo => room-repo}/models.go (94%) rename services/tasks-svc/repos/{room_repo => room-repo}/room_repo.sql.go (99%) rename services/tasks-svc/repos/{task_repo => task-repo}/db.go (96%) rename services/tasks-svc/repos/{room_repo => task-repo}/models.go (94%) rename services/tasks-svc/repos/{task_repo => task-repo}/task_repo.sql.go (97%) rename services/tasks-svc/repos/{task_template_repo => task-template-repo}/copyfrom.go (97%) rename services/tasks-svc/repos/{task_template_repo => task-template-repo}/db.go (96%) create mode 100644 services/tasks-svc/repos/task-template-repo/models.go rename services/tasks-svc/repos/{task_template_repo => task-template-repo}/task_template_repo.sql.go (99%) delete mode 100644 services/tasks-svc/repos/task_template_repo/models.go rename services/tasks-svc/repos/{ward_repo => ward-repo}/db.go (96%) rename services/tasks-svc/repos/{task_repo => ward-repo}/models.go (94%) rename services/tasks-svc/repos/{ward_repo => ward-repo}/ward_repo.sql.go (99%) delete mode 100644 services/tasks-svc/repos/ward_repo/models.go create mode 100644 services/user-svc/repos/organization-repo/db.go rename services/user-svc/repos/{organization_repo => organization-repo}/models.go (96%) rename services/user-svc/repos/{organization_repo => organization-repo}/organization_repo.sql.go (99%) delete mode 100644 services/user-svc/repos/organization_repo/db.go create mode 100644 services/user-svc/repos/user-repo/db.go rename services/user-svc/repos/{user_repo => user-repo}/models.go (97%) rename services/user-svc/repos/{user_repo => user-repo}/user_repo.sql.go (98%) delete mode 100644 services/user-svc/repos/user_repo/db.go diff --git a/services/property-svc/internal/property-value/commands/v1/attach_property_value.go b/services/property-svc/internal/property-value/commands/v1/attach_property_value.go index af130f80a..28323a927 100644 --- a/services/property-svc/internal/property-value/commands/v1/attach_property_value.go +++ b/services/property-svc/internal/property-value/commands/v1/attach_property_value.go @@ -15,7 +15,7 @@ import ( "github.com/google/uuid" "property-svc/internal/property-value/aggregate" - "property-svc/repos/property_value_repo" + "property-svc/repos/property-value-repo" ) type AttachPropertyValueCommandHandler func( @@ -42,11 +42,11 @@ func NewAttachPropertyValueCommandHandler( return 0, err } - propertyValueRepo := property_value_repo.New(hwdb.GetDB()) + propertyValueRepo := propertyvaluerepo.New(hwdb.GetDB()) var a *aggregate.PropertyValueAggregate query := hwdb.Optional(propertyValueRepo.GetPropertyValueBySubjectIDAndPropertyID) - existingPropertyValueID, err := query(ctx, property_value_repo.GetPropertyValueBySubjectIDAndPropertyIDParams{ + existingPropertyValueID, err := query(ctx, propertyvaluerepo.GetPropertyValueBySubjectIDAndPropertyIDParams{ PropertyID: propertyID, SubjectID: subjectID, }) diff --git a/services/property-svc/internal/property-value/projections/postgres-projection/property_value_postgres_projection.go b/services/property-svc/internal/property-value/projections/postgres-projection/property_value_postgres_projection.go index 6498beaa4..91a1f8d34 100644 --- a/services/property-svc/internal/property-value/projections/postgres-projection/property_value_postgres_projection.go +++ b/services/property-svc/internal/property-value/projections/postgres-projection/property_value_postgres_projection.go @@ -15,15 +15,15 @@ import ( "property-svc/internal/property-value/aggregate" propertyValueEventsV1 "property-svc/internal/property-value/events/v1" "property-svc/internal/property-value/models" - "property-svc/repos/property_repo" - "property-svc/repos/property_value_repo" + "property-svc/repos/property-repo" + "property-svc/repos/property-value-repo" ) type Projection struct { *custom.CustomProjection db hwdb.DBTX - propertyRepo *property_repo.Queries - propertyValueRepo *property_value_repo.Queries + propertyRepo *propertyrepo.Queries + propertyValueRepo *propertyvaluerepo.Queries } func NewProjection(es *esdb.Client, serviceName string, db hwdb.DBTX) *Projection { @@ -35,8 +35,8 @@ func NewProjection(es *esdb.Client, serviceName string, db hwdb.DBTX) *Projectio &[]string{aggregate.PropertyValueAggregateType + "-"}, ), db: db, - propertyRepo: property_repo.New(db), - propertyValueRepo: property_value_repo.New(db), + propertyRepo: propertyrepo.New(db), + propertyValueRepo: propertyvaluerepo.New(db), } p.initEventListeners() return p @@ -95,14 +95,14 @@ func (p *Projection) onPropertyValueCreated(ctx context.Context, evt hwes.Event) isMultiSelectChange := change.MultiSelectValues != nil if isSingleSelectChange || isMultiSelectChange { - var selectsToAdd []property_value_repo.ConnectValueWithSelectOptionsParams + var selectsToAdd []propertyvaluerepo.ConnectValueWithSelectOptionsParams if isSingleSelectChange { id, err := uuid.Parse(*change.SingleSelectValue) if err != nil { return hwutil.PtrTo(esdb.NackActionSkip), fmt.Errorf("option change is not a uuid: %w", err) } - selectsToAdd = []property_value_repo.ConnectValueWithSelectOptionsParams{ + selectsToAdd = []propertyvaluerepo.ConnectValueWithSelectOptionsParams{ {ValueID: evt.AggregateID, SelectOption: id}, } } else { // isMultiSelectChange @@ -112,8 +112,8 @@ func (p *Projection) onPropertyValueCreated(ctx context.Context, evt hwes.Event) return hwutil.PtrTo(esdb.NackActionPark), fmt.Errorf("onPropertyValueCreated: at least one select option uuid could not be parsed: %w", err) } - selectsToAdd = hwutil.Map(ids, func(id uuid.UUID) property_value_repo.ConnectValueWithSelectOptionsParams { - return property_value_repo.ConnectValueWithSelectOptionsParams{ + selectsToAdd = hwutil.Map(ids, func(id uuid.UUID) propertyvaluerepo.ConnectValueWithSelectOptionsParams { + return propertyvaluerepo.ConnectValueWithSelectOptionsParams{ ValueID: evt.AggregateID, SelectOption: id, } @@ -138,13 +138,13 @@ func (p *Projection) onPropertyValueCreated(ctx context.Context, evt hwes.Event) func createBasicPropertyValue( ctx context.Context, evt hwes.Event, - repo *property_value_repo.Queries, + repo *propertyvaluerepo.Queries, valueChange models.TypedValueChange, propertyID, aggregateID, subjectID uuid.UUID, ) (*esdb.NackAction, error) { - createPropertyValueParams := property_value_repo.CreateBasicPropertyValueParams{ + createPropertyValueParams := propertyvaluerepo.CreateBasicPropertyValueParams{ ID: aggregateID, PropertyID: propertyID, SubjectID: subjectID, @@ -220,7 +220,7 @@ func updateSelectPropertyValue( } defer rollback() - propertyValueRepo := property_value_repo.New(tx) + propertyValueRepo := propertyvaluerepo.New(tx) var toAdd []uuid.UUID if valueChange.SingleSelectValue != nil { @@ -249,12 +249,12 @@ func updateSelectPropertyValue( // delete requested options if len(val.RemoveSelectValues) != 0 { arr, err := hwutil.MapWithErr(val.RemoveSelectValues, - func(s string) (property_value_repo.DisconnectValueFromSelectOptionsParams, error) { + func(s string) (propertyvaluerepo.DisconnectValueFromSelectOptionsParams, error) { id, err := uuid.Parse(s) if err != nil { - return property_value_repo.DisconnectValueFromSelectOptionsParams{}, err + return propertyvaluerepo.DisconnectValueFromSelectOptionsParams{}, err } - return property_value_repo.DisconnectValueFromSelectOptionsParams{ + return propertyvaluerepo.DisconnectValueFromSelectOptionsParams{ ValueID: aggregateID, SelectOption: id, }, nil @@ -271,8 +271,8 @@ func updateSelectPropertyValue( } // add new connection - args := hwutil.Map(toAdd, func(id uuid.UUID) property_value_repo.ConnectValueWithSelectOptionsParams { - return property_value_repo.ConnectValueWithSelectOptionsParams{ + args := hwutil.Map(toAdd, func(id uuid.UUID) propertyvaluerepo.ConnectValueWithSelectOptionsParams { + return propertyvaluerepo.ConnectValueWithSelectOptionsParams{ ValueID: evt.AggregateID, SelectOption: id, } @@ -283,7 +283,7 @@ func updateSelectPropertyValue( } // update consistency - err = propertyValueRepo.UpdatePropertyValueByID(ctx, property_value_repo.UpdatePropertyValueByIDParams{ + err = propertyValueRepo.UpdatePropertyValueByID(ctx, propertyvaluerepo.UpdatePropertyValueByIDParams{ ID: evt.AggregateID, Consistency: int64(evt.GetVersion()), //nolint:gosec }) @@ -303,12 +303,12 @@ func updateSelectPropertyValue( func updateBasicPropertyValue( ctx context.Context, evt hwes.Event, - repo *property_value_repo.Queries, + repo *propertyvaluerepo.Queries, valueChange models.TypedValueChange, ) (*esdb.NackAction, error) { aggregateID := evt.AggregateID - updatePropertyValueParams := property_value_repo.UpdatePropertyValueByIDParams{ + updatePropertyValueParams := propertyvaluerepo.UpdatePropertyValueByIDParams{ ID: aggregateID, Consistency: int64(evt.GetVersion()), //nolint:gosec } diff --git a/services/property-svc/internal/property-value/queries/v1/get_property_values_by_subject_id.go b/services/property-svc/internal/property-value/queries/v1/get_property_values_by_subject_id.go index 187b5a7a2..5df2824e9 100644 --- a/services/property-svc/internal/property-value/queries/v1/get_property_values_by_subject_id.go +++ b/services/property-svc/internal/property-value/queries/v1/get_property_values_by_subject_id.go @@ -20,7 +20,7 @@ import ( "property-svc/internal/property-value/models" vh "property-svc/internal/property-view/handlers" viewModels "property-svc/internal/property-view/models" - "property-svc/repos/property_value_repo" + "property-svc/repos/property-value-repo" ) type GetRelevantPropertyValuesQueryHandler func( @@ -33,7 +33,7 @@ func NewGetRelevantPropertyValuesQueryHandler( ) GetRelevantPropertyValuesQueryHandler { return func(ctx context.Context, matcher viewModels.PropertyMatchers) ([]models.PropertyAndValue, error) { viewHandlers := vh.NewPropertyViewHandlers(as, authz) - propertyValueRepo := property_value_repo.New(hwdb.GetDB()) + propertyValueRepo := propertyvaluerepo.New(hwdb.GetDB()) subjectID, err := matcher.GetSubjectID() if err != nil { @@ -50,7 +50,7 @@ func NewGetRelevantPropertyValuesQueryHandler( propertyValuesWithProperties, err := propertyValueRepo.GetRelevantPropertyViews( ctx, - property_value_repo.GetRelevantPropertyViewsParams{ + propertyvaluerepo.GetRelevantPropertyViewsParams{ SubjectID: subjectID, AlwaysInclude: alwaysInclude, }) diff --git a/services/property-svc/internal/property-view/models/patient_property_matcher.go b/services/property-svc/internal/property-view/models/patient_property_matcher.go index 37234ef98..74c93d088 100644 --- a/services/property-svc/internal/property-view/models/patient_property_matcher.go +++ b/services/property-svc/internal/property-view/models/patient_property_matcher.go @@ -12,7 +12,7 @@ import ( "github.com/google/uuid" - "property-svc/repos/patient_views_repo" + "property-svc/repos/patient-views-repo" ) const PatientPropertyMatcherType = "patient_property_matcher" @@ -23,16 +23,16 @@ type PatientPropertyMatchers struct { } func (m PatientPropertyMatchers) FindExactRuleID(ctx context.Context) (*uuid.UUID, error) { - patientViews := patient_views_repo.New(hwdb.GetDB()) + patientViews := patientviewsrepo.New(hwdb.GetDB()) return hwdb.Optional(patientViews.GetPatientRuleIdUsingExactMatchers)(ctx, - patient_views_repo.GetPatientRuleIdUsingExactMatchersParams{ + patientviewsrepo.GetPatientRuleIdUsingExactMatchersParams{ WardID: m.WardID, PatientID: m.PatientID, }) } type queryPatientPropertiesRow struct { - patient_views_repo.GetPatientPropertiesUsingMatchersRow + patientviewsrepo.GetPatientPropertiesUsingMatchersRow } func (r queryPatientPropertiesRow) GetPropertyID() uuid.UUID { @@ -52,16 +52,16 @@ func (m PatientPropertyMatchers) GetType() string { } func (m PatientPropertyMatchers) QueryProperties(ctx context.Context) ([]PropertiesQueryRow, error) { - patientViews := patient_views_repo.New(hwdb.GetDB()) + patientViews := patientviewsrepo.New(hwdb.GetDB()) rows, err := patientViews.GetPatientPropertiesUsingMatchers( ctx, - patient_views_repo.GetPatientPropertiesUsingMatchersParams{ + patientviewsrepo.GetPatientPropertiesUsingMatchersParams{ WardID: m.WardID, PatientID: m.PatientID, }) - cast := func(row patient_views_repo.GetPatientPropertiesUsingMatchersRow) PropertiesQueryRow { + cast := func(row patientviewsrepo.GetPatientPropertiesUsingMatchersRow) PropertiesQueryRow { return queryPatientPropertiesRow{row} } @@ -96,9 +96,9 @@ func (m PatientPropertyMatchers) ToMap() map[string]interface{} { } func (m PatientPropertyMatchers) IsPropertyAlwaysIncluded(ctx context.Context, propertyID uuid.UUID) (bool, error) { - repo := patient_views_repo.New(hwdb.GetDB()) + repo := patientviewsrepo.New(hwdb.GetDB()) query := hwdb.Optional(repo.IsPatientPropertyAlwaysIncluded) - alwaysInclude, err := query(ctx, patient_views_repo.IsPatientPropertyAlwaysIncludedParams{ + alwaysInclude, err := query(ctx, patientviewsrepo.IsPatientPropertyAlwaysIncludedParams{ PropertyID: propertyID, WardID: m.WardID, PatientID: m.PatientID, diff --git a/services/property-svc/internal/property-view/models/task_property_matchers.go b/services/property-svc/internal/property-view/models/task_property_matchers.go index 38c7a90a2..ed2e037ed 100644 --- a/services/property-svc/internal/property-view/models/task_property_matchers.go +++ b/services/property-svc/internal/property-view/models/task_property_matchers.go @@ -10,7 +10,7 @@ import ( "property-svc/internal/property-view/perm" - "property-svc/repos/task_views_repo" + "property-svc/repos/task-views-repo" "github.com/google/uuid" ) @@ -24,16 +24,16 @@ type TaskPropertyMatchers struct { } func (m TaskPropertyMatchers) FindExactRuleID(ctx context.Context) (*uuid.UUID, error) { - taskViews := task_views_repo.New(hwdb.GetDB()) + taskViews := taskviewsrepo.New(hwdb.GetDB()) return hwdb.Optional(taskViews.GetTaskRuleIdUsingExactMatchers)(ctx, - task_views_repo.GetTaskRuleIdUsingExactMatchersParams{ + taskviewsrepo.GetTaskRuleIdUsingExactMatchersParams{ WardID: m.WardID, TaskID: m.TaskID, }) } type queryTaskPropertiesRow struct { - task_views_repo.GetTaskPropertiesUsingMatchersRow + taskviewsrepo.GetTaskPropertiesUsingMatchersRow } func (r queryTaskPropertiesRow) GetPropertyID() uuid.UUID { @@ -53,14 +53,14 @@ func (m TaskPropertyMatchers) GetType() string { } func (m TaskPropertyMatchers) QueryProperties(ctx context.Context) ([]PropertiesQueryRow, error) { - taskViews := task_views_repo.New(hwdb.GetDB()) + taskViews := taskviewsrepo.New(hwdb.GetDB()) - rows, err := taskViews.GetTaskPropertiesUsingMatchers(ctx, task_views_repo.GetTaskPropertiesUsingMatchersParams{ + rows, err := taskViews.GetTaskPropertiesUsingMatchers(ctx, taskviewsrepo.GetTaskPropertiesUsingMatchersParams{ WardID: m.WardID, TaskID: m.TaskID, }) - cast := func(row task_views_repo.GetTaskPropertiesUsingMatchersRow) PropertiesQueryRow { + cast := func(row taskviewsrepo.GetTaskPropertiesUsingMatchersRow) PropertiesQueryRow { return queryTaskPropertiesRow{row} } @@ -95,9 +95,9 @@ func (m TaskPropertyMatchers) ToMap() map[string]interface{} { } func (m TaskPropertyMatchers) IsPropertyAlwaysIncluded(ctx context.Context, propertyID uuid.UUID) (bool, error) { - repo := task_views_repo.New(hwdb.GetDB()) + repo := taskviewsrepo.New(hwdb.GetDB()) query := hwdb.Optional(repo.IsTaskPropertyAlwaysIncluded) - alwaysInclude, err := query(ctx, task_views_repo.IsTaskPropertyAlwaysIncludedParams{ + alwaysInclude, err := query(ctx, taskviewsrepo.IsTaskPropertyAlwaysIncludedParams{ PropertyID: propertyID, WardID: m.WardID, TaskID: m.TaskID, diff --git a/services/property-svc/internal/property-view/projections/postgres-projection/property_rules_postgres.go b/services/property-svc/internal/property-view/projections/postgres-projection/property_rules_postgres.go index b490e9ce3..c1238aa29 100644 --- a/services/property-svc/internal/property-view/projections/postgres-projection/property_rules_postgres.go +++ b/services/property-svc/internal/property-view/projections/postgres-projection/property_rules_postgres.go @@ -18,17 +18,17 @@ import ( "property-svc/internal/property-view/aggregate" eventsV1 "property-svc/internal/property-view/events/v1" "property-svc/internal/property-view/models" - "property-svc/repos/patient_views_repo" - "property-svc/repos/task_views_repo" - "property-svc/repos/views_repo" + "property-svc/repos/patient-views-repo" + "property-svc/repos/task-views-repo" + "property-svc/repos/views-repo" ) type Projection struct { *custom.CustomProjection db hwdb.DBTX - taskViewsRepo *task_views_repo.Queries - patientViewsRepo *patient_views_repo.Queries - viewsRepo *views_repo.Queries + taskViewsRepo *taskviewsrepo.Queries + patientViewsRepo *patientviewsrepo.Queries + viewsRepo *viewsrepo.Queries } func NewProjection(es custom.EventStoreClient, serviceName string) *Projection { @@ -40,8 +40,8 @@ func NewProjection(es custom.EventStoreClient, serviceName string) *Projection { &[]string{aggregate.PropertyViewRuleAggregateType + "-"}, ), db: hwdb.GetDB(), - taskViewsRepo: task_views_repo.New(hwdb.GetDB()), - viewsRepo: views_repo.New(hwdb.GetDB()), + taskViewsRepo: taskviewsrepo.New(hwdb.GetDB()), + viewsRepo: viewsrepo.New(hwdb.GetDB()), } p.initEventListeners() return p @@ -92,7 +92,7 @@ func (p *Projection) onPropertyRuleCreated(ctx context.Context, evt hwes.Event) switch matchers := payload.Matchers.(type) { case models.TaskPropertyMatchers: taskViewsQuery := p.taskViewsRepo.WithTx(tx) - err = taskViewsQuery.CreateTaskRule(ctx, task_views_repo.CreateTaskRuleParams{ + err = taskViewsQuery.CreateTaskRule(ctx, taskviewsrepo.CreateTaskRuleParams{ RuleID: payload.RuleID, WardID: matchers.WardID, TaskID: matchers.TaskID, @@ -103,7 +103,7 @@ func (p *Projection) onPropertyRuleCreated(ctx context.Context, evt hwes.Event) } case models.PatientPropertyMatchers: patientViewsQuery := p.patientViewsRepo.WithTx(tx) - err = patientViewsQuery.CreatePatientRule(ctx, patient_views_repo.CreatePatientRuleParams{ + err = patientViewsQuery.CreatePatientRule(ctx, patientviewsrepo.CreatePatientRuleParams{ RuleID: payload.RuleID, WardID: matchers.WardID, PatientID: matchers.PatientID, @@ -117,9 +117,9 @@ func (p *Projection) onPropertyRuleCreated(ctx context.Context, evt hwes.Event) } // handle (dont)alwaysInclude logic - mapper := func(dontAlwaysInclude bool) func(uuid.UUID) views_repo.AddToAlwaysIncludeParams { - return func(propertyId uuid.UUID) views_repo.AddToAlwaysIncludeParams { - return views_repo.AddToAlwaysIncludeParams{ + mapper := func(dontAlwaysInclude bool) func(uuid.UUID) viewsrepo.AddToAlwaysIncludeParams { + return func(propertyId uuid.UUID) viewsrepo.AddToAlwaysIncludeParams { + return viewsrepo.AddToAlwaysIncludeParams{ RuleID: payload.RuleID, PropertyID: propertyId, DontAlwaysInclude: dontAlwaysInclude, @@ -176,9 +176,9 @@ func (p *Projection) onPropertyRuleListsUpdated(ctx context.Context, evt hwes.Ev return !inRemove && inRemoveFromDont }) - mapper := func(dontAlwaysInclude bool) func(uuid.UUID) views_repo.AddToAlwaysIncludeParams { - return func(propertyId uuid.UUID) views_repo.AddToAlwaysIncludeParams { - return views_repo.AddToAlwaysIncludeParams{ + mapper := func(dontAlwaysInclude bool) func(uuid.UUID) viewsrepo.AddToAlwaysIncludeParams { + return func(propertyId uuid.UUID) viewsrepo.AddToAlwaysIncludeParams { + return viewsrepo.AddToAlwaysIncludeParams{ RuleID: payload.RuleID, PropertyID: propertyId, DontAlwaysInclude: dontAlwaysInclude, @@ -192,9 +192,9 @@ func (p *Projection) onPropertyRuleListsUpdated(ctx context.Context, evt hwes.Ev // before we can add new items, we have to make sure they don't already exist, or the whole copy operation will be // canceled - err = viewsQuery.DeleteFromAlwaysInclude(ctx, views_repo.DeleteFromAlwaysIncludeParams{ + err = viewsQuery.DeleteFromAlwaysInclude(ctx, viewsrepo.DeleteFromAlwaysIncludeParams{ RuleID: payload.RuleID, - PropertyIds: hwutil.Map(toAppend, func(p views_repo.AddToAlwaysIncludeParams) uuid.UUID { + PropertyIds: hwutil.Map(toAppend, func(p viewsrepo.AddToAlwaysIncludeParams) uuid.UUID { return p.PropertyID }), }) @@ -212,7 +212,7 @@ func (p *Projection) onPropertyRuleListsUpdated(ctx context.Context, evt hwes.Ev // finally, remove things from the lists // we can not merge this with above queries, as we might have to remove things we just added - err = viewsQuery.DeleteFromAlwaysInclude(ctx, views_repo.DeleteFromAlwaysIncludeParams{ + err = viewsQuery.DeleteFromAlwaysInclude(ctx, viewsrepo.DeleteFromAlwaysIncludeParams{ RuleID: payload.RuleID, PropertyIds: append(payload.RemoveFromAlwaysInclude, payload.RemoveFromDontAlwaysInclude...), }) diff --git a/services/property-svc/internal/property/projections/postgres-projection/postgres_projection.go b/services/property-svc/internal/property/projections/postgres-projection/postgres_projection.go index 83df38b3e..9c36e3b19 100644 --- a/services/property-svc/internal/property/projections/postgres-projection/postgres_projection.go +++ b/services/property-svc/internal/property/projections/postgres-projection/postgres_projection.go @@ -19,13 +19,13 @@ import ( "property-svc/internal/property/aggregate" propertyEventsV1 "property-svc/internal/property/events/v1" "property-svc/internal/property/models" - "property-svc/repos/property_repo" + "property-svc/repos/property-repo" ) type Projection struct { *custom.CustomProjection db hwdb.DBTX - propertyRepo *property_repo.Queries + propertyRepo *propertyrepo.Queries } func NewProjection(es *esdb.Client, serviceName string, db hwdb.DBTX) *Projection { @@ -37,7 +37,7 @@ func NewProjection(es *esdb.Client, serviceName string, db hwdb.DBTX) *Projectio &[]string{aggregate.PropertyAggregateType + "-"}, ), db: db, - propertyRepo: property_repo.New(db), + propertyRepo: propertyrepo.New(db), } p.initEventListeners() @@ -98,7 +98,7 @@ func (p *Projection) onPropertyCreated(ctx context.Context, evt hwes.Event) (*es } // create query - err = p.propertyRepo.CreateProperty(ctx, property_repo.CreatePropertyParams{ + err = p.propertyRepo.CreateProperty(ctx, propertyrepo.CreatePropertyParams{ ID: propertyID, SubjectType: int32(subjectType), FieldType: int32(fieldType), @@ -125,7 +125,7 @@ func (p *Projection) onPropertyDescriptionUpdated(ctx context.Context, evt hwes. return hwutil.PtrTo(esdb.NackActionPark), err } - err := p.propertyRepo.UpdateProperty(ctx, property_repo.UpdatePropertyParams{ + err := p.propertyRepo.UpdateProperty(ctx, propertyrepo.UpdatePropertyParams{ ID: evt.AggregateID, Description: &payload.Description, Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -156,7 +156,7 @@ func (p *Projection) onPropertySetIDUpdated(ctx context.Context, evt hwes.Event) } } - err := p.propertyRepo.UpdatePropertySetID(ctx, property_repo.UpdatePropertySetIDParams{ + err := p.propertyRepo.UpdatePropertySetID(ctx, propertyrepo.UpdatePropertySetIDParams{ ID: evt.AggregateID, SetID: setID, Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -183,7 +183,7 @@ func (p *Projection) onSubjectTypeUpdated(ctx context.Context, evt hwes.Event) ( return hwutil.PtrTo(esdb.NackActionPark), err } - err = p.propertyRepo.UpdateProperty(ctx, property_repo.UpdatePropertyParams{ + err = p.propertyRepo.UpdateProperty(ctx, propertyrepo.UpdatePropertyParams{ ID: evt.AggregateID, SubjectType: hwutil.PtrTo(int32(subjectType)), Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -205,7 +205,7 @@ func (p *Projection) onNameUpdated(ctx context.Context, evt hwes.Event) (*esdb.N return hwutil.PtrTo(esdb.NackActionPark), err } - err := p.propertyRepo.UpdateProperty(ctx, property_repo.UpdatePropertyParams{ + err := p.propertyRepo.UpdateProperty(ctx, propertyrepo.UpdatePropertyParams{ ID: evt.AggregateID, Name: &payload.Name, Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -219,7 +219,7 @@ func (p *Projection) onNameUpdated(ctx context.Context, evt hwes.Event) (*esdb.N } func (p *Projection) onPropertyArchived(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { - err := p.propertyRepo.UpdateProperty(ctx, property_repo.UpdatePropertyParams{ + err := p.propertyRepo.UpdateProperty(ctx, propertyrepo.UpdatePropertyParams{ ID: evt.GetAggregateID(), IsArchived: hwutil.PtrTo(true), Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -232,7 +232,7 @@ func (p *Projection) onPropertyArchived(ctx context.Context, evt hwes.Event) (*e } func (p *Projection) onPropertyRetrieved(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { - err := p.propertyRepo.UpdateProperty(ctx, property_repo.UpdatePropertyParams{ + err := p.propertyRepo.UpdateProperty(ctx, propertyrepo.UpdatePropertyParams{ ID: evt.GetAggregateID(), IsArchived: hwutil.PtrTo(false), Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -265,7 +265,7 @@ func (p *Projection) onPropertyFieldTypeDataCreated(ctx context.Context, evt hwe return hwutil.PtrTo(esdb.NackActionRetry), err } for _, option := range payload.FieldTypeData.SelectData.SelectOptions { - err := propertyRepo.CreateSelectOption(ctx, property_repo.CreateSelectOptionParams{ + err := propertyRepo.CreateSelectOption(ctx, propertyrepo.CreateSelectOptionParams{ ID: option.ID, Name: option.Name, Description: option.Description, @@ -278,7 +278,7 @@ func (p *Projection) onPropertyFieldTypeDataCreated(ctx context.Context, evt hwe } // Update Property SelectDataId - err = propertyRepo.UpdatePropertySelectDataID(ctx, property_repo.UpdatePropertySelectDataIDParams{ + err = propertyRepo.UpdatePropertySelectDataID(ctx, propertyrepo.UpdatePropertySelectDataIDParams{ ID: evt.AggregateID, SelectDataID: uuid.NullUUID{UUID: selectDataID, Valid: true}, Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -316,7 +316,7 @@ func (p *Projection) onAllowFreetextUpdated(ctx context.Context, evt hwes.Event) } if property.SelectDataID.Valid { - err := propertyRepo.UpdateSelectData(ctx, property_repo.UpdateSelectDataParams{ + err := propertyRepo.UpdateSelectData(ctx, propertyrepo.UpdateSelectDataParams{ ID: property.SelectDataID.UUID, AllowFreetext: payload.NewAllowFreetext, Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -331,7 +331,7 @@ func (p *Projection) onAllowFreetextUpdated(ctx context.Context, evt hwes.Event) if err := hwdb.Error(ctx, err); err != nil { return hwutil.PtrTo(esdb.NackActionRetry), err } - err = propertyRepo.UpdatePropertySelectDataID(ctx, property_repo.UpdatePropertySelectDataIDParams{ + err = propertyRepo.UpdatePropertySelectDataID(ctx, propertyrepo.UpdatePropertySelectDataIDParams{ ID: evt.AggregateID, SelectDataID: uuid.NullUUID{UUID: sdID, Valid: true}, Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -379,7 +379,7 @@ func (p *Projection) onFieldTypeDataSelectOptionsUpserted( if err := hwdb.Error(ctx, err); err != nil { return hwutil.PtrTo(esdb.NackActionRetry), err } - err = propertyRepo.UpdatePropertySelectDataID(ctx, property_repo.UpdatePropertySelectDataIDParams{ + err = propertyRepo.UpdatePropertySelectDataID(ctx, propertyrepo.UpdatePropertySelectDataIDParams{ ID: evt.AggregateID, SelectDataID: uuid.NullUUID{UUID: sdID, Valid: true}, Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -406,7 +406,7 @@ func (p *Projection) onFieldTypeDataSelectOptionsUpserted( // Check for existing SelectOptions var existsBatchErr error existsBatch := propertyRepo.GetSelectOptionsBatch(ctx, selectOptionsID) - existsBatch.QueryRow(func(idx int, row property_repo.SelectOption, err error) { + existsBatch.QueryRow(func(idx int, row propertyrepo.SelectOption, err error) { if err != nil && !errors.Is(err, pgx.ErrNoRows) { existsBatchErr = err return @@ -424,12 +424,12 @@ func (p *Projection) onFieldTypeDataSelectOptionsUpserted( return hwutil.PtrTo(esdb.NackActionRetry), err } - var existingSelectOptions []property_repo.UpdateSelectOptionsBatchParams - var newSelectOptions []property_repo.InsertSelectOptionsBatchParams + var existingSelectOptions []propertyrepo.UpdateSelectOptionsBatchParams + var newSelectOptions []propertyrepo.InsertSelectOptionsBatchParams for idx, exists := range existsSelectOptions { selOpt := selectOptions[idx] if exists { - existingSelectOptions = append(existingSelectOptions, property_repo.UpdateSelectOptionsBatchParams{ + existingSelectOptions = append(existingSelectOptions, propertyrepo.UpdateSelectOptionsBatchParams{ ID: selOpt.ID, Name: selOpt.Name, Description: selOpt.Description, @@ -441,7 +441,7 @@ func (p *Projection) onFieldTypeDataSelectOptionsUpserted( // existsSelectOptions gets modified by a database result. That's why we are retrying here. return hwutil.PtrTo(esdb.NackActionRetry), nil } - newSelectOptions = append(newSelectOptions, property_repo.InsertSelectOptionsBatchParams{ + newSelectOptions = append(newSelectOptions, propertyrepo.InsertSelectOptionsBatchParams{ ID: selOpt.ID, Name: *selOpt.Name, Description: selOpt.Description, @@ -486,7 +486,7 @@ func (p *Projection) onFieldTypeDataSelectOptionsUpserted( } // update property consistency - err = propertyRepo.UpdateProperty(ctx, property_repo.UpdatePropertyParams{ + err = propertyRepo.UpdateProperty(ctx, propertyrepo.UpdatePropertyParams{ ID: evt.AggregateID, Consistency: int64(evt.GetVersion()), //nolint:gosec }) @@ -547,7 +547,7 @@ func (p *Projection) onFieldTypeDataSelectOptionsRemoved( } // update property consistency - err = propertyRepo.UpdateProperty(ctx, property_repo.UpdatePropertyParams{ + err = propertyRepo.UpdateProperty(ctx, propertyrepo.UpdatePropertyParams{ ID: evt.AggregateID, Consistency: int64(evt.GetVersion()), //nolint:gosec }) diff --git a/services/property-svc/internal/property/queries/v1/get_properties_by_subject_type.go b/services/property-svc/internal/property/queries/v1/get_properties_by_subject_type.go index f5a3fdc7a..b5925b527 100644 --- a/services/property-svc/internal/property/queries/v1/get_properties_by_subject_type.go +++ b/services/property-svc/internal/property/queries/v1/get_properties_by_subject_type.go @@ -13,7 +13,7 @@ import ( "property-svc/internal/property/models" "property-svc/internal/property/perm" - "property-svc/repos/property_repo" + "property-svc/repos/property-repo" ) type GetPropertiesQueryHandler func( @@ -25,7 +25,7 @@ func NewGetPropertiesQueryHandler(authz hwauthz.AuthZ) GetPropertiesQueryHandler return func(ctx context.Context, subjectType *pb.SubjectType) ([]*models.PropertyWithConsistency, error) { user := commonperm.UserFromCtx(ctx) - propertyRepo := property_repo.New(hwdb.GetDB()) + propertyRepo := propertyrepo.New(hwdb.GetDB()) var subjectTypeID *int32 if subjectType != nil { @@ -34,7 +34,7 @@ func NewGetPropertiesQueryHandler(authz hwauthz.AuthZ) GetPropertiesQueryHandler rows, err := propertyRepo.GetPropertiesWithSelectDataAndOptionsBySubjectTypeOrID( ctx, - property_repo.GetPropertiesWithSelectDataAndOptionsBySubjectTypeOrIDParams{ + propertyrepo.GetPropertiesWithSelectDataAndOptionsBySubjectTypeOrIDParams{ SubjectType: subjectTypeID, }) if err := hwdb.Error(ctx, err); err != nil { diff --git a/services/property-svc/internal/property/queries/v1/get_property_by_id.go b/services/property-svc/internal/property/queries/v1/get_property_by_id.go index c5bf52b18..d1644fe29 100644 --- a/services/property-svc/internal/property/queries/v1/get_property_by_id.go +++ b/services/property-svc/internal/property/queries/v1/get_property_by_id.go @@ -13,7 +13,7 @@ import ( "property-svc/internal/property/models" "property-svc/internal/property/perm" - "property-svc/repos/property_repo" + "property-svc/repos/property-repo" ) type GetPropertyByIDQueryHandler func( @@ -31,11 +31,11 @@ func NewGetPropertyByIDQueryHandler(authz hwauthz.AuthZ) GetPropertyByIDQueryHan return nil, 0, err } - propertyRepo := property_repo.New(hwdb.GetDB()) + propertyRepo := propertyrepo.New(hwdb.GetDB()) rows, err := propertyRepo.GetPropertiesWithSelectDataAndOptionsBySubjectTypeOrID( ctx, - property_repo.GetPropertiesWithSelectDataAndOptionsBySubjectTypeOrIDParams{ + propertyrepo.GetPropertiesWithSelectDataAndOptionsBySubjectTypeOrIDParams{ ID: uuid.NullUUID{UUID: propertyID, Valid: true}, }) if err := hwdb.Error(ctx, err); err != nil { diff --git a/services/property-svc/repos/task_views_repo/db.go b/services/property-svc/repos/patient-views-repo/db.go similarity index 95% rename from services/property-svc/repos/task_views_repo/db.go rename to services/property-svc/repos/patient-views-repo/db.go index 33c0c77ae..c4e195dbb 100644 --- a/services/property-svc/repos/task_views_repo/db.go +++ b/services/property-svc/repos/patient-views-repo/db.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package task_views_repo +package patientviewsrepo import ( "context" diff --git a/services/property-svc/repos/patient_views_repo/models.go b/services/property-svc/repos/patient-views-repo/models.go similarity index 98% rename from services/property-svc/repos/patient_views_repo/models.go rename to services/property-svc/repos/patient-views-repo/models.go index 975bc7ac3..e8d3a4367 100644 --- a/services/property-svc/repos/patient_views_repo/models.go +++ b/services/property-svc/repos/patient-views-repo/models.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package patient_views_repo +package patientviewsrepo import ( "github.com/google/uuid" diff --git a/services/property-svc/repos/patient_views_repo/patient_views_repo.sql.go b/services/property-svc/repos/patient-views-repo/patient_views_repo.sql.go similarity index 99% rename from services/property-svc/repos/patient_views_repo/patient_views_repo.sql.go rename to services/property-svc/repos/patient-views-repo/patient_views_repo.sql.go index fb822027b..e12e0224e 100644 --- a/services/property-svc/repos/patient_views_repo/patient_views_repo.sql.go +++ b/services/property-svc/repos/patient-views-repo/patient_views_repo.sql.go @@ -3,7 +3,7 @@ // sqlc v1.27.0 // source: patient_views_repo.sql -package patient_views_repo +package patientviewsrepo import ( "context" diff --git a/services/property-svc/repos/patient_views_repo/db.go b/services/property-svc/repos/patient_views_repo/db.go deleted file mode 100644 index 632b819a5..000000000 --- a/services/property-svc/repos/patient_views_repo/db.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.27.0 - -package patient_views_repo - -import ( - "context" - - "github.com/jackc/pgx/v5" - "github.com/jackc/pgx/v5/pgconn" -) - -type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row -} - -func New(db DBTX) *Queries { - return &Queries{db: db} -} - -type Queries struct { - db DBTX -} - -func (q *Queries) WithTx(tx pgx.Tx) *Queries { - return &Queries{ - db: tx, - } -} diff --git a/services/property-svc/repos/property_repo/batch.go b/services/property-svc/repos/property-repo/batch.go similarity index 99% rename from services/property-svc/repos/property_repo/batch.go rename to services/property-svc/repos/property-repo/batch.go index 83a881ea5..47905a920 100644 --- a/services/property-svc/repos/property_repo/batch.go +++ b/services/property-svc/repos/property-repo/batch.go @@ -3,7 +3,7 @@ // sqlc v1.27.0 // source: batch.go -package property_repo +package propertyrepo import ( "context" diff --git a/services/property-svc/repos/property_repo/db.go b/services/property-svc/repos/property-repo/db.go similarity index 96% rename from services/property-svc/repos/property_repo/db.go rename to services/property-svc/repos/property-repo/db.go index 811e39537..2b687987c 100644 --- a/services/property-svc/repos/property_repo/db.go +++ b/services/property-svc/repos/property-repo/db.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package property_repo +package propertyrepo import ( "context" diff --git a/services/property-svc/repos/property_repo/models.go b/services/property-svc/repos/property-repo/models.go similarity index 98% rename from services/property-svc/repos/property_repo/models.go rename to services/property-svc/repos/property-repo/models.go index 28a1f1ceb..ac938ef41 100644 --- a/services/property-svc/repos/property_repo/models.go +++ b/services/property-svc/repos/property-repo/models.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package property_repo +package propertyrepo import ( "github.com/google/uuid" diff --git a/services/property-svc/repos/property_repo/property_repo.sql.go b/services/property-svc/repos/property-repo/property_repo.sql.go similarity index 99% rename from services/property-svc/repos/property_repo/property_repo.sql.go rename to services/property-svc/repos/property-repo/property_repo.sql.go index ba34214fe..1ec327b5d 100644 --- a/services/property-svc/repos/property_repo/property_repo.sql.go +++ b/services/property-svc/repos/property-repo/property_repo.sql.go @@ -3,7 +3,7 @@ // sqlc v1.27.0 // source: property_repo.sql -package property_repo +package propertyrepo import ( "context" diff --git a/services/property-svc/repos/property_value_repo/batch.go b/services/property-svc/repos/property-value-repo/batch.go similarity index 98% rename from services/property-svc/repos/property_value_repo/batch.go rename to services/property-svc/repos/property-value-repo/batch.go index 8d68ff7a7..8f042afe6 100644 --- a/services/property-svc/repos/property_value_repo/batch.go +++ b/services/property-svc/repos/property-value-repo/batch.go @@ -3,7 +3,7 @@ // sqlc v1.27.0 // source: batch.go -package property_value_repo +package propertyvaluerepo import ( "context" diff --git a/services/property-svc/repos/property_value_repo/db.go b/services/property-svc/repos/property-value-repo/db.go similarity index 95% rename from services/property-svc/repos/property_value_repo/db.go rename to services/property-svc/repos/property-value-repo/db.go index 08c8bf506..5ea6bc93a 100644 --- a/services/property-svc/repos/property_value_repo/db.go +++ b/services/property-svc/repos/property-value-repo/db.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package property_value_repo +package propertyvaluerepo import ( "context" diff --git a/services/property-svc/repos/property_value_repo/interfaces.go b/services/property-svc/repos/property-value-repo/interfaces.go similarity index 94% rename from services/property-svc/repos/property_value_repo/interfaces.go rename to services/property-svc/repos/property-value-repo/interfaces.go index 37f58397f..3a7feb416 100644 --- a/services/property-svc/repos/property_value_repo/interfaces.go +++ b/services/property-svc/repos/property-value-repo/interfaces.go @@ -1,6 +1,8 @@ -package property_value_repo +package propertyvaluerepo -import "github.com/jackc/pgx/v5/pgtype" +import ( + "github.com/jackc/pgx/v5/pgtype" +) // This is a handwritten file, // we should open a PR to generate {s/g}etters in sqlc (TODO) diff --git a/services/property-svc/repos/property-value-repo/models.go b/services/property-svc/repos/property-value-repo/models.go new file mode 100644 index 000000000..6e6a04d2b --- /dev/null +++ b/services/property-svc/repos/property-value-repo/models.go @@ -0,0 +1,79 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.27.0 + +package propertyvaluerepo + +import ( + "github.com/google/uuid" + "github.com/jackc/pgx/v5/pgtype" +) + +type MultiSelectValue struct { + ValueID uuid.UUID + SelectOption uuid.UUID +} + +type PatientPropertyViewRule struct { + RuleID uuid.UUID + WardID uuid.NullUUID + PatientID uuid.NullUUID +} + +type Property struct { + ID uuid.UUID + SubjectType int32 + FieldType int32 + Name string + Description string + IsArchived bool + SetID uuid.NullUUID + SelectDataID uuid.NullUUID + Consistency int64 +} + +type PropertyValue struct { + ID uuid.UUID + PropertyID uuid.UUID + SubjectID uuid.UUID + TextValue *string + NumberValue *float64 + BoolValue *bool + DateValue pgtype.Date + DateTimeValue pgtype.Timestamp + Consistency int64 +} + +type PropertyViewFilterAlwaysIncludeItem struct { + DontAlwaysInclude bool + RuleID uuid.UUID + PropertyID uuid.UUID +} + +type PropertyViewRule struct { + RuleID uuid.UUID +} + +type SchemaMigration struct { + Version int64 + Dirty bool +} + +type SelectData struct { + ID uuid.UUID + AllowFreetext bool +} + +type SelectOption struct { + ID uuid.UUID + Name string + Description string + IsCustom bool + SelectDataID uuid.UUID +} + +type TaskPropertyViewRule struct { + RuleID uuid.UUID + WardID uuid.NullUUID + TaskID uuid.NullUUID +} diff --git a/services/property-svc/repos/property_value_repo/property_value_repo.sql.go b/services/property-svc/repos/property-value-repo/property_value_repo.sql.go similarity index 99% rename from services/property-svc/repos/property_value_repo/property_value_repo.sql.go rename to services/property-svc/repos/property-value-repo/property_value_repo.sql.go index 3d80ad865..97c5c64ac 100644 --- a/services/property-svc/repos/property_value_repo/property_value_repo.sql.go +++ b/services/property-svc/repos/property-value-repo/property_value_repo.sql.go @@ -3,7 +3,7 @@ // sqlc v1.27.0 // source: property_value_repo.sql -package property_value_repo +package propertyvaluerepo import ( "context" diff --git a/services/property-svc/repos/property_value_repo/models.go b/services/property-svc/repos/property_value_repo/models.go deleted file mode 100644 index 2f7cdac21..000000000 --- a/services/property-svc/repos/property_value_repo/models.go +++ /dev/null @@ -1,79 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.27.0 - -package property_value_repo - -import ( - "github.com/google/uuid" - "github.com/jackc/pgx/v5/pgtype" -) - -type MultiSelectValue struct { - ValueID uuid.UUID - SelectOption uuid.UUID -} - -type PatientPropertyViewRule struct { - RuleID uuid.UUID - WardID uuid.NullUUID - PatientID uuid.NullUUID -} - -type Property struct { - ID uuid.UUID - SubjectType int32 - FieldType int32 - Name string - Description string - IsArchived bool - SetID uuid.NullUUID - SelectDataID uuid.NullUUID - Consistency int64 -} - -type PropertyValue struct { - ID uuid.UUID - PropertyID uuid.UUID - SubjectID uuid.UUID - TextValue *string - NumberValue *float64 - BoolValue *bool - DateValue pgtype.Date - DateTimeValue pgtype.Timestamp - Consistency int64 -} - -type PropertyViewFilterAlwaysIncludeItem struct { - DontAlwaysInclude bool - RuleID uuid.UUID - PropertyID uuid.UUID -} - -type PropertyViewRule struct { - RuleID uuid.UUID -} - -type SchemaMigration struct { - Version int64 - Dirty bool -} - -type SelectData struct { - ID uuid.UUID - AllowFreetext bool -} - -type SelectOption struct { - ID uuid.UUID - Name string - Description string - IsCustom bool - SelectDataID uuid.UUID -} - -type TaskPropertyViewRule struct { - RuleID uuid.UUID - WardID uuid.NullUUID - TaskID uuid.NullUUID -} diff --git a/services/tasks-svc/repos/patient_repo/db.go b/services/property-svc/repos/task-views-repo/db.go similarity index 96% rename from services/tasks-svc/repos/patient_repo/db.go rename to services/property-svc/repos/task-views-repo/db.go index 11870c2c3..5008da718 100644 --- a/services/tasks-svc/repos/patient_repo/db.go +++ b/services/property-svc/repos/task-views-repo/db.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package patient_repo +package taskviewsrepo import ( "context" diff --git a/services/property-svc/repos/task_views_repo/models.go b/services/property-svc/repos/task-views-repo/models.go similarity index 98% rename from services/property-svc/repos/task_views_repo/models.go rename to services/property-svc/repos/task-views-repo/models.go index ca784ca3f..927ecc88a 100644 --- a/services/property-svc/repos/task_views_repo/models.go +++ b/services/property-svc/repos/task-views-repo/models.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package task_views_repo +package taskviewsrepo import ( "github.com/google/uuid" diff --git a/services/property-svc/repos/task_views_repo/task_views_repo.sql.go b/services/property-svc/repos/task-views-repo/task_views_repo.sql.go similarity index 99% rename from services/property-svc/repos/task_views_repo/task_views_repo.sql.go rename to services/property-svc/repos/task-views-repo/task_views_repo.sql.go index e368364ec..0aacfc71e 100644 --- a/services/property-svc/repos/task_views_repo/task_views_repo.sql.go +++ b/services/property-svc/repos/task-views-repo/task_views_repo.sql.go @@ -3,7 +3,7 @@ // sqlc v1.27.0 // source: task_views_repo.sql -package task_views_repo +package taskviewsrepo import ( "context" diff --git a/services/property-svc/repos/views_repo/copyfrom.go b/services/property-svc/repos/views-repo/copyfrom.go similarity index 98% rename from services/property-svc/repos/views_repo/copyfrom.go rename to services/property-svc/repos/views-repo/copyfrom.go index e5446da73..e73e57658 100644 --- a/services/property-svc/repos/views_repo/copyfrom.go +++ b/services/property-svc/repos/views-repo/copyfrom.go @@ -3,7 +3,7 @@ // sqlc v1.27.0 // source: copyfrom.go -package views_repo +package viewsrepo import ( "context" diff --git a/services/property-svc/repos/views_repo/db.go b/services/property-svc/repos/views-repo/db.go similarity index 97% rename from services/property-svc/repos/views_repo/db.go rename to services/property-svc/repos/views-repo/db.go index ebcb13db5..07e0a4930 100644 --- a/services/property-svc/repos/views_repo/db.go +++ b/services/property-svc/repos/views-repo/db.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package views_repo +package viewsrepo import ( "context" diff --git a/services/property-svc/repos/views_repo/models.go b/services/property-svc/repos/views-repo/models.go similarity index 98% rename from services/property-svc/repos/views_repo/models.go rename to services/property-svc/repos/views-repo/models.go index c6551859d..a7270a74d 100644 --- a/services/property-svc/repos/views_repo/models.go +++ b/services/property-svc/repos/views-repo/models.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package views_repo +package viewsrepo import ( "github.com/google/uuid" diff --git a/services/property-svc/repos/views_repo/views_repo.sql.go b/services/property-svc/repos/views-repo/views_repo.sql.go similarity index 98% rename from services/property-svc/repos/views_repo/views_repo.sql.go rename to services/property-svc/repos/views-repo/views_repo.sql.go index ba27a31ab..b12266888 100644 --- a/services/property-svc/repos/views_repo/views_repo.sql.go +++ b/services/property-svc/repos/views-repo/views_repo.sql.go @@ -3,7 +3,7 @@ // sqlc v1.27.0 // source: views_repo.sql -package views_repo +package viewsrepo import ( "context" diff --git a/services/property-svc/sqlc.yaml b/services/property-svc/sqlc.yaml index cdadbb11f..6a8df5c12 100644 --- a/services/property-svc/sqlc.yaml +++ b/services/property-svc/sqlc.yaml @@ -7,8 +7,8 @@ sql: gen: go: &repo-go - package: "property_repo" - out: "repos/property_repo" + package: "propertyrepo" + out: "repos/property-repo" sql_package: "pgx/v5" emit_empty_slices: true emit_pointers_for_null_types: true @@ -23,26 +23,26 @@ sql: gen: go: <<: *repo-go - package: "views_repo" - out: "repos/views_repo" + package: "viewsrepo" + out: "repos/views-repo" - <<: *repo queries: "./repos/task_views_repo.sql" gen: go: <<: *repo-go - package: "task_views_repo" - out: "repos/task_views_repo" + package: "taskviewsrepo" + out: "repos/task-views-repo" - <<: *repo queries: "./repos/property_value_repo.sql" gen: go: <<: *repo-go - package: "property_value_repo" - out: "repos/property_value_repo" + package: "propertyvaluerepo" + out: "repos/property-value-repo" - <<: *repo queries: "./repos/patient_views_repo.sql" gen: go: <<: *repo-go - package: "patient_views_repo" - out: "repos/patient_views_repo" + package: "patientviewsrepo" + out: "repos/patient-views-repo" diff --git a/services/tasks-svc/internal/bed/bed.go b/services/tasks-svc/internal/bed/bed.go index cbb91b2cb..8b6217f82 100644 --- a/services/tasks-svc/internal/bed/bed.go +++ b/services/tasks-svc/internal/bed/bed.go @@ -24,7 +24,7 @@ import ( "google.golang.org/genproto/googleapis/rpc/errdetails" "tasks-svc/locale" - "tasks-svc/repos/bed_repo" + "tasks-svc/repos/bed-repo" "github.com/google/uuid" "google.golang.org/grpc/codes" @@ -62,7 +62,7 @@ func NewServiceServer(authz hwauthz.AuthZ, es *esdb.Client) *ServiceServer { func (s ServiceServer) CreateBed(ctx context.Context, req *pb.CreateBedRequest) (*pb.CreateBedResponse, error) { log := zlog.Ctx(ctx) - bedRepo := bed_repo.New(hwdb.GetDB()) + bedRepo := bedrepo.New(hwdb.GetDB()) // parse inputs roomID, err := uuid.Parse(req.GetRoomId()) @@ -78,7 +78,7 @@ func (s ServiceServer) CreateBed(ctx context.Context, req *pb.CreateBedRequest) } // do query - bed, err := bedRepo.CreateBed(ctx, bed_repo.CreateBedParams{ + bed, err := bedRepo.CreateBed(ctx, bedrepo.CreateBedParams{ RoomID: roomID, Name: req.GetName(), }) @@ -137,7 +137,7 @@ func (s ServiceServer) CreateBed(ctx context.Context, req *pb.CreateBedRequest) } func (s ServiceServer) GetBed(ctx context.Context, req *pb.GetBedRequest) (*pb.GetBedResponse, error) { - bedRepo := bed_repo.New(hwdb.GetDB()) + bedRepo := bedrepo.New(hwdb.GetDB()) // parse inputs id, err := uuid.Parse(req.GetId()) @@ -175,7 +175,7 @@ func (s ServiceServer) GetBedByPatient( ctx context.Context, req *pb.GetBedByPatientRequest, ) (*pb.GetBedByPatientResponse, error) { - bedRepo := bed_repo.New(hwdb.GetDB()) + bedRepo := bedrepo.New(hwdb.GetDB()) patientID, err := uuid.Parse(req.GetPatientId()) if err != nil { @@ -205,7 +205,7 @@ func (s ServiceServer) GetBedByPatient( } return &pb.GetBedByPatientResponse{ - Room: hwutil.MapNillable(result, func(res bed_repo.GetBedWithRoomByPatientRow) pb.GetBedByPatientResponse_Room { + Room: hwutil.MapNillable(result, func(res bedrepo.GetBedWithRoomByPatientRow) pb.GetBedByPatientResponse_Room { return pb.GetBedByPatientResponse_Room{ Id: res.RoomID.String(), Name: res.RoomName, @@ -213,7 +213,7 @@ func (s ServiceServer) GetBedByPatient( Consistency: common.ConsistencyToken(res.RoomConsistency).String(), //nolint:gosec } }), - Bed: hwutil.MapNillable(result, func(res bed_repo.GetBedWithRoomByPatientRow) pb.GetBedByPatientResponse_Bed { + Bed: hwutil.MapNillable(result, func(res bedrepo.GetBedWithRoomByPatientRow) pb.GetBedByPatientResponse_Bed { return pb.GetBedByPatientResponse_Bed{ Id: res.BedID.String(), Name: res.BedName, @@ -229,7 +229,7 @@ func (s ServiceServer) GetBeds(ctx context.Context, req *pb.GetBedsRequest) (*pb return nil, status.Error(codes.InvalidArgument, err.Error()) } - bedRepo := bed_repo.New(hwdb.GetDB()) + bedRepo := bedrepo.New(hwdb.GetDB()) beds, err := bedRepo.GetBeds(ctx, roomID) if err != nil { @@ -238,19 +238,19 @@ func (s ServiceServer) GetBeds(ctx context.Context, req *pb.GetBedsRequest) (*pb // check permissions user := commonperm.UserFromCtx(ctx) - checks := hwutil.Map(beds, func(b bed_repo.Bed) hwauthz.PermissionCheck { + checks := hwutil.Map(beds, func(b bedrepo.Bed) hwauthz.PermissionCheck { return hwauthz.NewPermissionCheck(user, perm.BedCanUserGet, perm.Bed(b.ID)) }) canGet, err := s.authz.BulkCheck(ctx, checks) if err != nil { return nil, err } - beds = hwutil.Filter(beds, func(i int, _ bed_repo.Bed) bool { + beds = hwutil.Filter(beds, func(i int, _ bedrepo.Bed) bool { return canGet[i] }) return &pb.GetBedsResponse{ - Beds: hwutil.Map(beds, func(bed bed_repo.Bed) *pb.GetBedsResponse_Bed { + Beds: hwutil.Map(beds, func(bed bedrepo.Bed) *pb.GetBedsResponse_Bed { return &pb.GetBedsResponse_Bed{ Id: bed.ID.String(), RoomId: bed.RoomID.String(), @@ -270,7 +270,7 @@ func (s ServiceServer) GetBedsByRoom( return nil, status.Error(codes.InvalidArgument, err.Error()) } - bedRepo := bed_repo.New(hwdb.GetDB()) + bedRepo := bedrepo.New(hwdb.GetDB()) beds, err := bedRepo.GetBeds(ctx, uuid.NullUUID{ @@ -289,14 +289,14 @@ func (s ServiceServer) GetBedsByRoom( // check permissions user := commonperm.UserFromCtx(ctx) - checks := hwutil.Map(beds, func(b bed_repo.Bed) hwauthz.PermissionCheck { + checks := hwutil.Map(beds, func(b bedrepo.Bed) hwauthz.PermissionCheck { return hwauthz.NewPermissionCheck(user, perm.BedCanUserGet, perm.Bed(b.ID)) }) canGet, err := s.authz.BulkCheck(ctx, checks) if err != nil { return nil, err } - beds = hwutil.Filter(beds, func(i int, _ bed_repo.Bed) bool { + beds = hwutil.Filter(beds, func(i int, _ bedrepo.Bed) bool { return canGet[i] }) @@ -312,7 +312,7 @@ func (s ServiceServer) GetBedsByRoom( } func (s ServiceServer) UpdateBed(ctx context.Context, req *pb.UpdateBedRequest) (*pb.UpdateBedResponse, error) { - bedRepo := bed_repo.New(hwdb.GetDB()) + bedRepo := bedrepo.New(hwdb.GetDB()) // parse inputs bedID, err := uuid.Parse(req.GetId()) @@ -333,7 +333,7 @@ func (s ServiceServer) UpdateBed(ctx context.Context, req *pb.UpdateBedRequest) } // do query - consistency, err := bedRepo.UpdateBed(ctx, bed_repo.UpdateBedParams{ + consistency, err := bedRepo.UpdateBed(ctx, bedrepo.UpdateBedParams{ ID: bedID, Name: req.Name, RoomID: roomID, @@ -363,7 +363,7 @@ func (s ServiceServer) UpdateBed(ctx context.Context, req *pb.UpdateBedRequest) func (s ServiceServer) DeleteBed(ctx context.Context, req *pb.DeleteBedRequest) (*pb.DeleteBedResponse, error) { log := zlog.Ctx(ctx) - bedRepo := bed_repo.New(hwdb.GetDB()) + bedRepo := bedrepo.New(hwdb.GetDB()) // parse inputs bedID, err := uuid.Parse(req.GetId()) diff --git a/services/tasks-svc/internal/patient/api/grpc.go b/services/tasks-svc/internal/patient/api/grpc.go index 0908ac425..8de04d8be 100644 --- a/services/tasks-svc/internal/patient/api/grpc.go +++ b/services/tasks-svc/internal/patient/api/grpc.go @@ -24,7 +24,7 @@ import ( "tasks-svc/internal/patient/handlers" "tasks-svc/internal/patient/models" "tasks-svc/internal/tracking" - "tasks-svc/repos/bed_repo" + "tasks-svc/repos/bed-repo" ) type PatientGrpcService struct { @@ -79,7 +79,7 @@ func (s *PatientGrpcService) GetPatient( return nil, err } - bedRepo := bed_repo.New(hwdb.GetDB()) + bedRepo := bedrepo.New(hwdb.GetDB()) // check permissions user := commonperm.UserFromCtx(ctx) @@ -360,7 +360,7 @@ func (s *PatientGrpcService) GetRecentPatients( _ *pb.GetRecentPatientsRequest, ) (*pb.GetRecentPatientsResponse, error) { log := zlog.Ctx(ctx) - bedRepo := bed_repo.New(hwdb.GetDB()) + bedRepo := bedrepo.New(hwdb.GetDB()) var recentPatientIdsStrs []string recentPatientIdsStrs, err := tracking.GetRecentPatientsForUser(ctx) diff --git a/services/tasks-svc/internal/patient/projections/postgres-projection/patient_postgres_projection.go b/services/tasks-svc/internal/patient/projections/postgres-projection/patient_postgres_projection.go index 548c9e3c4..d0f710498 100644 --- a/services/tasks-svc/internal/patient/projections/postgres-projection/patient_postgres_projection.go +++ b/services/tasks-svc/internal/patient/projections/postgres-projection/patient_postgres_projection.go @@ -14,12 +14,12 @@ import ( "tasks-svc/internal/patient/aggregate" patientEventsV1 "tasks-svc/internal/patient/events/v1" - "tasks-svc/repos/patient_repo" + "tasks-svc/repos/patient-repo" ) type Projection struct { *custom.CustomProjection - patientRepo *patient_repo.Queries + patientRepo *patientrepo.Queries } func NewProjection(es *esdb.Client, serviceName string) *Projection { @@ -30,7 +30,7 @@ func NewProjection(es *esdb.Client, serviceName string) *Projection { subscriptionGroupName, &[]string{aggregate.PatientAggregateType + "-"}, ), - patientRepo: patient_repo.New(hwdb.GetDB()), + patientRepo: patientrepo.New(hwdb.GetDB()), } p.initEventListeners() return p @@ -67,7 +67,7 @@ func (p *Projection) onPatientCreated(ctx context.Context, evt hwes.Event) (*esd } organizationID := *evt.OrganizationID - err = p.patientRepo.CreatePatient(ctx, patient_repo.CreatePatientParams{ + err = p.patientRepo.CreatePatient(ctx, patientrepo.CreatePatientParams{ ID: patientID, HumanReadableIdentifier: payload.HumanReadableIdentifier, Notes: payload.Notes, @@ -97,7 +97,7 @@ func (p *Projection) onBedAssigned(ctx context.Context, evt hwes.Event) (*esdb.N return hwutil.PtrTo(esdb.NackActionPark), err } - err = p.patientRepo.UpdatePatientBedId(ctx, patient_repo.UpdatePatientBedIdParams{ + err = p.patientRepo.UpdatePatientBedId(ctx, patientrepo.UpdatePatientBedIdParams{ ID: evt.AggregateID, BedID: bedID, UpdatedAt: hwdb.TimeToTimestamp(evt.Timestamp), @@ -111,7 +111,7 @@ func (p *Projection) onBedAssigned(ctx context.Context, evt hwes.Event) (*esdb.N } func (p *Projection) onBedUnassigned(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { - err := p.patientRepo.UpdatePatientBedId(ctx, patient_repo.UpdatePatientBedIdParams{ + err := p.patientRepo.UpdatePatientBedId(ctx, patientrepo.UpdatePatientBedIdParams{ ID: evt.AggregateID, BedID: uuid.NullUUID{}, UpdatedAt: hwdb.TimeToTimestamp(evt.Timestamp), @@ -125,7 +125,7 @@ func (p *Projection) onBedUnassigned(ctx context.Context, evt hwes.Event) (*esdb } func (p *Projection) onPatientDischarged(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { - err := p.patientRepo.UpdatePatient(ctx, patient_repo.UpdatePatientParams{ + err := p.patientRepo.UpdatePatient(ctx, patientrepo.UpdatePatientParams{ ID: evt.AggregateID, IsDischarged: hwutil.PtrTo(true), UpdatedAt: hwdb.TimeToTimestamp(evt.Timestamp), @@ -147,7 +147,7 @@ func (p *Projection) onNotesUpdated(ctx context.Context, evt hwes.Event) (*esdb. return hwutil.PtrTo(esdb.NackActionPark), err } - err := p.patientRepo.UpdatePatient(ctx, patient_repo.UpdatePatientParams{ + err := p.patientRepo.UpdatePatient(ctx, patientrepo.UpdatePatientParams{ ID: evt.AggregateID, Notes: &payload.Notes, UpdatedAt: hwdb.TimeToTimestamp(evt.Timestamp), @@ -169,7 +169,7 @@ func (p *Projection) onHumanReadableIdentifierUpdated(ctx context.Context, evt h return hwutil.PtrTo(esdb.NackActionPark), err } - err := p.patientRepo.UpdatePatient(ctx, patient_repo.UpdatePatientParams{ + err := p.patientRepo.UpdatePatient(ctx, patientrepo.UpdatePatientParams{ ID: evt.AggregateID, HumanReadableIdentfier: &payload.HumanReadableIdentifier, UpdatedAt: hwdb.TimeToTimestamp(evt.Timestamp), @@ -183,7 +183,7 @@ func (p *Projection) onHumanReadableIdentifierUpdated(ctx context.Context, evt h } func (p *Projection) onPatientReadmitted(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { - err := p.patientRepo.UpdatePatient(ctx, patient_repo.UpdatePatientParams{ + err := p.patientRepo.UpdatePatient(ctx, patientrepo.UpdatePatientParams{ ID: evt.AggregateID, IsDischarged: hwutil.PtrTo(false), UpdatedAt: hwdb.TimeToTimestamp(evt.Timestamp), diff --git a/services/tasks-svc/internal/patient/queries/v1/get_all_patients_with_details.go b/services/tasks-svc/internal/patient/queries/v1/get_all_patients_with_details.go index 93f8458b3..009225493 100644 --- a/services/tasks-svc/internal/patient/queries/v1/get_all_patients_with_details.go +++ b/services/tasks-svc/internal/patient/queries/v1/get_all_patients_with_details.go @@ -16,14 +16,14 @@ import ( "tasks-svc/internal/patient/models" tasksModels "tasks-svc/internal/task/models" - "tasks-svc/repos/patient_repo" + "tasks-svc/repos/patient-repo" ) type GetAllPatientsWithDetailsQueryHandler func(ctx context.Context) ([]*models.PatientDetails, error) func NewGetAllPatientsWithDetailsQueryHandler(authz hwauthz.AuthZ) GetAllPatientsWithDetailsQueryHandler { return func(ctx context.Context) ([]*models.PatientDetails, error) { - patientRepo := patient_repo.New(hwdb.GetDB()) + patientRepo := patientrepo.New(hwdb.GetDB()) // gather inputs organizationID := auth.MustGetOrganizationID(ctx) diff --git a/services/tasks-svc/internal/patient/queries/v1/get_patient_assignment_by_ward.go b/services/tasks-svc/internal/patient/queries/v1/get_patient_assignment_by_ward.go index f11bf4690..8f98c8cbb 100644 --- a/services/tasks-svc/internal/patient/queries/v1/get_patient_assignment_by_ward.go +++ b/services/tasks-svc/internal/patient/queries/v1/get_patient_assignment_by_ward.go @@ -13,7 +13,7 @@ import ( "github.com/google/uuid" "tasks-svc/internal/patient/models" - "tasks-svc/repos/room_repo" + "tasks-svc/repos/room-repo" ) type GetPatientAssignmentByWardQueryHandler func( @@ -23,7 +23,7 @@ type GetPatientAssignmentByWardQueryHandler func( func NewGetPatientAssignmentByWardQueryHandler(authz hwauthz.AuthZ) GetPatientAssignmentByWardQueryHandler { return func(ctx context.Context, wardID uuid.UUID) ([]*models.RoomWithBedsWithPatient, error) { - roomRepo := room_repo.New(hwdb.GetDB()) + roomRepo := roomrepo.New(hwdb.GetDB()) // check permissions // @@ -46,13 +46,13 @@ func NewGetPatientAssignmentByWardQueryHandler(authz hwauthz.AuthZ) GetPatientAs processedRooms := make(map[uuid.UUID]bool) return hwutil.FlatMap(rows, - func(roomRow room_repo.GetRoomsWithBedsWithPatientsByWardRow) **models.RoomWithBedsWithPatient { + func(roomRow roomrepo.GetRoomsWithBedsWithPatientsByWardRow) **models.RoomWithBedsWithPatient { if _, processed := processedRooms[roomRow.RoomID]; processed { return nil } processedRooms[roomRow.RoomID] = true beds := hwutil.FlatMap(rows, - func(bedRow room_repo.GetRoomsWithBedsWithPatientsByWardRow) **models.BedWithPatient { + func(bedRow roomrepo.GetRoomsWithBedsWithPatientsByWardRow) **models.BedWithPatient { if bedRow.RoomID != roomRow.RoomID || !bedRow.BedID.Valid { return nil } diff --git a/services/tasks-svc/internal/patient/queries/v1/get_patient_by_bed.go b/services/tasks-svc/internal/patient/queries/v1/get_patient_by_bed.go index 93c9ef0cd..e3156148d 100644 --- a/services/tasks-svc/internal/patient/queries/v1/get_patient_by_bed.go +++ b/services/tasks-svc/internal/patient/queries/v1/get_patient_by_bed.go @@ -13,14 +13,14 @@ import ( "tasks-svc/internal/patient/perm" "tasks-svc/internal/patient/models" - "tasks-svc/repos/patient_repo" + "tasks-svc/repos/patient-repo" ) type GetPatientByBedQueryHandler func(ctx context.Context, bedID uuid.UUID) (*models.PatientWithConsistency, error) func NewGetPatientByBedQueryHandler(authz hwauthz.AuthZ) GetPatientByBedQueryHandler { return func(ctx context.Context, bedID uuid.UUID) (*models.PatientWithConsistency, error) { - patientRepo := patient_repo.New(hwdb.GetDB()) + patientRepo := patientrepo.New(hwdb.GetDB()) // check bed permissions user := commonperm.UserFromCtx(ctx) diff --git a/services/tasks-svc/internal/patient/queries/v1/get_patient_with_details_by_id.go b/services/tasks-svc/internal/patient/queries/v1/get_patient_with_details_by_id.go index cbc766e48..b3b1cc45f 100644 --- a/services/tasks-svc/internal/patient/queries/v1/get_patient_with_details_by_id.go +++ b/services/tasks-svc/internal/patient/queries/v1/get_patient_with_details_by_id.go @@ -14,7 +14,7 @@ import ( "tasks-svc/internal/patient/models" th "tasks-svc/internal/task/handlers" - "tasks-svc/repos/patient_repo" + "tasks-svc/repos/patient-repo" ) type GetPatientDetailsByIDQueryHandler func(ctx context.Context, patientID uuid.UUID) (*models.PatientDetails, error) @@ -23,7 +23,7 @@ func NewGetPatientWithDetailsByIDQueryHandler( as hwes.AggregateStore, authz hwauthz.AuthZ, ) GetPatientDetailsByIDQueryHandler { return func(ctx context.Context, patientID uuid.UUID) (*models.PatientDetails, error) { - patientRepo := patient_repo.New(hwdb.GetDB()) + patientRepo := patientrepo.New(hwdb.GetDB()) taskHandlers := th.NewTaskHandlers(as, authz) // check permissions diff --git a/services/tasks-svc/internal/patient/queries/v1/get_patients_by_ward.go b/services/tasks-svc/internal/patient/queries/v1/get_patients_by_ward.go index 7d1b03592..3f82f2163 100644 --- a/services/tasks-svc/internal/patient/queries/v1/get_patients_by_ward.go +++ b/services/tasks-svc/internal/patient/queries/v1/get_patients_by_ward.go @@ -14,14 +14,14 @@ import ( "github.com/google/uuid" "tasks-svc/internal/patient/models" - "tasks-svc/repos/patient_repo" + "tasks-svc/repos/patient-repo" ) type GetPatientsByWardQueryHandler func(ctx context.Context, wardID uuid.UUID) ([]*models.PatientWithConsistency, error) func NewGetPatientsByWardQueryHandler(authz hwauthz.AuthZ) GetPatientsByWardQueryHandler { return func(ctx context.Context, wardID uuid.UUID) ([]*models.PatientWithConsistency, error) { - patientRepo := patient_repo.New(hwdb.GetDB()) + patientRepo := patientrepo.New(hwdb.GetDB()) // ensure get-access to ward user := commonperm.UserFromCtx(ctx) @@ -35,7 +35,7 @@ func NewGetPatientsByWardQueryHandler(authz hwauthz.AuthZ) GetPatientsByWardQuer return nil, err } - checks := hwutil.Map(patients, func(patient patient_repo.Patient) hwauthz.PermissionCheck { + checks := hwutil.Map(patients, func(patient patientrepo.Patient) hwauthz.PermissionCheck { return hwauthz.NewPermissionCheck(user, perm.PatientCanUserGet, perm.Patient(patient.ID)) }) allowed, err := authz.BulkCheck(ctx, checks) @@ -43,7 +43,7 @@ func NewGetPatientsByWardQueryHandler(authz hwauthz.AuthZ) GetPatientsByWardQuer return nil, err } - return hwutil.FlatMapI(patients, func(i int, patient patient_repo.Patient) **models.PatientWithConsistency { + return hwutil.FlatMapI(patients, func(i int, patient patientrepo.Patient) **models.PatientWithConsistency { if !allowed[i] { return nil } diff --git a/services/tasks-svc/internal/room/room.go b/services/tasks-svc/internal/room/room.go index 7c1faaaa7..ee95492b1 100644 --- a/services/tasks-svc/internal/room/room.go +++ b/services/tasks-svc/internal/room/room.go @@ -22,7 +22,7 @@ import ( "google.golang.org/grpc/status" "tasks-svc/internal/tracking" - "tasks-svc/repos/room_repo" + "tasks-svc/repos/room-repo" pb "gen/services/tasks_svc/v1" zlog "github.com/rs/zerolog/log" @@ -56,7 +56,7 @@ func NewServiceServer(authz hwauthz.AuthZ, es *esdb.Client) *ServiceServer { func (s ServiceServer) CreateRoom(ctx context.Context, req *pb.CreateRoomRequest) (*pb.CreateRoomResponse, error) { log := zlog.Ctx(ctx) - roomRepo := room_repo.New(hwdb.GetDB()) + roomRepo := roomrepo.New(hwdb.GetDB()) // parse input wardID, err := uuid.Parse(req.GetWardId()) @@ -72,7 +72,7 @@ func (s ServiceServer) CreateRoom(ctx context.Context, req *pb.CreateRoomRequest } // do query - row, err := roomRepo.CreateRoom(ctx, room_repo.CreateRoomParams{ + row, err := roomRepo.CreateRoom(ctx, roomrepo.CreateRoomParams{ Name: req.GetName(), WardID: wardID, }) @@ -118,7 +118,7 @@ func (s ServiceServer) CreateRoom(ctx context.Context, req *pb.CreateRoomRequest } func (s ServiceServer) GetRoom(ctx context.Context, req *pb.GetRoomRequest) (*pb.GetRoomResponse, error) { - roomRepo := room_repo.New(hwdb.GetDB()) + roomRepo := roomrepo.New(hwdb.GetDB()) // parse inputs id, err := uuid.Parse(req.GetId()) @@ -146,7 +146,7 @@ func (s ServiceServer) GetRoom(ctx context.Context, req *pb.GetRoomRequest) (*pb room := rows[0].Room - beds := hwutil.FlatMap(rows, func(row room_repo.GetRoomWithBedsByIdRow) **pb.GetRoomResponse_Bed { + beds := hwutil.FlatMap(rows, func(row roomrepo.GetRoomWithBedsByIdRow) **pb.GetRoomResponse_Bed { if !row.BedID.Valid { return nil } @@ -169,7 +169,7 @@ func (s ServiceServer) GetRoom(ctx context.Context, req *pb.GetRoomRequest) (*pb } func (s ServiceServer) UpdateRoom(ctx context.Context, req *pb.UpdateRoomRequest) (*pb.UpdateRoomResponse, error) { - roomRepo := room_repo.New(hwdb.GetDB()) + roomRepo := roomrepo.New(hwdb.GetDB()) // parse inputs roomID, err := uuid.Parse(req.GetId()) @@ -185,7 +185,7 @@ func (s ServiceServer) UpdateRoom(ctx context.Context, req *pb.UpdateRoomRequest } // do query - consistency, err := roomRepo.UpdateRoom(ctx, room_repo.UpdateRoomParams{ + consistency, err := roomRepo.UpdateRoom(ctx, roomrepo.UpdateRoomParams{ ID: roomID, Name: req.Name, }) @@ -212,7 +212,7 @@ func (s ServiceServer) UpdateRoom(ctx context.Context, req *pb.UpdateRoomRequest } func (s ServiceServer) GetRooms(ctx context.Context, req *pb.GetRoomsRequest) (*pb.GetRoomsResponse, error) { - roomRepo := room_repo.New(hwdb.GetDB()) + roomRepo := roomrepo.New(hwdb.GetDB()) // parse inputs wardID, err := hwutil.ParseNullUUID(req.WardId) @@ -230,13 +230,13 @@ func (s ServiceServer) GetRooms(ctx context.Context, req *pb.GetRoomsRequest) (* // re-structure rows processedRooms := make(map[uuid.UUID]bool) - rooms := hwutil.FlatMap(rows, func(roomRow room_repo.GetRoomsWithBedsRow) **pb.GetRoomsResponse_Room { + rooms := hwutil.FlatMap(rows, func(roomRow roomrepo.GetRoomsWithBedsRow) **pb.GetRoomsResponse_Room { room := roomRow.Room if _, processed := processedRooms[room.ID]; processed { return nil } processedRooms[room.ID] = true - beds := hwutil.FlatMap(rows, func(bedRow room_repo.GetRoomsWithBedsRow) **pb.GetRoomsResponse_Room_Bed { + beds := hwutil.FlatMap(rows, func(bedRow roomrepo.GetRoomsWithBedsRow) **pb.GetRoomsResponse_Room_Bed { if !bedRow.BedID.Valid || bedRow.Room.ID != room.ID { return nil } @@ -277,7 +277,7 @@ func (s ServiceServer) GetRooms(ctx context.Context, req *pb.GetRoomsRequest) (* } func (s ServiceServer) DeleteRoom(ctx context.Context, req *pb.DeleteRoomRequest) (*pb.DeleteRoomResponse, error) { - roomRepo := room_repo.New(hwdb.GetDB()) + roomRepo := roomrepo.New(hwdb.GetDB()) // parse inputs roomID, err := uuid.Parse(req.GetId()) @@ -321,7 +321,7 @@ func (s ServiceServer) GetRoomOverviewsByWard( ctx context.Context, req *pb.GetRoomOverviewsByWardRequest, ) (*pb.GetRoomOverviewsByWardResponse, error) { - roomRepo := room_repo.New(hwdb.GetDB()) + roomRepo := roomrepo.New(hwdb.GetDB()) wardID, err := uuid.Parse(req.GetId()) if err != nil { @@ -339,7 +339,7 @@ func (s ServiceServer) GetRoomOverviewsByWard( } rows, err := roomRepo.GetRoomsWithBedsAndPatientsAndTasksCountByWard(ctx, - room_repo.GetRoomsWithBedsAndPatientsAndTasksCountByWardParams{ + roomrepo.GetRoomsWithBedsAndPatientsAndTasksCountByWardParams{ TodoStatus: int32(pb.TaskStatus_TASK_STATUS_TODO), InProgressStatus: int32(pb.TaskStatus_TASK_STATUS_IN_PROGRESS), DoneStatus: int32(pb.TaskStatus_TASK_STATUS_DONE), @@ -352,7 +352,7 @@ func (s ServiceServer) GetRoomOverviewsByWard( processedRooms := make(map[uuid.UUID]bool) - type rowType = room_repo.GetRoomsWithBedsAndPatientsAndTasksCountByWardRow + type rowType = roomrepo.GetRoomsWithBedsAndPatientsAndTasksCountByWardRow rooms := hwutil.FlatMap(rows, func(roomRow rowType) **pb.GetRoomOverviewsByWardResponse_Room { diff --git a/services/tasks-svc/internal/task-template/task_template.go b/services/tasks-svc/internal/task-template/task_template.go index 34f74913d..b5acb6263 100644 --- a/services/tasks-svc/internal/task-template/task_template.go +++ b/services/tasks-svc/internal/task-template/task_template.go @@ -22,7 +22,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "tasks-svc/repos/task_template_repo" + "tasks-svc/repos/task-template-repo" pb "gen/services/tasks_svc/v1" zlog "github.com/rs/zerolog/log" @@ -81,11 +81,11 @@ func (s ServiceServer) CreateTaskTemplate( return nil, err } defer rollback() - templateRepo := task_template_repo.New(db).WithTx(tx) + templateRepo := tasktemplaterepo.New(db).WithTx(tx) userID := auth.MustGetUserID(ctx) - row, err := templateRepo.CreateTaskTemplate(ctx, task_template_repo.CreateTaskTemplateParams{ + row, err := templateRepo.CreateTaskTemplate(ctx, tasktemplaterepo.CreateTaskTemplateParams{ Name: req.GetName(), Description: req.GetDescription(), CreatedBy: userID, @@ -102,8 +102,8 @@ func (s ServiceServer) CreateTaskTemplate( if req.Subtasks != nil { subtaskNames := hwutil.Map(req.GetSubtasks(), - func(subtask *pb.CreateTaskTemplateRequest_SubTask) task_template_repo.AppendSubTasksParams { - return task_template_repo.AppendSubTasksParams{ + func(subtask *pb.CreateTaskTemplateRequest_SubTask) tasktemplaterepo.AppendSubTasksParams { + return tasktemplaterepo.AppendSubTasksParams{ Name: subtask.GetName(), TaskTemplateID: templateID, } @@ -163,7 +163,7 @@ func (s ServiceServer) DeleteTaskTemplate( req *pb.DeleteTaskTemplateRequest, ) (*pb.DeleteTaskTemplateResponse, error) { log := zlog.Ctx(ctx) - templateRepo := task_template_repo.New(hwdb.GetDB()) + templateRepo := tasktemplaterepo.New(hwdb.GetDB()) id, err := uuid.Parse(req.GetId()) if err != nil { @@ -216,7 +216,7 @@ func (s ServiceServer) DeleteTaskTemplateSubTask( } defer rollback() - templateRepo := task_template_repo.New(tx) + templateRepo := tasktemplaterepo.New(tx) id, err := uuid.Parse(req.GetId()) if err != nil { @@ -237,7 +237,7 @@ func (s ServiceServer) DeleteTaskTemplateSubTask( } // increase consistency of taskTemplate - consistency, err := templateRepo.UpdateTaskTemplate(ctx, task_template_repo.UpdateTaskTemplateParams{ + consistency, err := templateRepo.UpdateTaskTemplate(ctx, tasktemplaterepo.UpdateTaskTemplateParams{ ID: subtask.TaskTemplateID, }) if err := hwdb.Error(ctx, err); err != nil { @@ -273,7 +273,7 @@ func (s ServiceServer) UpdateTaskTemplate( ctx context.Context, req *pb.UpdateTaskTemplateRequest, ) (*pb.UpdateTaskTemplateResponse, error) { - templateRepo := task_template_repo.New(hwdb.GetDB()) + templateRepo := tasktemplaterepo.New(hwdb.GetDB()) id, err := uuid.Parse(req.GetId()) if err != nil { @@ -287,7 +287,7 @@ func (s ServiceServer) UpdateTaskTemplate( return nil, err } - consistency, err := templateRepo.UpdateTaskTemplate(ctx, task_template_repo.UpdateTaskTemplateParams{ + consistency, err := templateRepo.UpdateTaskTemplate(ctx, tasktemplaterepo.UpdateTaskTemplateParams{ Name: req.Name, Description: req.Description, ID: id, @@ -324,7 +324,7 @@ func (s ServiceServer) UpdateTaskTemplateSubTask( return nil, err } defer rollback() - templateRepo := task_template_repo.New(tx) + templateRepo := tasktemplaterepo.New(tx) id, err := uuid.Parse(req.GetSubtaskId()) if err != nil { @@ -332,7 +332,7 @@ func (s ServiceServer) UpdateTaskTemplateSubTask( } // update subtask and get related taskTemplate - taskTemplateID, err := templateRepo.UpdateSubtask(ctx, task_template_repo.UpdateSubtaskParams{ + taskTemplateID, err := templateRepo.UpdateSubtask(ctx, tasktemplaterepo.UpdateSubtaskParams{ Name: req.Name, ID: id, }) @@ -349,7 +349,7 @@ func (s ServiceServer) UpdateTaskTemplateSubTask( } // increase consistency of taskTemplate - consistency, err := templateRepo.UpdateTaskTemplate(ctx, task_template_repo.UpdateTaskTemplateParams{ + consistency, err := templateRepo.UpdateTaskTemplate(ctx, tasktemplaterepo.UpdateTaskTemplateParams{ ID: taskTemplateID, }) if err := hwdb.Error(ctx, err); err != nil { @@ -383,7 +383,7 @@ func (s ServiceServer) CreateTaskTemplateSubTask( req *pb.CreateTaskTemplateSubTaskRequest, ) (*pb.CreateTaskTemplateSubTaskResponse, error) { log := zlog.Ctx(ctx) - templateRepo := task_template_repo.New(hwdb.GetDB()) + templateRepo := tasktemplaterepo.New(hwdb.GetDB()) taskTemplateID, err := uuid.Parse(req.GetTaskTemplateId()) if err != nil { @@ -397,7 +397,7 @@ func (s ServiceServer) CreateTaskTemplateSubTask( return nil, err } - row, err := templateRepo.CreateSubTask(ctx, task_template_repo.CreateSubTaskParams{ + row, err := templateRepo.CreateSubTask(ctx, tasktemplaterepo.CreateSubTaskParams{ TaskTemplateID: taskTemplateID, Name: req.GetName(), }) @@ -436,7 +436,7 @@ func (s ServiceServer) GetAllTaskTemplates( ctx context.Context, req *pb.GetAllTaskTemplatesRequest, ) (*pb.GetAllTaskTemplatesResponse, error) { - templateRepo := task_template_repo.New(hwdb.GetDB()) + templateRepo := tasktemplaterepo.New(hwdb.GetDB()) user := commonperm.UserFromCtx(ctx) @@ -451,7 +451,7 @@ func (s ServiceServer) GetAllTaskTemplates( } rows, err := templateRepo.GetAllTaskTemplatesWithSubTasks(ctx, - task_template_repo.GetAllTaskTemplatesWithSubTasksParams{ + tasktemplaterepo.GetAllTaskTemplatesWithSubTasksParams{ CreatorID: createdBy, PrivateOnly: req.GetPrivateOnly(), WardID: wardID, @@ -512,7 +512,7 @@ func (s ServiceServer) GetTaskTemplate( ctx context.Context, req *pb.GetTaskTemplateRequest, ) (*pb.GetTaskTemplateResponse, error) { - templateRepo := task_template_repo.New(hwdb.GetDB()) + templateRepo := tasktemplaterepo.New(hwdb.GetDB()) taskTemplateID, err := uuid.Parse(req.Id) if err != nil { @@ -537,7 +537,7 @@ func (s ServiceServer) GetTaskTemplate( taskTemplate := rows[0].TaskTemplate taskTemplateSubtasks := hwutil.FlatMap(rows, - func(row task_template_repo.GetTaskTemplateWithSubtasksByIDRow) **pb.GetTaskTemplateResponse_SubTask { + func(row tasktemplaterepo.GetTaskTemplateWithSubtasksByIDRow) **pb.GetTaskTemplateResponse_SubTask { if !row.SubTaskID.Valid { return nil } diff --git a/services/tasks-svc/internal/task/projections/postgres-projection/task_postgres_projection.go b/services/tasks-svc/internal/task/projections/postgres-projection/task_postgres_projection.go index 991dfac23..dc8a6f24e 100644 --- a/services/tasks-svc/internal/task/projections/postgres-projection/task_postgres_projection.go +++ b/services/tasks-svc/internal/task/projections/postgres-projection/task_postgres_projection.go @@ -16,12 +16,12 @@ import ( "tasks-svc/internal/task/aggregate" taskEventsV1 "tasks-svc/internal/task/events/v1" - "tasks-svc/repos/task_repo" + "tasks-svc/repos/task-repo" ) type Projection struct { *custom.CustomProjection - taskRepo *task_repo.Queries + taskRepo *taskrepo.Queries } func NewProjection(es *esdb.Client, serviceName string) *Projection { @@ -32,7 +32,7 @@ func NewProjection(es *esdb.Client, serviceName string) *Projection { subscriptionGroupName, &[]string{aggregate.TaskAggregateType + "-"}, ), - taskRepo: task_repo.New(hwdb.GetDB()), + taskRepo: taskrepo.New(hwdb.GetDB()), } p.initEventListeners() return p @@ -97,7 +97,7 @@ func (p *Projection) onTaskCreated(ctx context.Context, evt hwes.Event) (*esdb.N } // Add to db - err = p.taskRepo.CreateTask(ctx, task_repo.CreateTaskParams{ + err = p.taskRepo.CreateTask(ctx, taskrepo.CreateTaskParams{ ID: taskID, Name: payload.Name, PatientID: patientID, @@ -127,7 +127,7 @@ func (p *Projection) onTaskStatusUpdated(ctx context.Context, evt hwes.Event) (* return hwutil.PtrTo(esdb.NackActionPark), err } - err = p.taskRepo.UpdateTask(ctx, task_repo.UpdateTaskParams{ + err = p.taskRepo.UpdateTask(ctx, taskrepo.UpdateTaskParams{ ID: evt.AggregateID, Status: hwutil.PtrTo(int32(status)), Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -148,7 +148,7 @@ func (p *Projection) onTaskNameUpdated(ctx context.Context, evt hwes.Event) (*es return hwutil.PtrTo(esdb.NackActionPark), err } - err := p.taskRepo.UpdateTask(ctx, task_repo.UpdateTaskParams{ + err := p.taskRepo.UpdateTask(ctx, taskrepo.UpdateTaskParams{ ID: evt.AggregateID, Name: &payload.Name, Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -169,7 +169,7 @@ func (p *Projection) onTaskDescriptionUpdated(ctx context.Context, evt hwes.Even return hwutil.PtrTo(esdb.NackActionPark), err } - err := p.taskRepo.UpdateTask(ctx, task_repo.UpdateTaskParams{ + err := p.taskRepo.UpdateTask(ctx, taskrepo.UpdateTaskParams{ ID: evt.AggregateID, Description: &payload.Description, Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -190,7 +190,7 @@ func (p *Projection) onTaskDueAtUpdated(ctx context.Context, evt hwes.Event) (*e return hwutil.PtrTo(esdb.NackActionPark), err } - err := p.taskRepo.UpdateTask(ctx, task_repo.UpdateTaskParams{ + err := p.taskRepo.UpdateTask(ctx, taskrepo.UpdateTaskParams{ ID: evt.AggregateID, DueAt: hwdb.TimeToTimestamp(payload.DueAt), Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -229,7 +229,7 @@ func (p *Projection) onTaskAssigned(ctx context.Context, evt hwes.Event) (*esdb. return hwutil.PtrTo(esdb.NackActionPark), err } - err = p.taskRepo.UpdateTaskAssignedUser(ctx, task_repo.UpdateTaskAssignedUserParams{ + err = p.taskRepo.UpdateTaskAssignedUser(ctx, taskrepo.UpdateTaskAssignedUserParams{ ID: evt.AggregateID, AssignedUserID: userID, Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -250,7 +250,7 @@ func (p *Projection) onTaskUnassigned(ctx context.Context, evt hwes.Event) (*esd return hwutil.PtrTo(esdb.NackActionPark), err } - err := p.taskRepo.UpdateTaskAssignedUser(ctx, task_repo.UpdateTaskAssignedUserParams{ + err := p.taskRepo.UpdateTaskAssignedUser(ctx, taskrepo.UpdateTaskAssignedUserParams{ ID: evt.AggregateID, AssignedUserID: uuid.NullUUID{}, Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -263,7 +263,7 @@ func (p *Projection) onTaskUnassigned(ctx context.Context, evt hwes.Event) (*esd } func (p *Projection) onTaskPublished(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { - err := p.taskRepo.UpdateTask(ctx, task_repo.UpdateTaskParams{ + err := p.taskRepo.UpdateTask(ctx, taskrepo.UpdateTaskParams{ ID: evt.AggregateID, Public: hwutil.PtrTo(true), Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -276,7 +276,7 @@ func (p *Projection) onTaskPublished(ctx context.Context, evt hwes.Event) (*esdb } func (p *Projection) onTaskUnpublished(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { - err := p.taskRepo.UpdateTask(ctx, task_repo.UpdateTaskParams{ + err := p.taskRepo.UpdateTask(ctx, taskrepo.UpdateTaskParams{ ID: evt.AggregateID, Public: hwutil.PtrTo(false), Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -309,7 +309,7 @@ func (p *Projection) onSubtaskCreated(ctx context.Context, evt hwes.Event) (*esd return hwutil.PtrTo(esdb.NackActionPark), err } - err = p.taskRepo.CreateSubtask(ctx, task_repo.CreateSubtaskParams{ + err = p.taskRepo.CreateSubtask(ctx, taskrepo.CreateSubtaskParams{ ID: subtaskID, TaskID: evt.AggregateID, Name: payload.Name, @@ -338,7 +338,7 @@ func (p *Projection) onSubtaskNameUpdated(ctx context.Context, evt hwes.Event) ( return hwutil.PtrTo(esdb.NackActionPark), err } - err = p.taskRepo.UpdateSubtask(ctx, task_repo.UpdateSubtaskParams{ + err = p.taskRepo.UpdateSubtask(ctx, taskrepo.UpdateSubtaskParams{ ID: subtaskID, Name: &payload.Name, Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -364,7 +364,7 @@ func (p *Projection) onSubtaskCompleted(ctx context.Context, evt hwes.Event) (*e return hwutil.PtrTo(esdb.NackActionPark), err } - err = p.taskRepo.UpdateSubtask(ctx, task_repo.UpdateSubtaskParams{ + err = p.taskRepo.UpdateSubtask(ctx, taskrepo.UpdateSubtaskParams{ ID: subtaskID, Done: hwutil.PtrTo(true), Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -390,7 +390,7 @@ func (p *Projection) onSubtaskUncompleted(ctx context.Context, evt hwes.Event) ( return hwutil.PtrTo(esdb.NackActionPark), err } - err = p.taskRepo.UpdateSubtask(ctx, task_repo.UpdateSubtaskParams{ + err = p.taskRepo.UpdateSubtask(ctx, taskrepo.UpdateSubtaskParams{ ID: subtaskID, Done: hwutil.PtrTo(false), Consistency: int64(evt.GetVersion()), //nolint:gosec @@ -416,7 +416,7 @@ func (p *Projection) onSubtaskDeleted(ctx context.Context, evt hwes.Event) (*esd return hwutil.PtrTo(esdb.NackActionPark), err } - err = p.taskRepo.DeleteSubtask(ctx, task_repo.DeleteSubtaskParams{ + err = p.taskRepo.DeleteSubtask(ctx, taskrepo.DeleteSubtaskParams{ ID: subtaskID, Consistency: int64(evt.GetVersion()), //nolint:gosec }) @@ -427,7 +427,7 @@ func (p *Projection) onSubtaskDeleted(ctx context.Context, evt hwes.Event) (*esd } func (p *Projection) onTaskDueAtRemoved(ctx context.Context, evt hwes.Event) (*esdb.NackAction, error) { - err := p.taskRepo.RemoveTaskDueAt(ctx, task_repo.RemoveTaskDueAtParams{ + err := p.taskRepo.RemoveTaskDueAt(ctx, taskrepo.RemoveTaskDueAtParams{ ID: evt.AggregateID, Consistency: int64(evt.GetVersion()), //nolint:gosec }) diff --git a/services/tasks-svc/internal/task/queries/v1/get_task_with_patient_by_id.go b/services/tasks-svc/internal/task/queries/v1/get_task_with_patient_by_id.go index b8b670ff3..2adac01a2 100644 --- a/services/tasks-svc/internal/task/queries/v1/get_task_with_patient_by_id.go +++ b/services/tasks-svc/internal/task/queries/v1/get_task_with_patient_by_id.go @@ -14,7 +14,7 @@ import ( "github.com/google/uuid" "tasks-svc/internal/task/models" - "tasks-svc/repos/task_repo" + "tasks-svc/repos/task-repo" ) type GetTaskWithPatientByIDQueryHandler func(ctx context.Context, taskID uuid.UUID) (*models.TaskWithPatient, error) @@ -28,7 +28,7 @@ func NewGetTaskWithPatientByIDQueryHandler(authz hwauthz.AuthZ) GetTaskWithPatie return nil, err } - taskRepo := task_repo.New(hwdb.GetDB()) + taskRepo := taskrepo.New(hwdb.GetDB()) rows, err := taskRepo.GetTaskWithPatientById(ctx, taskID) if err := hwdb.Error(ctx, err); err != nil { diff --git a/services/tasks-svc/internal/task/queries/v1/get_tasks_by_patient.go b/services/tasks-svc/internal/task/queries/v1/get_tasks_by_patient.go index 784bbe4a7..dd6fcd711 100644 --- a/services/tasks-svc/internal/task/queries/v1/get_tasks_by_patient.go +++ b/services/tasks-svc/internal/task/queries/v1/get_tasks_by_patient.go @@ -15,7 +15,7 @@ import ( "tasks-svc/internal/task/perm" "tasks-svc/internal/task/models" - "tasks-svc/repos/task_repo" + "tasks-svc/repos/task-repo" ) type GetTasksByPatientIDQueryHandler func( @@ -32,7 +32,7 @@ func NewGetTasksByPatientIDQueryHandler(authz hwauthz.AuthZ) GetTasksByPatientID return nil, err } - taskRepo := task_repo.New(hwdb.GetDB()) + taskRepo := taskrepo.New(hwdb.GetDB()) tasksWithSubtasks, err := taskRepo.GetTasksWithSubtasksByPatient(ctx, patientID) if err := hwdb.Error(ctx, err); err != nil { diff --git a/services/tasks-svc/internal/task/queries/v1/get_tasks_with_patients_by_asignee.go b/services/tasks-svc/internal/task/queries/v1/get_tasks_with_patients_by_asignee.go index b145f1966..009b5f46a 100644 --- a/services/tasks-svc/internal/task/queries/v1/get_tasks_with_patients_by_asignee.go +++ b/services/tasks-svc/internal/task/queries/v1/get_tasks_with_patients_by_asignee.go @@ -15,7 +15,7 @@ import ( "github.com/google/uuid" "tasks-svc/internal/task/models" - "tasks-svc/repos/task_repo" + "tasks-svc/repos/task-repo" ) type GetTasksWithPatientsByAssigneeQueryHandler func( @@ -25,7 +25,7 @@ type GetTasksWithPatientsByAssigneeQueryHandler func( func NewGetTasksWithPatientsByAssigneeQueryHandler(authz hwauthz.AuthZ) GetTasksWithPatientsByAssigneeQueryHandler { return func(ctx context.Context, assigneeID uuid.UUID) ([]*models.TaskWithPatient, error) { - taskRepo := task_repo.New(hwdb.GetDB()) + taskRepo := taskrepo.New(hwdb.GetDB()) user := commonperm.UserFromCtx(ctx) diff --git a/services/tasks-svc/internal/ward/ward.go b/services/tasks-svc/internal/ward/ward.go index 35bea85b8..5810ec4a1 100644 --- a/services/tasks-svc/internal/ward/ward.go +++ b/services/tasks-svc/internal/ward/ward.go @@ -24,7 +24,7 @@ import ( "google.golang.org/grpc/status" "tasks-svc/internal/tracking" - "tasks-svc/repos/ward_repo" + "tasks-svc/repos/ward-repo" pbEventsV1 "gen/libs/events/v1" ) @@ -57,7 +57,7 @@ func NewServiceServer(authz hwauthz.AuthZ, es *esdb.Client) *ServiceServer { func (s *ServiceServer) CreateWard(ctx context.Context, req *pb.CreateWardRequest) (*pb.CreateWardResponse, error) { log := zlog.Ctx(ctx) - wardRepo := ward_repo.New(hwdb.GetDB()) + wardRepo := wardrepo.New(hwdb.GetDB()) // check permissions user := commonperm.UserFromCtx(ctx) @@ -116,7 +116,7 @@ func (s *ServiceServer) CreateWard(ctx context.Context, req *pb.CreateWardReques } func (s *ServiceServer) GetWard(ctx context.Context, req *pb.GetWardRequest) (*pb.GetWardResponse, error) { - wardRepo := ward_repo.New(hwdb.GetDB()) + wardRepo := wardrepo.New(hwdb.GetDB()) // parse input id, err := uuid.Parse(req.GetId()) @@ -150,7 +150,7 @@ func (s *ServiceServer) GetWard(ctx context.Context, req *pb.GetWardRequest) (*p } func (s *ServiceServer) GetWards(ctx context.Context, req *pb.GetWardsRequest) (*pb.GetWardsResponse, error) { - wardRepo := ward_repo.New(hwdb.GetDB()) + wardRepo := wardrepo.New(hwdb.GetDB()) wards, err := wardRepo.GetWards(ctx) err = hwdb.Error(ctx, err) @@ -159,7 +159,7 @@ func (s *ServiceServer) GetWards(ctx context.Context, req *pb.GetWardsRequest) ( } user := commonperm.UserFromCtx(ctx) - checks := hwutil.Map(wards, func(w ward_repo.Ward) hwauthz.PermissionCheck { + checks := hwutil.Map(wards, func(w wardrepo.Ward) hwauthz.PermissionCheck { return hwauthz.NewPermissionCheck(user, perm.WardCanUserGet, perm.Ward(w.ID)) }) canGet, err := s.authz.BulkCheck(ctx, checks) @@ -167,12 +167,12 @@ func (s *ServiceServer) GetWards(ctx context.Context, req *pb.GetWardsRequest) ( return nil, err } - wards = hwutil.Filter(wards, func(i int, _ ward_repo.Ward) bool { + wards = hwutil.Filter(wards, func(i int, _ wardrepo.Ward) bool { return canGet[i] }) return &pb.GetWardsResponse{ - Wards: hwutil.Map(wards, func(ward ward_repo.Ward) *pb.GetWardsResponse_Ward { + Wards: hwutil.Map(wards, func(ward wardrepo.Ward) *pb.GetWardsResponse_Ward { return &pb.GetWardsResponse_Ward{ Id: ward.ID.String(), Name: ward.Name, @@ -186,7 +186,7 @@ func (s *ServiceServer) GetRecentWards( ctx context.Context, _ *pb.GetRecentWardsRequest, ) (*pb.GetRecentWardsResponse, error) { - wardRepo := ward_repo.New(hwdb.GetDB()) + wardRepo := wardrepo.New(hwdb.GetDB()) log := zlog.Ctx(ctx) recentWardIDsStr, err := tracking.GetRecentWardsForUser(ctx) @@ -205,7 +205,7 @@ func (s *ServiceServer) GetRecentWards( }) // do query - rows, err := wardRepo.GetWardsWithCounts(ctx, ward_repo.GetWardsWithCountsParams{ + rows, err := wardRepo.GetWardsWithCounts(ctx, wardrepo.GetWardsWithCountsParams{ StatusTodo: int32(pb.TaskStatus_TASK_STATUS_TODO), StatusInProgress: int32(pb.TaskStatus_TASK_STATUS_IN_PROGRESS), StatusDone: int32(pb.TaskStatus_TASK_STATUS_DONE), @@ -218,7 +218,7 @@ func (s *ServiceServer) GetRecentWards( // check permissions user := commonperm.UserFromCtx(ctx) - checks := hwutil.Map(rows, func(w ward_repo.GetWardsWithCountsRow) hwauthz.PermissionCheck { + checks := hwutil.Map(rows, func(w wardrepo.GetWardsWithCountsRow) hwauthz.PermissionCheck { return hwauthz.NewPermissionCheck(user, perm.WardCanUserGet, perm.Ward(w.Ward.ID)) }) canGet, err := s.authz.BulkCheck(ctx, checks) @@ -226,12 +226,12 @@ func (s *ServiceServer) GetRecentWards( return nil, err } - rows = hwutil.Filter(rows, func(i int, _ ward_repo.GetWardsWithCountsRow) bool { + rows = hwutil.Filter(rows, func(i int, _ wardrepo.GetWardsWithCountsRow) bool { return canGet[i] }) // return - response := hwutil.Map(rows, func(row ward_repo.GetWardsWithCountsRow) *pb.GetRecentWardsResponse_Ward { + response := hwutil.Map(rows, func(row wardrepo.GetWardsWithCountsRow) *pb.GetRecentWardsResponse_Ward { return &pb.GetRecentWardsResponse_Ward{ Id: row.Ward.ID.String(), Name: row.Ward.Name, @@ -247,7 +247,7 @@ func (s *ServiceServer) GetRecentWards( } func (s *ServiceServer) UpdateWard(ctx context.Context, req *pb.UpdateWardRequest) (*pb.UpdateWardResponse, error) { - wardRepo := ward_repo.New(hwdb.GetDB()) + wardRepo := wardrepo.New(hwdb.GetDB()) // parse input id, err := uuid.Parse(req.GetId()) @@ -263,7 +263,7 @@ func (s *ServiceServer) UpdateWard(ctx context.Context, req *pb.UpdateWardReques } // do query - consistency, err := wardRepo.UpdateWard(ctx, ward_repo.UpdateWardParams{ + consistency, err := wardRepo.UpdateWard(ctx, wardrepo.UpdateWardParams{ ID: id, Name: req.Name, }) @@ -293,7 +293,7 @@ func (s *ServiceServer) UpdateWard(ctx context.Context, req *pb.UpdateWardReques } func (s *ServiceServer) DeleteWard(ctx context.Context, req *pb.DeleteWardRequest) (*pb.DeleteWardResponse, error) { - wardRepo := ward_repo.New(hwdb.GetDB()) + wardRepo := wardrepo.New(hwdb.GetDB()) // parse input wardID, err := uuid.Parse(req.GetId()) @@ -350,9 +350,9 @@ func (s *ServiceServer) GetWardOverviews( ctx context.Context, _ *pb.GetWardOverviewsRequest, ) (*pb.GetWardOverviewsResponse, error) { - wardRepo := ward_repo.New(hwdb.GetDB()) + wardRepo := wardrepo.New(hwdb.GetDB()) - rows, err := wardRepo.GetWardsWithCounts(ctx, ward_repo.GetWardsWithCountsParams{ + rows, err := wardRepo.GetWardsWithCounts(ctx, wardrepo.GetWardsWithCountsParams{ StatusTodo: int32(pb.TaskStatus_TASK_STATUS_TODO), StatusInProgress: int32(pb.TaskStatus_TASK_STATUS_IN_PROGRESS), StatusDone: int32(pb.TaskStatus_TASK_STATUS_DONE), @@ -364,7 +364,7 @@ func (s *ServiceServer) GetWardOverviews( } user := commonperm.UserFromCtx(ctx) - checks := hwutil.Map(rows, func(w ward_repo.GetWardsWithCountsRow) hwauthz.PermissionCheck { + checks := hwutil.Map(rows, func(w wardrepo.GetWardsWithCountsRow) hwauthz.PermissionCheck { return hwauthz.NewPermissionCheck(user, perm.WardCanUserGet, perm.Ward(w.Ward.ID)) }) canGet, err := s.authz.BulkCheck(ctx, checks) @@ -372,11 +372,11 @@ func (s *ServiceServer) GetWardOverviews( return nil, err } - rows = hwutil.Filter(rows, func(i int, _ ward_repo.GetWardsWithCountsRow) bool { + rows = hwutil.Filter(rows, func(i int, _ wardrepo.GetWardsWithCountsRow) bool { return canGet[i] }) - resWards := hwutil.Map(rows, func(row ward_repo.GetWardsWithCountsRow) *pb.GetWardOverviewsResponse_Ward { + resWards := hwutil.Map(rows, func(row wardrepo.GetWardsWithCountsRow) *pb.GetWardOverviewsResponse_Ward { return &pb.GetWardOverviewsResponse_Ward{ Id: row.Ward.ID.String(), Name: row.Ward.Name, @@ -395,7 +395,7 @@ func (s *ServiceServer) GetWardDetails( ctx context.Context, req *pb.GetWardDetailsRequest, ) (*pb.GetWardDetailsResponse, error) { - wardRepo := ward_repo.New(hwdb.GetDB()) + wardRepo := wardrepo.New(hwdb.GetDB()) wardID, err := uuid.Parse(req.GetId()) if err != nil { diff --git a/services/tasks-svc/repos/bed_repo/bed_repo.sql.go b/services/tasks-svc/repos/bed-repo/bed_repo.sql.go similarity index 99% rename from services/tasks-svc/repos/bed_repo/bed_repo.sql.go rename to services/tasks-svc/repos/bed-repo/bed_repo.sql.go index 654424f3a..9782045f0 100644 --- a/services/tasks-svc/repos/bed_repo/bed_repo.sql.go +++ b/services/tasks-svc/repos/bed-repo/bed_repo.sql.go @@ -3,7 +3,7 @@ // sqlc v1.27.0 // source: bed_repo.sql -package bed_repo +package bedrepo import ( "context" diff --git a/services/tasks-svc/repos/bed_repo/db.go b/services/tasks-svc/repos/bed-repo/db.go similarity index 97% rename from services/tasks-svc/repos/bed_repo/db.go rename to services/tasks-svc/repos/bed-repo/db.go index 48672702c..dd1e68145 100644 --- a/services/tasks-svc/repos/bed_repo/db.go +++ b/services/tasks-svc/repos/bed-repo/db.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package bed_repo +package bedrepo import ( "context" diff --git a/services/tasks-svc/repos/bed_repo/models.go b/services/tasks-svc/repos/bed-repo/models.go similarity index 94% rename from services/tasks-svc/repos/bed_repo/models.go rename to services/tasks-svc/repos/bed-repo/models.go index 9ce5e44b9..5e912c78c 100644 --- a/services/tasks-svc/repos/bed_repo/models.go +++ b/services/tasks-svc/repos/bed-repo/models.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package bed_repo +package bedrepo import ( "github.com/google/uuid" @@ -26,6 +26,8 @@ type Patient struct { IsDischarged bool Consistency int64 OrganizationID uuid.UUID + Gender int32 + DateOfBirth pgtype.Date } type Room struct { diff --git a/services/tasks-svc/repos/patient-repo/db.go b/services/tasks-svc/repos/patient-repo/db.go new file mode 100644 index 000000000..0da5d3fe1 --- /dev/null +++ b/services/tasks-svc/repos/patient-repo/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.27.0 + +package patientrepo + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/services/tasks-svc/repos/patient-repo/models.go b/services/tasks-svc/repos/patient-repo/models.go new file mode 100644 index 000000000..d0ddf941d --- /dev/null +++ b/services/tasks-svc/repos/patient-repo/models.go @@ -0,0 +1,87 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.27.0 + +package patientrepo + +import ( + "github.com/google/uuid" + "github.com/jackc/pgx/v5/pgtype" +) + +type Bed struct { + ID uuid.UUID + RoomID uuid.UUID + Name string + Consistency int64 +} + +type Patient struct { + ID uuid.UUID + HumanReadableIdentifier string + Notes string + BedID uuid.NullUUID + CreatedAt pgtype.Timestamp + UpdatedAt pgtype.Timestamp + IsDischarged bool + Consistency int64 + OrganizationID uuid.UUID + Gender int32 + DateOfBirth pgtype.Date +} + +type Room struct { + ID uuid.UUID + Name string + WardID uuid.UUID + Consistency int64 +} + +type SchemaMigration struct { + Version int64 + Dirty bool +} + +type Subtask struct { + ID uuid.UUID + TaskID uuid.UUID + Name string + Done bool + CreatedBy uuid.UUID + CreationDate pgtype.Timestamp +} + +type Task struct { + ID uuid.UUID + Name string + Description string + Status int32 + AssignedUserID uuid.NullUUID + PatientID uuid.UUID + Public bool + CreatedBy uuid.UUID + DueAt pgtype.Timestamp + CreatedAt pgtype.Timestamp + Consistency int64 +} + +type TaskTemplate struct { + ID uuid.UUID + Name string + Description string + WardID uuid.NullUUID + CreatedBy uuid.UUID + Consistency int64 +} + +type TaskTemplateSubtask struct { + ID uuid.UUID + TaskTemplateID uuid.UUID + Name string +} + +type Ward struct { + ID uuid.UUID + Name string + Consistency int64 +} diff --git a/services/tasks-svc/repos/patient_repo/patient_repo.sql.go b/services/tasks-svc/repos/patient-repo/patient_repo.sql.go similarity index 95% rename from services/tasks-svc/repos/patient_repo/patient_repo.sql.go rename to services/tasks-svc/repos/patient-repo/patient_repo.sql.go index 6614e5145..09c5e1694 100644 --- a/services/tasks-svc/repos/patient_repo/patient_repo.sql.go +++ b/services/tasks-svc/repos/patient-repo/patient_repo.sql.go @@ -3,7 +3,7 @@ // sqlc v1.27.0 // source: patient_repo.sql -package patient_repo +package patientrepo import ( "context" @@ -52,7 +52,7 @@ func (q *Queries) DeletePatient(ctx context.Context, id uuid.UUID) error { const getAllPatientsWithTasksBedAndRoom = `-- name: GetAllPatientsWithTasksBedAndRoom :many SELECT - patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, + patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, patients.gender, patients.date_of_birth, tasks.id as task_id, tasks.name as task_name, tasks.description as task_description, @@ -118,6 +118,8 @@ func (q *Queries) GetAllPatientsWithTasksBedAndRoom(ctx context.Context, organiz &i.Patient.IsDischarged, &i.Patient.Consistency, &i.Patient.OrganizationID, + &i.Patient.Gender, + &i.Patient.DateOfBirth, &i.TaskID, &i.TaskName, &i.TaskDescription, @@ -147,7 +149,7 @@ func (q *Queries) GetAllPatientsWithTasksBedAndRoom(ctx context.Context, organiz } const getPatientByBed = `-- name: GetPatientByBed :one -SELECT patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id +SELECT patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, patients.gender, patients.date_of_birth FROM patients WHERE bed_id = $1 LIMIT 1 @@ -166,13 +168,15 @@ func (q *Queries) GetPatientByBed(ctx context.Context, bedID uuid.NullUUID) (Pat &i.IsDischarged, &i.Consistency, &i.OrganizationID, + &i.Gender, + &i.DateOfBirth, ) return i, err } const getPatientWithBedAndRoom = `-- name: GetPatientWithBedAndRoom :one SELECT - patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, + patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, patients.gender, patients.date_of_birth, beds.name as bed_name, beds.consistency as bed_consistency, rooms.id as room_id, @@ -196,6 +200,8 @@ type GetPatientWithBedAndRoomRow struct { IsDischarged bool Consistency int64 OrganizationID uuid.UUID + Gender int32 + DateOfBirth pgtype.Date BedName *string BedConsistency *int64 RoomID uuid.NullUUID @@ -217,6 +223,8 @@ func (q *Queries) GetPatientWithBedAndRoom(ctx context.Context, patientID uuid.U &i.IsDischarged, &i.Consistency, &i.OrganizationID, + &i.Gender, + &i.DateOfBirth, &i.BedName, &i.BedConsistency, &i.RoomID, @@ -229,7 +237,7 @@ func (q *Queries) GetPatientWithBedAndRoom(ctx context.Context, patientID uuid.U const getPatientsByWard = `-- name: GetPatientsByWard :many SELECT - patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id + patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, patients.gender, patients.date_of_birth FROM patients JOIN beds ON patients.bed_id = beds.id JOIN rooms ON beds.room_id = rooms.id @@ -255,6 +263,8 @@ func (q *Queries) GetPatientsByWard(ctx context.Context, wardID uuid.UUID) ([]Pa &i.IsDischarged, &i.Consistency, &i.OrganizationID, + &i.Gender, + &i.DateOfBirth, ); err != nil { return nil, err } diff --git a/services/tasks-svc/repos/room_repo/db.go b/services/tasks-svc/repos/room-repo/db.go similarity index 96% rename from services/tasks-svc/repos/room_repo/db.go rename to services/tasks-svc/repos/room-repo/db.go index f90aea524..dfba078fc 100644 --- a/services/tasks-svc/repos/room_repo/db.go +++ b/services/tasks-svc/repos/room-repo/db.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package room_repo +package roomrepo import ( "context" diff --git a/services/tasks-svc/repos/patient_repo/models.go b/services/tasks-svc/repos/room-repo/models.go similarity index 94% rename from services/tasks-svc/repos/patient_repo/models.go rename to services/tasks-svc/repos/room-repo/models.go index 621b22b94..2ddf29fa8 100644 --- a/services/tasks-svc/repos/patient_repo/models.go +++ b/services/tasks-svc/repos/room-repo/models.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package patient_repo +package roomrepo import ( "github.com/google/uuid" @@ -26,6 +26,8 @@ type Patient struct { IsDischarged bool Consistency int64 OrganizationID uuid.UUID + Gender int32 + DateOfBirth pgtype.Date } type Room struct { diff --git a/services/tasks-svc/repos/room_repo/room_repo.sql.go b/services/tasks-svc/repos/room-repo/room_repo.sql.go similarity index 99% rename from services/tasks-svc/repos/room_repo/room_repo.sql.go rename to services/tasks-svc/repos/room-repo/room_repo.sql.go index 0e0a94b05..d3c90f001 100644 --- a/services/tasks-svc/repos/room_repo/room_repo.sql.go +++ b/services/tasks-svc/repos/room-repo/room_repo.sql.go @@ -3,7 +3,7 @@ // sqlc v1.27.0 // source: room_repo.sql -package room_repo +package roomrepo import ( "context" diff --git a/services/tasks-svc/repos/task_repo/db.go b/services/tasks-svc/repos/task-repo/db.go similarity index 96% rename from services/tasks-svc/repos/task_repo/db.go rename to services/tasks-svc/repos/task-repo/db.go index c6afb2942..e8c660645 100644 --- a/services/tasks-svc/repos/task_repo/db.go +++ b/services/tasks-svc/repos/task-repo/db.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package task_repo +package taskrepo import ( "context" diff --git a/services/tasks-svc/repos/room_repo/models.go b/services/tasks-svc/repos/task-repo/models.go similarity index 94% rename from services/tasks-svc/repos/room_repo/models.go rename to services/tasks-svc/repos/task-repo/models.go index 1d9724a93..e69076da4 100644 --- a/services/tasks-svc/repos/room_repo/models.go +++ b/services/tasks-svc/repos/task-repo/models.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package room_repo +package taskrepo import ( "github.com/google/uuid" @@ -26,6 +26,8 @@ type Patient struct { IsDischarged bool Consistency int64 OrganizationID uuid.UUID + Gender int32 + DateOfBirth pgtype.Date } type Room struct { diff --git a/services/tasks-svc/repos/task_repo/task_repo.sql.go b/services/tasks-svc/repos/task-repo/task_repo.sql.go similarity index 97% rename from services/tasks-svc/repos/task_repo/task_repo.sql.go rename to services/tasks-svc/repos/task-repo/task_repo.sql.go index 3b9b703d5..18e90e22f 100644 --- a/services/tasks-svc/repos/task_repo/task_repo.sql.go +++ b/services/tasks-svc/repos/task-repo/task_repo.sql.go @@ -3,7 +3,7 @@ // sqlc v1.27.0 // source: task_repo.sql -package task_repo +package taskrepo import ( "context" @@ -108,7 +108,7 @@ func (q *Queries) DeleteTask(ctx context.Context, id uuid.UUID) error { const getTaskWithPatientById = `-- name: GetTaskWithPatientById :many SELECT tasks.id, tasks.name, tasks.description, tasks.status, tasks.assigned_user_id, tasks.patient_id, tasks.public, tasks.created_by, tasks.due_at, tasks.created_at, tasks.consistency, - patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, + patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, patients.gender, patients.date_of_birth, subtasks.id as subtask_id, subtasks.name as subtask_name, subtasks.done as subtask_done, @@ -158,6 +158,8 @@ func (q *Queries) GetTaskWithPatientById(ctx context.Context, id uuid.UUID) ([]G &i.Patient.IsDischarged, &i.Patient.Consistency, &i.Patient.OrganizationID, + &i.Patient.Gender, + &i.Patient.DateOfBirth, &i.SubtaskID, &i.SubtaskName, &i.SubtaskDone, @@ -176,7 +178,7 @@ func (q *Queries) GetTaskWithPatientById(ctx context.Context, id uuid.UUID) ([]G const getTasksWithPatientByAssignee = `-- name: GetTasksWithPatientByAssignee :many SELECT tasks.id, tasks.name, tasks.description, tasks.status, tasks.assigned_user_id, tasks.patient_id, tasks.public, tasks.created_by, tasks.due_at, tasks.created_at, tasks.consistency, - patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, + patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, patients.gender, patients.date_of_birth, subtasks.id as subtask_id, subtasks.name as subtask_name, subtasks.done as subtask_done, @@ -226,6 +228,8 @@ func (q *Queries) GetTasksWithPatientByAssignee(ctx context.Context, assignedUse &i.Patient.IsDischarged, &i.Patient.Consistency, &i.Patient.OrganizationID, + &i.Patient.Gender, + &i.Patient.DateOfBirth, &i.SubtaskID, &i.SubtaskName, &i.SubtaskDone, diff --git a/services/tasks-svc/repos/task_template_repo/copyfrom.go b/services/tasks-svc/repos/task-template-repo/copyfrom.go similarity index 97% rename from services/tasks-svc/repos/task_template_repo/copyfrom.go rename to services/tasks-svc/repos/task-template-repo/copyfrom.go index d77789362..bea288c77 100644 --- a/services/tasks-svc/repos/task_template_repo/copyfrom.go +++ b/services/tasks-svc/repos/task-template-repo/copyfrom.go @@ -3,7 +3,7 @@ // sqlc v1.27.0 // source: copyfrom.go -package task_template_repo +package tasktemplaterepo import ( "context" diff --git a/services/tasks-svc/repos/task_template_repo/db.go b/services/tasks-svc/repos/task-template-repo/db.go similarity index 96% rename from services/tasks-svc/repos/task_template_repo/db.go rename to services/tasks-svc/repos/task-template-repo/db.go index 7cbc2f3c1..b948cd443 100644 --- a/services/tasks-svc/repos/task_template_repo/db.go +++ b/services/tasks-svc/repos/task-template-repo/db.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package task_template_repo +package tasktemplaterepo import ( "context" diff --git a/services/tasks-svc/repos/task-template-repo/models.go b/services/tasks-svc/repos/task-template-repo/models.go new file mode 100644 index 000000000..58802ed10 --- /dev/null +++ b/services/tasks-svc/repos/task-template-repo/models.go @@ -0,0 +1,87 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.27.0 + +package tasktemplaterepo + +import ( + "github.com/google/uuid" + "github.com/jackc/pgx/v5/pgtype" +) + +type Bed struct { + ID uuid.UUID + RoomID uuid.UUID + Name string + Consistency int64 +} + +type Patient struct { + ID uuid.UUID + HumanReadableIdentifier string + Notes string + BedID uuid.NullUUID + CreatedAt pgtype.Timestamp + UpdatedAt pgtype.Timestamp + IsDischarged bool + Consistency int64 + OrganizationID uuid.UUID + Gender int32 + DateOfBirth pgtype.Date +} + +type Room struct { + ID uuid.UUID + Name string + WardID uuid.UUID + Consistency int64 +} + +type SchemaMigration struct { + Version int64 + Dirty bool +} + +type Subtask struct { + ID uuid.UUID + TaskID uuid.UUID + Name string + Done bool + CreatedBy uuid.UUID + CreationDate pgtype.Timestamp +} + +type Task struct { + ID uuid.UUID + Name string + Description string + Status int32 + AssignedUserID uuid.NullUUID + PatientID uuid.UUID + Public bool + CreatedBy uuid.UUID + DueAt pgtype.Timestamp + CreatedAt pgtype.Timestamp + Consistency int64 +} + +type TaskTemplate struct { + ID uuid.UUID + Name string + Description string + WardID uuid.NullUUID + CreatedBy uuid.UUID + Consistency int64 +} + +type TaskTemplateSubtask struct { + ID uuid.UUID + TaskTemplateID uuid.UUID + Name string +} + +type Ward struct { + ID uuid.UUID + Name string + Consistency int64 +} diff --git a/services/tasks-svc/repos/task_template_repo/task_template_repo.sql.go b/services/tasks-svc/repos/task-template-repo/task_template_repo.sql.go similarity index 99% rename from services/tasks-svc/repos/task_template_repo/task_template_repo.sql.go rename to services/tasks-svc/repos/task-template-repo/task_template_repo.sql.go index 0e910f698..3dc04bffb 100644 --- a/services/tasks-svc/repos/task_template_repo/task_template_repo.sql.go +++ b/services/tasks-svc/repos/task-template-repo/task_template_repo.sql.go @@ -3,7 +3,7 @@ // sqlc v1.27.0 // source: task_template_repo.sql -package task_template_repo +package tasktemplaterepo import ( "context" diff --git a/services/tasks-svc/repos/task_template_repo/models.go b/services/tasks-svc/repos/task_template_repo/models.go deleted file mode 100644 index c02b6c49f..000000000 --- a/services/tasks-svc/repos/task_template_repo/models.go +++ /dev/null @@ -1,85 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.27.0 - -package task_template_repo - -import ( - "github.com/google/uuid" - "github.com/jackc/pgx/v5/pgtype" -) - -type Bed struct { - ID uuid.UUID - RoomID uuid.UUID - Name string - Consistency int64 -} - -type Patient struct { - ID uuid.UUID - HumanReadableIdentifier string - Notes string - BedID uuid.NullUUID - CreatedAt pgtype.Timestamp - UpdatedAt pgtype.Timestamp - IsDischarged bool - Consistency int64 - OrganizationID uuid.UUID -} - -type Room struct { - ID uuid.UUID - Name string - WardID uuid.UUID - Consistency int64 -} - -type SchemaMigration struct { - Version int64 - Dirty bool -} - -type Subtask struct { - ID uuid.UUID - TaskID uuid.UUID - Name string - Done bool - CreatedBy uuid.UUID - CreationDate pgtype.Timestamp -} - -type Task struct { - ID uuid.UUID - Name string - Description string - Status int32 - AssignedUserID uuid.NullUUID - PatientID uuid.UUID - Public bool - CreatedBy uuid.UUID - DueAt pgtype.Timestamp - CreatedAt pgtype.Timestamp - Consistency int64 -} - -type TaskTemplate struct { - ID uuid.UUID - Name string - Description string - WardID uuid.NullUUID - CreatedBy uuid.UUID - Consistency int64 -} - -type TaskTemplateSubtask struct { - ID uuid.UUID - TaskTemplateID uuid.UUID - Name string -} - -type Ward struct { - ID uuid.UUID - Name string - Consistency int64 -} diff --git a/services/tasks-svc/repos/ward_repo/db.go b/services/tasks-svc/repos/ward-repo/db.go similarity index 96% rename from services/tasks-svc/repos/ward_repo/db.go rename to services/tasks-svc/repos/ward-repo/db.go index 475fa9c57..6faf51dea 100644 --- a/services/tasks-svc/repos/ward_repo/db.go +++ b/services/tasks-svc/repos/ward-repo/db.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package ward_repo +package wardrepo import ( "context" diff --git a/services/tasks-svc/repos/task_repo/models.go b/services/tasks-svc/repos/ward-repo/models.go similarity index 94% rename from services/tasks-svc/repos/task_repo/models.go rename to services/tasks-svc/repos/ward-repo/models.go index 246e9c07b..5792d9f73 100644 --- a/services/tasks-svc/repos/task_repo/models.go +++ b/services/tasks-svc/repos/ward-repo/models.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package task_repo +package wardrepo import ( "github.com/google/uuid" @@ -26,6 +26,8 @@ type Patient struct { IsDischarged bool Consistency int64 OrganizationID uuid.UUID + Gender int32 + DateOfBirth pgtype.Date } type Room struct { diff --git a/services/tasks-svc/repos/ward_repo/ward_repo.sql.go b/services/tasks-svc/repos/ward-repo/ward_repo.sql.go similarity index 99% rename from services/tasks-svc/repos/ward_repo/ward_repo.sql.go rename to services/tasks-svc/repos/ward-repo/ward_repo.sql.go index cf67ca44a..362d11d32 100644 --- a/services/tasks-svc/repos/ward_repo/ward_repo.sql.go +++ b/services/tasks-svc/repos/ward-repo/ward_repo.sql.go @@ -3,7 +3,7 @@ // sqlc v1.27.0 // source: ward_repo.sql -package ward_repo +package wardrepo import ( "context" diff --git a/services/tasks-svc/repos/ward_repo/models.go b/services/tasks-svc/repos/ward_repo/models.go deleted file mode 100644 index 31178babb..000000000 --- a/services/tasks-svc/repos/ward_repo/models.go +++ /dev/null @@ -1,85 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.27.0 - -package ward_repo - -import ( - "github.com/google/uuid" - "github.com/jackc/pgx/v5/pgtype" -) - -type Bed struct { - ID uuid.UUID - RoomID uuid.UUID - Name string - Consistency int64 -} - -type Patient struct { - ID uuid.UUID - HumanReadableIdentifier string - Notes string - BedID uuid.NullUUID - CreatedAt pgtype.Timestamp - UpdatedAt pgtype.Timestamp - IsDischarged bool - Consistency int64 - OrganizationID uuid.UUID -} - -type Room struct { - ID uuid.UUID - Name string - WardID uuid.UUID - Consistency int64 -} - -type SchemaMigration struct { - Version int64 - Dirty bool -} - -type Subtask struct { - ID uuid.UUID - TaskID uuid.UUID - Name string - Done bool - CreatedBy uuid.UUID - CreationDate pgtype.Timestamp -} - -type Task struct { - ID uuid.UUID - Name string - Description string - Status int32 - AssignedUserID uuid.NullUUID - PatientID uuid.UUID - Public bool - CreatedBy uuid.UUID - DueAt pgtype.Timestamp - CreatedAt pgtype.Timestamp - Consistency int64 -} - -type TaskTemplate struct { - ID uuid.UUID - Name string - Description string - WardID uuid.NullUUID - CreatedBy uuid.UUID - Consistency int64 -} - -type TaskTemplateSubtask struct { - ID uuid.UUID - TaskTemplateID uuid.UUID - Name string -} - -type Ward struct { - ID uuid.UUID - Name string - Consistency int64 -} diff --git a/services/tasks-svc/schema.sql b/services/tasks-svc/schema.sql index 27e4b37e3..60e969fa7 100644 --- a/services/tasks-svc/schema.sql +++ b/services/tasks-svc/schema.sql @@ -59,7 +59,9 @@ CREATE TABLE public.patients ( updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, is_discharged boolean DEFAULT false NOT NULL, consistency bigint DEFAULT 0 NOT NULL, - organization_id uuid NOT NULL + organization_id uuid NOT NULL, + gender integer DEFAULT 0 NOT NULL, + date_of_birth date ); diff --git a/services/tasks-svc/sqlc.yaml b/services/tasks-svc/sqlc.yaml index 361fe73af..3ac7e9450 100644 --- a/services/tasks-svc/sqlc.yaml +++ b/services/tasks-svc/sqlc.yaml @@ -7,8 +7,8 @@ sql: gen: go: &repo-go - package: "bed_repo" - out: "repos/bed_repo" + package: "bedrepo" + out: "repos/bed-repo" sql_package: "pgx/v5" emit_empty_slices: true emit_pointers_for_null_types: true @@ -24,38 +24,38 @@ sql: gen: go: <<: *repo-go - package: "task_repo" - out: "repos/task_repo" + package: "taskrepo" + out: "repos/task-repo" - <<: *repo queries: "./repos/patient_repo.sql" gen: go: <<: *repo-go - package: "patient_repo" - out: "repos/patient_repo" + package: "patientrepo" + out: "repos/patient-repo" - <<: *repo queries: "./repos/room_repo.sql" gen: go: <<: *repo-go - package: "room_repo" - out: "repos/room_repo" + package: "roomrepo" + out: "repos/room-repo" - <<: *repo queries: "./repos/ward_repo.sql" gen: go: <<: *repo-go - package: "ward_repo" - out: "repos/ward_repo" + package: "wardrepo" + out: "repos/ward-repo" - <<: *repo queries: "./repos/task_template_repo.sql" gen: go: <<: *repo-go - package: "task_template_repo" - out: "repos/task_template_repo" + package: "tasktemplaterepo" + out: "repos/task-template-repo" diff --git a/services/user-svc/internal/organization/organization.go b/services/user-svc/internal/organization/organization.go index da0bcd905..916c7a834 100644 --- a/services/user-svc/internal/organization/organization.go +++ b/services/user-svc/internal/organization/organization.go @@ -18,8 +18,8 @@ import ( "user-svc/internal/hwkc" "user-svc/locale" - "user-svc/repos/organization_repo" - "user-svc/repos/user_repo" + "user-svc/repos/organization-repo" + "user-svc/repos/user-repo" "github.com/google/uuid" zlog "github.com/rs/zerolog/log" @@ -56,7 +56,7 @@ func (s ServiceServer) CreateOrganization( organization, err := CreateOrganizationAndAddUser( ctx, - organization_repo.Organization{ + organizationrepo.Organization{ LongName: req.LongName, ShortName: req.ShortName, ContactEmail: req.ContactEmail, @@ -79,7 +79,7 @@ func (s ServiceServer) GetOrganization( ctx context.Context, req *pb.GetOrganizationRequest, ) (*pb.GetOrganizationResponse, error) { - organizationRepo := organization_repo.New(hwdb.GetDB()) + organizationRepo := organizationrepo.New(hwdb.GetDB()) id, err := uuid.Parse(req.GetId()) if err != nil { @@ -104,7 +104,7 @@ func (s ServiceServer) GetOrganization( organization := rows[0].Organization members := hwutil.FlatMap(rows, - func(row organization_repo.GetOrganizationWithMemberByIdRow) **pb.GetOrganizationMember { + func(row organizationrepo.GetOrganizationWithMemberByIdRow) **pb.GetOrganizationMember { if !row.UserID.Valid { return nil } @@ -147,7 +147,7 @@ func (s ServiceServer) GetOrganizationsByUser( AvatarUrl: obj.Organization.AvatarUrl, IsPersonal: obj.Organization.IsPersonal, Members: hwutil.Map(obj.Members, - func(membership organization_repo.User) *pb.GetOrganizationsByUserResponse_Organization_Member { + func(membership organizationrepo.User) *pb.GetOrganizationsByUserResponse_Organization_Member { return &pb.GetOrganizationsByUserResponse_Organization_Member{ UserId: membership.ID.String(), AvatarUrl: membership.AvatarUrl, // can be nil, if inserted intentionally @@ -164,14 +164,14 @@ func (s ServiceServer) GetOrganizationsByUser( } type OrganizationWithMembers struct { - Organization organization_repo.Organization - Members []organization_repo.User + Organization organizationrepo.Organization + Members []organizationrepo.User } func GetOrganizationsByUserID( ctx context.Context, userID uuid.UUID, authz hwauthz.AuthZ, ) ([]OrganizationWithMembers, error) { - organizationRepo := organization_repo.New(hwdb.GetDB()) + organizationRepo := organizationrepo.New(hwdb.GetDB()) rows, err := organizationRepo.GetOrganizationsWithMembersByUser(ctx, userID) err = hwdb.Error(ctx, err) @@ -184,18 +184,18 @@ func GetOrganizationsByUserID( processedOrganizations := make(map[uuid.UUID]bool) organizationsResponse := hwutil.FlatMap(rows, - func(organizationRow organization_repo.GetOrganizationsWithMembersByUserRow) *OrganizationWithMembers { + func(organizationRow organizationrepo.GetOrganizationsWithMembersByUserRow) *OrganizationWithMembers { organization := organizationRow.Organization if _, processed := processedOrganizations[organization.ID]; processed { return nil } processedOrganizations[organization.ID] = true members := hwutil.FlatMap(rows, - func(memberRow organization_repo.GetOrganizationsWithMembersByUserRow) *organization_repo.User { + func(memberRow organizationrepo.GetOrganizationsWithMembersByUserRow) *organizationrepo.User { if memberRow.Organization.ID != organization.ID { return nil } - val := &organization_repo.User{ + val := &organizationrepo.User{ ID: memberRow.ID, Email: memberRow.Email, Nickname: memberRow.Nickname, @@ -253,7 +253,7 @@ func (s ServiceServer) GetOrganizationsForUser( AvatarUrl: obj.Organization.AvatarUrl, IsPersonal: false, Members: hwutil.Map(obj.Members, - func(membership organization_repo.User) *pb.GetOrganizationsForUserResponse_Organization_Member { + func(membership organizationrepo.User) *pb.GetOrganizationsForUserResponse_Organization_Member { return &pb.GetOrganizationsForUserResponse_Organization_Member{ UserId: membership.ID.String(), AvatarUrl: membership.AvatarUrl, // can be nil, if inserted intentionally @@ -280,14 +280,14 @@ func (s ServiceServer) UpdateOrganization( return nil, err } - organizationRepo := organization_repo.New(hwdb.GetDB()) + organizationRepo := organizationrepo.New(hwdb.GetDB()) organizationID, err := uuid.Parse(req.GetId()) if err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } - err = organizationRepo.UpdateOrganization(ctx, organization_repo.UpdateOrganizationParams{ + err = organizationRepo.UpdateOrganization(ctx, organizationrepo.UpdateOrganizationParams{ ID: organizationID, ContactEmail: req.ContactEmail, LongName: req.LongName, @@ -314,7 +314,7 @@ func (s ServiceServer) DeleteOrganization( return nil, err } - organizationRepo := organization_repo.New(hwdb.GetDB()) + organizationRepo := organizationrepo.New(hwdb.GetDB()) organizationID, err := uuid.Parse(req.GetId()) if err != nil { @@ -353,7 +353,7 @@ func (s ServiceServer) RemoveMember( } log := zlog.Ctx(ctx) - organizationRepo := organization_repo.New(hwdb.GetDB()) + organizationRepo := organizationrepo.New(hwdb.GetDB()) userID, err := uuid.Parse(req.UserId) if err != nil { @@ -369,7 +369,7 @@ func (s ServiceServer) RemoveMember( return nil, err } - err = organizationRepo.RemoveMember(ctx, organization_repo.RemoveMemberParams{ + err = organizationRepo.RemoveMember(ctx, organizationrepo.RemoveMemberParams{ OrganizationID: organizationID, UserID: userID, }) @@ -400,7 +400,7 @@ func (s ServiceServer) InviteMember( req *pb.InviteMemberRequest, ) (*pb.InviteMemberResponse, error) { log := zlog.Ctx(ctx) - organizationRepo := organization_repo.New(hwdb.GetDB()) + organizationRepo := organizationrepo.New(hwdb.GetDB()) // check permissions permUser := commonperm.UserFromCtx(ctx) @@ -416,7 +416,7 @@ func (s ServiceServer) InviteMember( } // sanity checks - conditions, err := organizationRepo.GetInvitationConditions(ctx, organization_repo.GetInvitationConditionsParams{ + conditions, err := organizationRepo.GetInvitationConditions(ctx, organizationrepo.GetInvitationConditionsParams{ OrganizationID: organizationID, Email: req.Email, States: []int32{ @@ -440,7 +440,7 @@ func (s ServiceServer) InviteMember( } // do invite - invitation, err := organizationRepo.InviteMember(ctx, organization_repo.InviteMemberParams{ + invitation, err := organizationRepo.InviteMember(ctx, organizationrepo.InviteMemberParams{ Email: req.Email, OrganizationID: organizationID, State: int32(pb.InvitationState_INVITATION_STATE_PENDING.Number()), @@ -480,7 +480,7 @@ func (s ServiceServer) GetInvitationsByOrganization( ctx context.Context, req *pb.GetInvitationsByOrganizationRequest, ) (*pb.GetInvitationsByOrganizationResponse, error) { - organizationRepo := organization_repo.New(hwdb.GetDB()) + organizationRepo := organizationrepo.New(hwdb.GetDB()) organizationID, err := uuid.Parse(req.OrganizationId) if err != nil { @@ -501,7 +501,7 @@ func (s ServiceServer) GetInvitationsByOrganization( return &pb.GetInvitationsByOrganizationResponse{}, nil } - invitations, err := organizationRepo.GetInvitations(ctx, organization_repo.GetInvitationsParams{ + invitations, err := organizationRepo.GetInvitations(ctx, organizationrepo.GetInvitationsParams{ OrganizationID: uuid.NullUUID{UUID: organizationID, Valid: true}, State: (*int32)(req.State), }) @@ -525,13 +525,13 @@ func (s ServiceServer) GetInvitationsByOrganization( if err != nil { return nil, err } - invitations = hwutil.Filter(invitations, func(i int, _ organization_repo.Invitation) bool { + invitations = hwutil.Filter(invitations, func(i int, _ organizationrepo.Invitation) bool { return allowed[2*i] || allowed[2*i+1] // either the user or their email is allowed to view this invite }) // convert to response invitationsResponse := hwutil.Map(invitations, - func(invitation organization_repo.Invitation) *pb.GetInvitationsByOrganizationResponse_Invitation { + func(invitation organizationrepo.Invitation) *pb.GetInvitationsByOrganizationResponse_Invitation { return &pb.GetInvitationsByOrganizationResponse_Invitation{ Id: invitation.ID.String(), Email: invitation.Email, @@ -549,7 +549,7 @@ func (s ServiceServer) GetInvitationsByUser( ctx context.Context, req *pb.GetInvitationsByUserRequest, ) (*pb.GetInvitationsByUserResponse, error) { - organizationRepo := organization_repo.New(hwdb.GetDB()) + organizationRepo := organizationrepo.New(hwdb.GetDB()) claims, err := auth.GetAuthClaims(ctx) if err != nil { @@ -558,7 +558,7 @@ func (s ServiceServer) GetInvitationsByUser( invitations, err := organizationRepo.GetInvitationsWithOrganizationByUser( ctx, - organization_repo.GetInvitationsWithOrganizationByUserParams{ + organizationrepo.GetInvitationsWithOrganizationByUserParams{ Email: claims.Email, State: (*int32)(req.State), }) @@ -567,7 +567,7 @@ func (s ServiceServer) GetInvitationsByUser( return nil, err } - type rowType = organization_repo.GetInvitationsWithOrganizationByUserRow + type rowType = organizationrepo.GetInvitationsWithOrganizationByUserRow // filter out invitations where permissions are missing user := commonperm.UserFromCtx(ctx) @@ -613,7 +613,7 @@ func (s ServiceServer) GetMembersByOrganization( ctx context.Context, req *pb.GetMembersByOrganizationRequest, ) (*pb.GetMembersByOrganizationResponse, error) { - organizationRepo := organization_repo.New(hwdb.GetDB()) + organizationRepo := organizationrepo.New(hwdb.GetDB()) organizationID, err := uuid.Parse(req.GetId()) if err != nil { @@ -635,7 +635,7 @@ func (s ServiceServer) GetMembersByOrganization( } mappedMembers := hwutil.Map(members, - func(member organization_repo.User) *pb.GetMembersByOrganizationResponse_Member { + func(member organizationrepo.User) *pb.GetMembersByOrganizationResponse_Member { return &pb.GetMembersByOrganizationResponse_Member{ UserId: member.ID.String(), AvatarUrl: member.AvatarUrl, // can be nil, if inserted intentionally @@ -653,7 +653,7 @@ func (s ServiceServer) AcceptInvitation( ctx context.Context, req *pb.AcceptInvitationRequest, ) (*pb.AcceptInvitationResponse, error) { - organizationRepo := organization_repo.New(hwdb.GetDB()) + organizationRepo := organizationrepo.New(hwdb.GetDB()) invitationID, err := uuid.Parse(req.InvitationId) if err != nil { @@ -683,7 +683,7 @@ func (s ServiceServer) AcceptInvitation( } // Check if invite exists - rows, err := organizationRepo.GetInvitations(ctx, organization_repo.GetInvitationsParams{ + rows, err := organizationRepo.GetInvitations(ctx, organizationrepo.GetInvitationsParams{ ID: uuid.NullUUID{UUID: invitationID, Valid: true}, Email: &claims.Email, }) @@ -702,7 +702,7 @@ func (s ServiceServer) AcceptInvitation( } // Update Invitation State - err = organizationRepo.UpdateInvitationState(ctx, organization_repo.UpdateInvitationStateParams{ + err = organizationRepo.UpdateInvitationState(ctx, organizationrepo.UpdateInvitationStateParams{ ID: invitationID, State: int32(pb.InvitationState_INVITATION_STATE_ACCEPTED.Number()), }) @@ -732,7 +732,7 @@ func (s ServiceServer) DeclineInvitation( ctx context.Context, req *pb.DeclineInvitationRequest, ) (*pb.DeclineInvitationResponse, error) { - organizationRepo := organization_repo.New(hwdb.GetDB()) + organizationRepo := organizationrepo.New(hwdb.GetDB()) invitationID, err := uuid.Parse(req.InvitationId) if err != nil { @@ -762,7 +762,7 @@ func (s ServiceServer) DeclineInvitation( } // Check if invite exists - rows, err := organizationRepo.GetInvitations(ctx, organization_repo.GetInvitationsParams{ + rows, err := organizationRepo.GetInvitations(ctx, organizationrepo.GetInvitationsParams{ ID: uuid.NullUUID{UUID: invitationID, Valid: true}, Email: &claims.Email, }) @@ -781,7 +781,7 @@ func (s ServiceServer) DeclineInvitation( } // Update invitation state - err = organizationRepo.UpdateInvitationState(ctx, organization_repo.UpdateInvitationStateParams{ + err = organizationRepo.UpdateInvitationState(ctx, organizationrepo.UpdateInvitationStateParams{ ID: invitationID, State: int32(pb.InvitationState_INVITATION_STATE_REJECTED.Number()), }) @@ -797,7 +797,7 @@ func (s ServiceServer) RevokeInvitation( ctx context.Context, req *pb.RevokeInvitationRequest, ) (*pb.RevokeInvitationResponse, error) { - organizationRepo := organization_repo.New(hwdb.GetDB()) + organizationRepo := organizationrepo.New(hwdb.GetDB()) log := zlog.Ctx(ctx) @@ -815,7 +815,7 @@ func (s ServiceServer) RevokeInvitation( return nil, err } - rows, err := organizationRepo.GetInvitations(ctx, organization_repo.GetInvitationsParams{ + rows, err := organizationRepo.GetInvitations(ctx, organizationrepo.GetInvitationsParams{ ID: uuid.NullUUID{UUID: invitationID, Valid: true}, }) err = hwdb.Error(ctx, err) @@ -834,7 +834,7 @@ func (s ServiceServer) RevokeInvitation( } // Update invitation state - err = organizationRepo.UpdateInvitationState(ctx, organization_repo.UpdateInvitationStateParams{ + err = organizationRepo.UpdateInvitationState(ctx, organizationrepo.UpdateInvitationStateParams{ ID: invitationID, State: int32(pb.InvitationState_INVITATION_STATE_REVOKED.Number()), }) @@ -854,18 +854,18 @@ func (s ServiceServer) RevokeInvitation( func CreateOrganizationAndAddUser( ctx context.Context, - attr organization_repo.Organization, + attr organizationrepo.Organization, userID uuid.UUID, kc hwkc.IClient, authz hwauthz.AuthZ, -) (*organization_repo.Organization, error) { +) (*organizationrepo.Organization, error) { // open tx tx, rollback, err := hwdb.BeginTx(hwdb.GetDB(), ctx) if err != nil { return nil, err } defer rollback() - organizationRepo := organization_repo.New(tx) + organizationRepo := organizationrepo.New(tx) // create keycloak org keycloakOrganization, err := kc.CreateOrganization(ctx, attr.LongName, attr.ShortName, attr.IsPersonal) @@ -879,7 +879,7 @@ func CreateOrganizationAndAddUser( } // create db org - organization, err := organizationRepo.CreateOrganization(ctx, organization_repo.CreateOrganizationParams{ + organization, err := organizationRepo.CreateOrganization(ctx, organizationrepo.CreateOrganizationParams{ ID: organizationID, LongName: attr.LongName, ShortName: attr.ShortName, @@ -922,7 +922,7 @@ func AddUserToOrganization( organizationID uuid.UUID, ) error { log := zlog.Ctx(ctx) - organizationRepo := organization_repo.New(tx) + organizationRepo := organizationrepo.New(tx) // add user to org in kc if err := kc.AddUserToOrganization(ctx, userID, organizationID); err != nil { @@ -930,7 +930,7 @@ func AddUserToOrganization( } // add user to org in db - err := organizationRepo.AddUserToOrganization(ctx, organization_repo.AddUserToOrganizationParams{ + err := organizationRepo.AddUserToOrganization(ctx, organizationrepo.AddUserToOrganizationParams{ UserID: userID, OrganizationID: organizationID, }) @@ -998,7 +998,7 @@ func (s ServiceServer) CreatePersonalOrganization( personalOrganizationLocale := hwlocale.Localize(ctx, locale.PersonalOrganizationName(ctx)) organizationName := fmt.Sprintf("%s %s", personalOrganizationLocale, userClaims.Name) - userRepo := user_repo.New(hwdb.GetDB()) + userRepo := userrepo.New(hwdb.GetDB()) // create user, if it does not exist yet userResult, err := hwdb.Optional(userRepo.GetUserById)(ctx, userID) @@ -1012,7 +1012,7 @@ func (s ServiceServer) CreatePersonalOrganization( hex.EncodeToString(hash[:]), ) - _, err = userRepo.CreateUser(ctx, user_repo.CreateUserParams{ + _, err = userRepo.CreateUser(ctx, userrepo.CreateUserParams{ ID: userID, Email: userClaims.Email, Nickname: userClaims.PreferredUsername, @@ -1026,7 +1026,7 @@ func (s ServiceServer) CreatePersonalOrganization( organization, err := CreateOrganizationAndAddUser( ctx, - organization_repo.Organization{ + organizationrepo.Organization{ LongName: organizationName, ShortName: hwlocale.Localize(ctx, locale.PersonalOrganizationShortName(ctx)), ContactEmail: userClaims.Email, diff --git a/services/user-svc/internal/user/user.go b/services/user-svc/internal/user/user.go index bc6098b67..e53d2dcc8 100644 --- a/services/user-svc/internal/user/user.go +++ b/services/user-svc/internal/user/user.go @@ -10,7 +10,7 @@ import ( "user-svc/internal/user/perm" - "user-svc/repos/user_repo" + "user-svc/repos/user-repo" daprcmn "github.com/dapr/go-sdk/service/common" "github.com/google/uuid" @@ -41,7 +41,7 @@ func (s ServiceServer) ReadPublicProfile( ctx context.Context, req *pb.ReadPublicProfileRequest, ) (*pb.ReadPublicProfileResponse, error) { - userRepo := user_repo.New(hwdb.GetDB()) + userRepo := userrepo.New(hwdb.GetDB()) userID, err := uuid.Parse(req.GetId()) if err != nil { @@ -74,7 +74,7 @@ func (s ServiceServer) ReadPublicProfile( func HandleUserUpdatedEvent(ctx context.Context, evt *daprcmn.TopicEvent) (retry bool, err error) { log := zlog.Ctx(ctx) - userRepo := user_repo.New(hwdb.GetDB()) + userRepo := userrepo.New(hwdb.GetDB()) var payload events.UserUpdatedEvent if err := proto.Unmarshal(evt.RawData, &payload); err != nil { @@ -88,7 +88,7 @@ func HandleUserUpdatedEvent(ctx context.Context, evt *daprcmn.TopicEvent) (retry return true, err } - err = userRepo.UpdateUser(ctx, user_repo.UpdateUserParams{ + err = userRepo.UpdateUser(ctx, userrepo.UpdateUserParams{ ID: userID, Email: payload.Email, Name: payload.Name, diff --git a/services/user-svc/repos/organization-repo/db.go b/services/user-svc/repos/organization-repo/db.go new file mode 100644 index 000000000..ec4aeebdb --- /dev/null +++ b/services/user-svc/repos/organization-repo/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.27.0 + +package organizationrepo + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/services/user-svc/repos/organization_repo/models.go b/services/user-svc/repos/organization-repo/models.go similarity index 96% rename from services/user-svc/repos/organization_repo/models.go rename to services/user-svc/repos/organization-repo/models.go index 243f4284b..ed157d2c9 100644 --- a/services/user-svc/repos/organization_repo/models.go +++ b/services/user-svc/repos/organization-repo/models.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package organization_repo +package organizationrepo import ( "github.com/google/uuid" diff --git a/services/user-svc/repos/organization_repo/organization_repo.sql.go b/services/user-svc/repos/organization-repo/organization_repo.sql.go similarity index 99% rename from services/user-svc/repos/organization_repo/organization_repo.sql.go rename to services/user-svc/repos/organization-repo/organization_repo.sql.go index 1a3a2f142..ad68d3f9e 100644 --- a/services/user-svc/repos/organization_repo/organization_repo.sql.go +++ b/services/user-svc/repos/organization-repo/organization_repo.sql.go @@ -3,7 +3,7 @@ // sqlc v1.27.0 // source: organization_repo.sql -package organization_repo +package organizationrepo import ( "context" diff --git a/services/user-svc/repos/organization_repo/db.go b/services/user-svc/repos/organization_repo/db.go deleted file mode 100644 index 3ee92678e..000000000 --- a/services/user-svc/repos/organization_repo/db.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.27.0 - -package organization_repo - -import ( - "context" - - "github.com/jackc/pgx/v5" - "github.com/jackc/pgx/v5/pgconn" -) - -type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row -} - -func New(db DBTX) *Queries { - return &Queries{db: db} -} - -type Queries struct { - db DBTX -} - -func (q *Queries) WithTx(tx pgx.Tx) *Queries { - return &Queries{ - db: tx, - } -} diff --git a/services/user-svc/repos/user-repo/db.go b/services/user-svc/repos/user-repo/db.go new file mode 100644 index 000000000..dce7c729b --- /dev/null +++ b/services/user-svc/repos/user-repo/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.27.0 + +package userrepo + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/services/user-svc/repos/user_repo/models.go b/services/user-svc/repos/user-repo/models.go similarity index 97% rename from services/user-svc/repos/user_repo/models.go rename to services/user-svc/repos/user-repo/models.go index f71163fae..b3a8ffae0 100644 --- a/services/user-svc/repos/user_repo/models.go +++ b/services/user-svc/repos/user-repo/models.go @@ -2,7 +2,7 @@ // versions: // sqlc v1.27.0 -package user_repo +package userrepo import ( "github.com/google/uuid" diff --git a/services/user-svc/repos/user_repo/user_repo.sql.go b/services/user-svc/repos/user-repo/user_repo.sql.go similarity index 98% rename from services/user-svc/repos/user_repo/user_repo.sql.go rename to services/user-svc/repos/user-repo/user_repo.sql.go index 354d73249..6c69e2ce6 100644 --- a/services/user-svc/repos/user_repo/user_repo.sql.go +++ b/services/user-svc/repos/user-repo/user_repo.sql.go @@ -3,7 +3,7 @@ // sqlc v1.27.0 // source: user_repo.sql -package user_repo +package userrepo import ( "context" diff --git a/services/user-svc/repos/user_repo/db.go b/services/user-svc/repos/user_repo/db.go deleted file mode 100644 index c7621f5ac..000000000 --- a/services/user-svc/repos/user_repo/db.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.27.0 - -package user_repo - -import ( - "context" - - "github.com/jackc/pgx/v5" - "github.com/jackc/pgx/v5/pgconn" -) - -type DBTX interface { - Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) - Query(context.Context, string, ...interface{}) (pgx.Rows, error) - QueryRow(context.Context, string, ...interface{}) pgx.Row -} - -func New(db DBTX) *Queries { - return &Queries{db: db} -} - -type Queries struct { - db DBTX -} - -func (q *Queries) WithTx(tx pgx.Tx) *Queries { - return &Queries{ - db: tx, - } -} diff --git a/services/user-svc/sqlc.yaml b/services/user-svc/sqlc.yaml index 2fac0440c..b80b8cb97 100644 --- a/services/user-svc/sqlc.yaml +++ b/services/user-svc/sqlc.yaml @@ -5,8 +5,8 @@ sql: schema: "schema.sql" gen: go: - package: "user_repo" - out: "repos/user_repo" + package: "userrepo" + out: "repos/user-repo" sql_package: "pgx/v5" emit_pointers_for_null_types: true overrides: @@ -20,8 +20,8 @@ sql: schema: "schema.sql" gen: go: - package: "organization_repo" - out: "repos/organization_repo" + package: "organizationrepo" + out: "repos/organization-repo" sql_package: "pgx/v5" emit_empty_slices: true emit_pointers_for_null_types: true From e664aacbb5ae45dede66f8d449fc454d7488d290 Mon Sep 17 00:00:00 2001 From: Max Baumann Date: Sun, 29 Dec 2024 11:09:43 +0100 Subject: [PATCH 6/8] remove leakage of other PR --- services/tasks-svc/repos/bed-repo/models.go | 2 -- .../tasks-svc/repos/patient-repo/models.go | 2 -- .../repos/patient-repo/patient_repo.sql.go | 18 ++++-------------- services/tasks-svc/repos/room-repo/models.go | 2 -- services/tasks-svc/repos/task-repo/models.go | 2 -- .../tasks-svc/repos/task-repo/task_repo.sql.go | 8 ++------ .../repos/task-template-repo/models.go | 2 -- services/tasks-svc/repos/ward-repo/models.go | 2 -- services/tasks-svc/schema.sql | 4 +--- 9 files changed, 7 insertions(+), 35 deletions(-) diff --git a/services/tasks-svc/repos/bed-repo/models.go b/services/tasks-svc/repos/bed-repo/models.go index 5e912c78c..43695d99b 100644 --- a/services/tasks-svc/repos/bed-repo/models.go +++ b/services/tasks-svc/repos/bed-repo/models.go @@ -26,8 +26,6 @@ type Patient struct { IsDischarged bool Consistency int64 OrganizationID uuid.UUID - Gender int32 - DateOfBirth pgtype.Date } type Room struct { diff --git a/services/tasks-svc/repos/patient-repo/models.go b/services/tasks-svc/repos/patient-repo/models.go index d0ddf941d..e37ab182e 100644 --- a/services/tasks-svc/repos/patient-repo/models.go +++ b/services/tasks-svc/repos/patient-repo/models.go @@ -26,8 +26,6 @@ type Patient struct { IsDischarged bool Consistency int64 OrganizationID uuid.UUID - Gender int32 - DateOfBirth pgtype.Date } type Room struct { diff --git a/services/tasks-svc/repos/patient-repo/patient_repo.sql.go b/services/tasks-svc/repos/patient-repo/patient_repo.sql.go index 09c5e1694..fa1b8cff0 100644 --- a/services/tasks-svc/repos/patient-repo/patient_repo.sql.go +++ b/services/tasks-svc/repos/patient-repo/patient_repo.sql.go @@ -52,7 +52,7 @@ func (q *Queries) DeletePatient(ctx context.Context, id uuid.UUID) error { const getAllPatientsWithTasksBedAndRoom = `-- name: GetAllPatientsWithTasksBedAndRoom :many SELECT - patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, patients.gender, patients.date_of_birth, + patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, tasks.id as task_id, tasks.name as task_name, tasks.description as task_description, @@ -118,8 +118,6 @@ func (q *Queries) GetAllPatientsWithTasksBedAndRoom(ctx context.Context, organiz &i.Patient.IsDischarged, &i.Patient.Consistency, &i.Patient.OrganizationID, - &i.Patient.Gender, - &i.Patient.DateOfBirth, &i.TaskID, &i.TaskName, &i.TaskDescription, @@ -149,7 +147,7 @@ func (q *Queries) GetAllPatientsWithTasksBedAndRoom(ctx context.Context, organiz } const getPatientByBed = `-- name: GetPatientByBed :one -SELECT patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, patients.gender, patients.date_of_birth +SELECT patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id FROM patients WHERE bed_id = $1 LIMIT 1 @@ -168,15 +166,13 @@ func (q *Queries) GetPatientByBed(ctx context.Context, bedID uuid.NullUUID) (Pat &i.IsDischarged, &i.Consistency, &i.OrganizationID, - &i.Gender, - &i.DateOfBirth, ) return i, err } const getPatientWithBedAndRoom = `-- name: GetPatientWithBedAndRoom :one SELECT - patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, patients.gender, patients.date_of_birth, + patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, beds.name as bed_name, beds.consistency as bed_consistency, rooms.id as room_id, @@ -200,8 +196,6 @@ type GetPatientWithBedAndRoomRow struct { IsDischarged bool Consistency int64 OrganizationID uuid.UUID - Gender int32 - DateOfBirth pgtype.Date BedName *string BedConsistency *int64 RoomID uuid.NullUUID @@ -223,8 +217,6 @@ func (q *Queries) GetPatientWithBedAndRoom(ctx context.Context, patientID uuid.U &i.IsDischarged, &i.Consistency, &i.OrganizationID, - &i.Gender, - &i.DateOfBirth, &i.BedName, &i.BedConsistency, &i.RoomID, @@ -237,7 +229,7 @@ func (q *Queries) GetPatientWithBedAndRoom(ctx context.Context, patientID uuid.U const getPatientsByWard = `-- name: GetPatientsByWard :many SELECT - patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, patients.gender, patients.date_of_birth + patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id FROM patients JOIN beds ON patients.bed_id = beds.id JOIN rooms ON beds.room_id = rooms.id @@ -263,8 +255,6 @@ func (q *Queries) GetPatientsByWard(ctx context.Context, wardID uuid.UUID) ([]Pa &i.IsDischarged, &i.Consistency, &i.OrganizationID, - &i.Gender, - &i.DateOfBirth, ); err != nil { return nil, err } diff --git a/services/tasks-svc/repos/room-repo/models.go b/services/tasks-svc/repos/room-repo/models.go index 2ddf29fa8..e19d28db6 100644 --- a/services/tasks-svc/repos/room-repo/models.go +++ b/services/tasks-svc/repos/room-repo/models.go @@ -26,8 +26,6 @@ type Patient struct { IsDischarged bool Consistency int64 OrganizationID uuid.UUID - Gender int32 - DateOfBirth pgtype.Date } type Room struct { diff --git a/services/tasks-svc/repos/task-repo/models.go b/services/tasks-svc/repos/task-repo/models.go index e69076da4..81b36610c 100644 --- a/services/tasks-svc/repos/task-repo/models.go +++ b/services/tasks-svc/repos/task-repo/models.go @@ -26,8 +26,6 @@ type Patient struct { IsDischarged bool Consistency int64 OrganizationID uuid.UUID - Gender int32 - DateOfBirth pgtype.Date } type Room struct { diff --git a/services/tasks-svc/repos/task-repo/task_repo.sql.go b/services/tasks-svc/repos/task-repo/task_repo.sql.go index 18e90e22f..fc571cefb 100644 --- a/services/tasks-svc/repos/task-repo/task_repo.sql.go +++ b/services/tasks-svc/repos/task-repo/task_repo.sql.go @@ -108,7 +108,7 @@ func (q *Queries) DeleteTask(ctx context.Context, id uuid.UUID) error { const getTaskWithPatientById = `-- name: GetTaskWithPatientById :many SELECT tasks.id, tasks.name, tasks.description, tasks.status, tasks.assigned_user_id, tasks.patient_id, tasks.public, tasks.created_by, tasks.due_at, tasks.created_at, tasks.consistency, - patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, patients.gender, patients.date_of_birth, + patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, subtasks.id as subtask_id, subtasks.name as subtask_name, subtasks.done as subtask_done, @@ -158,8 +158,6 @@ func (q *Queries) GetTaskWithPatientById(ctx context.Context, id uuid.UUID) ([]G &i.Patient.IsDischarged, &i.Patient.Consistency, &i.Patient.OrganizationID, - &i.Patient.Gender, - &i.Patient.DateOfBirth, &i.SubtaskID, &i.SubtaskName, &i.SubtaskDone, @@ -178,7 +176,7 @@ func (q *Queries) GetTaskWithPatientById(ctx context.Context, id uuid.UUID) ([]G const getTasksWithPatientByAssignee = `-- name: GetTasksWithPatientByAssignee :many SELECT tasks.id, tasks.name, tasks.description, tasks.status, tasks.assigned_user_id, tasks.patient_id, tasks.public, tasks.created_by, tasks.due_at, tasks.created_at, tasks.consistency, - patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, patients.gender, patients.date_of_birth, + patients.id, patients.human_readable_identifier, patients.notes, patients.bed_id, patients.created_at, patients.updated_at, patients.is_discharged, patients.consistency, patients.organization_id, subtasks.id as subtask_id, subtasks.name as subtask_name, subtasks.done as subtask_done, @@ -228,8 +226,6 @@ func (q *Queries) GetTasksWithPatientByAssignee(ctx context.Context, assignedUse &i.Patient.IsDischarged, &i.Patient.Consistency, &i.Patient.OrganizationID, - &i.Patient.Gender, - &i.Patient.DateOfBirth, &i.SubtaskID, &i.SubtaskName, &i.SubtaskDone, diff --git a/services/tasks-svc/repos/task-template-repo/models.go b/services/tasks-svc/repos/task-template-repo/models.go index 58802ed10..e8255f515 100644 --- a/services/tasks-svc/repos/task-template-repo/models.go +++ b/services/tasks-svc/repos/task-template-repo/models.go @@ -26,8 +26,6 @@ type Patient struct { IsDischarged bool Consistency int64 OrganizationID uuid.UUID - Gender int32 - DateOfBirth pgtype.Date } type Room struct { diff --git a/services/tasks-svc/repos/ward-repo/models.go b/services/tasks-svc/repos/ward-repo/models.go index 5792d9f73..91b252380 100644 --- a/services/tasks-svc/repos/ward-repo/models.go +++ b/services/tasks-svc/repos/ward-repo/models.go @@ -26,8 +26,6 @@ type Patient struct { IsDischarged bool Consistency int64 OrganizationID uuid.UUID - Gender int32 - DateOfBirth pgtype.Date } type Room struct { diff --git a/services/tasks-svc/schema.sql b/services/tasks-svc/schema.sql index 60e969fa7..27e4b37e3 100644 --- a/services/tasks-svc/schema.sql +++ b/services/tasks-svc/schema.sql @@ -59,9 +59,7 @@ CREATE TABLE public.patients ( updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, is_discharged boolean DEFAULT false NOT NULL, consistency bigint DEFAULT 0 NOT NULL, - organization_id uuid NOT NULL, - gender integer DEFAULT 0 NOT NULL, - date_of_birth date + organization_id uuid NOT NULL ); From e09684278aef0255478d5b98fd0f0b9cbe2adbdd Mon Sep 17 00:00:00 2001 From: Max Baumann Date: Sun, 29 Dec 2024 11:11:06 +0100 Subject: [PATCH 7/8] run protos.sh --- .../lib/google/protobuf/descriptor.pb.dart | 8 +- .../google/protobuf/descriptor.pbenum.dart | 5 +- .../google/protobuf/descriptor.pbjson.dart | 22 +- gen/go/google/protobuf/descriptor.pb.go | 1486 +++++++++-------- gen/ts/google/protobuf/descriptor_pb.js | 84 +- 5 files changed, 846 insertions(+), 759 deletions(-) diff --git a/gen/dart/lib/google/protobuf/descriptor.pb.dart b/gen/dart/lib/google/protobuf/descriptor.pb.dart index be07a662a..d272d11cf 100644 --- a/gen/dart/lib/google/protobuf/descriptor.pb.dart +++ b/gen/dart/lib/google/protobuf/descriptor.pb.dart @@ -36,6 +36,7 @@ class FileDescriptorSet extends $pb.GeneratedMessage { static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'FileDescriptorSet', package: const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), createEmptyInstance: create) ..pc(1, _omitFieldNames ? '' : 'file', $pb.PbFieldType.PM, subBuilder: FileDescriptorProto.create) + ..hasExtensions = true ; @$core.Deprecated( @@ -2351,12 +2352,13 @@ class FieldOptions extends $pb.GeneratedMessage { static FieldOptions getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static FieldOptions? _defaultInstance; + /// NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. /// The ctype option instructs the C++ code generator to use a different /// representation of the field than it normally would. See the specific /// options below. This option is only implemented to support use of /// [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of - /// type "bytes" in the open source release -- sorry, we'll try to include - /// other types in a future version! + /// type "bytes" in the open source release. + /// TODO: make ctype actually deprecated. @$pb.TagNumber(1) FieldOptions_CType get ctype => $_getN(0); @$pb.TagNumber(1) @@ -3670,7 +3672,7 @@ class SourceCodeInfo extends $pb.GeneratedMessage { static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'SourceCodeInfo', package: const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), createEmptyInstance: create) ..pc(1, _omitFieldNames ? '' : 'location', $pb.PbFieldType.PM, subBuilder: SourceCodeInfo_Location.create) - ..hasRequiredFields = false + ..hasExtensions = true ; @$core.Deprecated( diff --git a/gen/dart/lib/google/protobuf/descriptor.pbenum.dart b/gen/dart/lib/google/protobuf/descriptor.pbenum.dart index 779fc7d30..6e511af7e 100644 --- a/gen/dart/lib/google/protobuf/descriptor.pbenum.dart +++ b/gen/dart/lib/google/protobuf/descriptor.pbenum.dart @@ -182,8 +182,6 @@ class FieldOptions_JSType extends $pb.ProtobufEnum { } /// If set to RETENTION_SOURCE, the option will be omitted from the binary. -/// Note: as of January 2023, support for this is in progress and does not yet -/// have an effect (b/264593489). class FieldOptions_OptionRetention extends $pb.ProtobufEnum { static const FieldOptions_OptionRetention RETENTION_UNKNOWN = FieldOptions_OptionRetention._(0, _omitEnumNames ? '' : 'RETENTION_UNKNOWN'); static const FieldOptions_OptionRetention RETENTION_RUNTIME = FieldOptions_OptionRetention._(1, _omitEnumNames ? '' : 'RETENTION_RUNTIME'); @@ -203,8 +201,7 @@ class FieldOptions_OptionRetention extends $pb.ProtobufEnum { /// This indicates the types of entities that the field may apply to when used /// as an option. If it is unset, then the field may be freely used as an -/// option on any kind of entity. Note: as of January 2023, support for this is -/// in progress and does not yet have an effect (b/264593489). +/// option on any kind of entity. class FieldOptions_OptionTargetType extends $pb.ProtobufEnum { static const FieldOptions_OptionTargetType TARGET_TYPE_UNKNOWN = FieldOptions_OptionTargetType._(0, _omitEnumNames ? '' : 'TARGET_TYPE_UNKNOWN'); static const FieldOptions_OptionTargetType TARGET_TYPE_FILE = FieldOptions_OptionTargetType._(1, _omitEnumNames ? '' : 'TARGET_TYPE_FILE'); diff --git a/gen/dart/lib/google/protobuf/descriptor.pbjson.dart b/gen/dart/lib/google/protobuf/descriptor.pbjson.dart index c1f633ed4..ddef1b91d 100644 --- a/gen/dart/lib/google/protobuf/descriptor.pbjson.dart +++ b/gen/dart/lib/google/protobuf/descriptor.pbjson.dart @@ -47,12 +47,15 @@ const FileDescriptorSet$json = { '2': [ {'1': 'file', '3': 1, '4': 3, '5': 11, '6': '.google.protobuf.FileDescriptorProto', '10': 'file'}, ], + '5': [ + {'1': 536000000, '2': 536000001}, + ], }; /// Descriptor for `FileDescriptorSet`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List fileDescriptorSetDescriptor = $convert.base64Decode( 'ChFGaWxlRGVzY3JpcHRvclNldBI4CgRmaWxlGAEgAygLMiQuZ29vZ2xlLnByb3RvYnVmLkZpbG' - 'VEZXNjcmlwdG9yUHJvdG9SBGZpbGU='); + 'VEZXNjcmlwdG9yUHJvdG9SBGZpbGUqDAiA7Mr/ARCB7Mr/AQ=='); @$core.Deprecated('Use fileDescriptorProtoDescriptor instead') const FileDescriptorProto$json = { @@ -884,20 +887,20 @@ const FeatureSet_JsonFormat$json = { /// Descriptor for `FeatureSet`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List featureSetDescriptor = $convert.base64Decode( 'CgpGZWF0dXJlU2V0EpEBCg5maWVsZF9wcmVzZW5jZRgBIAEoDjIpLmdvb2dsZS5wcm90b2J1Zi' - '5GZWF0dXJlU2V0LkZpZWxkUHJlc2VuY2VCP4gBAZgBBJgBAaIBDRIIRVhQTElDSVQY5geiAQ0S' + '5GZWF0dXJlU2V0LkZpZWxkUHJlc2VuY2VCP4gBAZgBBJgBAaIBDRIIRVhQTElDSVQYhAeiAQ0S' 'CElNUExJQ0lUGOcHogENEghFWFBMSUNJVBjoB7IBAwjoB1INZmllbGRQcmVzZW5jZRJsCgllbn' 'VtX3R5cGUYAiABKA4yJC5nb29nbGUucHJvdG9idWYuRmVhdHVyZVNldC5FbnVtVHlwZUIpiAEB' - 'mAEGmAEBogELEgZDTE9TRUQY5geiAQkSBE9QRU4Y5weyAQMI6AdSCGVudW1UeXBlEpgBChdyZX' + 'mAEGmAEBogELEgZDTE9TRUQYhAeiAQkSBE9QRU4Y5weyAQMI6AdSCGVudW1UeXBlEpgBChdyZX' 'BlYXRlZF9maWVsZF9lbmNvZGluZxgDIAEoDjIxLmdvb2dsZS5wcm90b2J1Zi5GZWF0dXJlU2V0' - 'LlJlcGVhdGVkRmllbGRFbmNvZGluZ0ItiAEBmAEEmAEBogENEghFWFBBTkRFRBjmB6IBCxIGUE' + 'LlJlcGVhdGVkRmllbGRFbmNvZGluZ0ItiAEBmAEEmAEBogENEghFWFBBTkRFRBiEB6IBCxIGUE' 'FDS0VEGOcHsgEDCOgHUhVyZXBlYXRlZEZpZWxkRW5jb2RpbmcSfgoPdXRmOF92YWxpZGF0aW9u' 'GAQgASgOMiouZ29vZ2xlLnByb3RvYnVmLkZlYXR1cmVTZXQuVXRmOFZhbGlkYXRpb25CKYgBAZ' - 'gBBJgBAaIBCRIETk9ORRjmB6IBCxIGVkVSSUZZGOcHsgEDCOgHUg51dGY4VmFsaWRhdGlvbhJ+' + 'gBBJgBAaIBCRIETk9ORRiEB6IBCxIGVkVSSUZZGOcHsgEDCOgHUg51dGY4VmFsaWRhdGlvbhJ+' 'ChBtZXNzYWdlX2VuY29kaW5nGAUgASgOMisuZ29vZ2xlLnByb3RvYnVmLkZlYXR1cmVTZXQuTW' - 'Vzc2FnZUVuY29kaW5nQiaIAQGYAQSYAQGiARQSD0xFTkdUSF9QUkVGSVhFRBjmB7IBAwjoB1IP' + 'Vzc2FnZUVuY29kaW5nQiaIAQGYAQSYAQGiARQSD0xFTkdUSF9QUkVGSVhFRBiEB7IBAwjoB1IP' 'bWVzc2FnZUVuY29kaW5nEoIBCgtqc29uX2Zvcm1hdBgGIAEoDjImLmdvb2dsZS5wcm90b2J1Zi' '5GZWF0dXJlU2V0Lkpzb25Gb3JtYXRCOYgBAZgBA5gBBpgBAaIBFxISTEVHQUNZX0JFU1RfRUZG' - 'T1JUGOYHogEKEgVBTExPVxjnB7IBAwjoB1IKanNvbkZvcm1hdCJcCg1GaWVsZFByZXNlbmNlEh' + 'T1JUGIQHogEKEgVBTExPVxjnB7IBAwjoB1IKanNvbkZvcm1hdCJcCg1GaWVsZFByZXNlbmNlEh' 'oKFkZJRUxEX1BSRVNFTkNFX1VOS05PV04QABIMCghFWFBMSUNJVBABEgwKCElNUExJQ0lUEAIS' 'EwoPTEVHQUNZX1JFUVVJUkVEEAMiNwoIRW51bVR5cGUSFQoRRU5VTV9UWVBFX1VOS05PV04QAB' 'IICgRPUEVOEAESCgoGQ0xPU0VEEAIiVgoVUmVwZWF0ZWRGaWVsZEVuY29kaW5nEiMKH1JFUEVB' @@ -953,6 +956,9 @@ const SourceCodeInfo$json = { {'1': 'location', '3': 1, '4': 3, '5': 11, '6': '.google.protobuf.SourceCodeInfo.Location', '10': 'location'}, ], '3': [SourceCodeInfo_Location$json], + '5': [ + {'1': 536000000, '2': 536000001}, + ], }; @$core.Deprecated('Use sourceCodeInfoDescriptor instead') @@ -988,7 +994,7 @@ final $typed_data.Uint8List sourceCodeInfoDescriptor = $convert.base64Decode( 'KAVCAhABUgRwYXRoEhYKBHNwYW4YAiADKAVCAhABUgRzcGFuEikKEGxlYWRpbmdfY29tbWVudH' 'MYAyABKAlSD2xlYWRpbmdDb21tZW50cxIrChF0cmFpbGluZ19jb21tZW50cxgEIAEoCVIQdHJh' 'aWxpbmdDb21tZW50cxI6ChlsZWFkaW5nX2RldGFjaGVkX2NvbW1lbnRzGAYgAygJUhdsZWFkaW' - '5nRGV0YWNoZWRDb21tZW50cw=='); + '5nRGV0YWNoZWRDb21tZW50cyoMCIDsyv8BEIHsyv8B'); @$core.Deprecated('Use generatedCodeInfoDescriptor instead') const GeneratedCodeInfo$json = { diff --git a/gen/go/google/protobuf/descriptor.pb.go b/gen/go/google/protobuf/descriptor.pb.go index a00e42bb6..85d47cd8a 100644 --- a/gen/go/google/protobuf/descriptor.pb.go +++ b/gen/go/google/protobuf/descriptor.pb.go @@ -79,7 +79,7 @@ const ( Edition_EDITION_2023 Edition = 1000 Edition_EDITION_2024 Edition = 1001 // Placeholder editions for testing feature resolution. These should not be - // used or relyed on outside of tests. + // used or relied on outside of tests. Edition_EDITION_1_TEST_ONLY Edition = 1 Edition_EDITION_2_TEST_ONLY Edition = 2 Edition_EDITION_99997_TEST_ONLY Edition = 99997 @@ -587,8 +587,6 @@ func (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) { } // If set to RETENTION_SOURCE, the option will be omitted from the binary. -// Note: as of January 2023, support for this is in progress and does not yet -// have an effect (b/264593489). type FieldOptions_OptionRetention int32 const ( @@ -650,8 +648,7 @@ func (FieldOptions_OptionRetention) EnumDescriptor() ([]byte, []int) { // This indicates the types of entities that the field may apply to when used // as an option. If it is unset, then the field may be freely used as an -// option on any kind of entity. Note: as of January 2023, support for this is -// in progress and does not yet have an effect (b/264593489). +// option on any kind of entity. type FieldOptions_OptionTargetType int32 const ( @@ -1218,9 +1215,10 @@ func (GeneratedCodeInfo_Annotation_Semantic) EnumDescriptor() ([]byte, []int) { // The protocol compiler can output a FileDescriptorSet containing the .proto // files it parses. type FileDescriptorSet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + extensionFields protoimpl.ExtensionFields File []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"` } @@ -2630,12 +2628,13 @@ type FieldOptions struct { unknownFields protoimpl.UnknownFields extensionFields protoimpl.ExtensionFields + // NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. // The ctype option instructs the C++ code generator to use a different // representation of the field than it normally would. See the specific // options below. This option is only implemented to support use of // [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of - // type "bytes" in the open source release -- sorry, we'll try to include - // other types in a future version! + // type "bytes" in the open source release. + // TODO: make ctype actually deprecated. Ctype *FieldOptions_CType `protobuf:"varint,1,opt,name=ctype,enum=google.protobuf.FieldOptions_CType,def=0" json:"ctype,omitempty"` // The packed option can be enabled for repeated primitive fields to enable // a more efficient representation on the wire. Rather than repeatedly @@ -3531,9 +3530,10 @@ func (x *FeatureSetDefaults) GetMaximumEdition() Edition { // Encapsulates information about the original source file from which a // FileDescriptorProto was generated. type SourceCodeInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + extensionFields protoimpl.ExtensionFields // A Location identifies a piece of source code in a .proto file which // corresponds to a particular definition. This information is intended @@ -4473,494 +4473,474 @@ var file_google_protobuf_descriptor_proto_rawDesc = []byte{ 0x0a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x22, 0x4d, 0x0a, 0x11, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, + 0x62, 0x75, 0x66, 0x22, 0x5b, 0x0a, 0x11, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x04, 0x66, 0x69, - 0x6c, 0x65, 0x22, 0x98, 0x05, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, - 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x65, - 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, - 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x2b, 0x0a, 0x11, 0x70, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x5f, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x0a, 0x20, - 0x03, 0x28, 0x05, 0x52, 0x10, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x44, 0x65, 0x70, 0x65, 0x6e, - 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x77, 0x65, 0x61, 0x6b, 0x5f, 0x64, 0x65, - 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0e, - 0x77, 0x65, 0x61, 0x6b, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x43, - 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, - 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x08, 0x65, 0x6e, - 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x09, 0x65, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x36, - 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x49, 0x0a, 0x10, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, - 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x12, 0x32, 0x0a, 0x07, 0x65, 0x64, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xb9, 0x06, - 0x0a, 0x0f, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x66, 0x69, 0x65, - 0x6c, 0x64, 0x12, 0x43, 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x0b, 0x6e, 0x65, 0x73, 0x74, 0x65, - 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0a, - 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, - 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x6c, 0x65, 0x2a, 0x0c, 0x08, 0x80, 0xec, 0xca, 0xff, 0x01, 0x10, 0x81, 0xec, 0xca, 0xff, 0x01, + 0x22, 0x98, 0x05, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, + 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, + 0x65, 0x6e, 0x63, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x65, + 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x2b, 0x0a, 0x11, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x5f, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x0a, 0x20, 0x03, 0x28, + 0x05, 0x52, 0x10, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, + 0x6e, 0x63, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x77, 0x65, 0x61, 0x6b, 0x5f, 0x64, 0x65, 0x70, 0x65, + 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0e, 0x77, 0x65, + 0x61, 0x6b, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x43, 0x0a, 0x0c, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x08, 0x65, 0x6e, 0x75, 0x6d, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, + 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x07, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x07, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x52, 0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x58, 0x0a, - 0x0f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, - 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x44, 0x0a, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, - 0x5f, 0x64, 0x65, 0x63, 0x6c, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, - 0x65, 0x6f, 0x66, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x52, 0x09, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x63, 0x6c, 0x12, 0x39, 0x0a, - 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, + 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x49, 0x0a, 0x10, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x63, + 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, - 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x55, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x2e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x52, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, - 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x7a, 0x0a, 0x0e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, - 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x40, - 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x1a, 0x37, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0xcc, 0x04, 0x0a, 0x15, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, - 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, - 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x59, 0x0a, - 0x0b, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, - 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x6c, 0x61, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x03, 0x88, 0x01, 0x02, 0x52, 0x0b, 0x64, 0x65, 0x63, - 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x73, 0x18, 0x32, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x73, 0x12, 0x6d, 0x0a, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x38, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x3a, 0x0a, 0x55, 0x4e, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x45, 0x44, 0x42, 0x03, 0x88, - 0x01, 0x02, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x1a, 0x94, 0x01, 0x0a, 0x0b, 0x44, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x75, 0x6c, 0x6c, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x75, 0x6c, - 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, - 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, - 0x64, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x22, 0x34, 0x0a, 0x11, 0x56, 0x65, 0x72, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, - 0x44, 0x45, 0x43, 0x4c, 0x41, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x00, 0x12, 0x0e, 0x0a, - 0x0a, 0x55, 0x4e, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x01, 0x2a, 0x09, 0x08, - 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xc1, 0x06, 0x0a, 0x14, 0x46, 0x69, 0x65, + 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, + 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x12, 0x32, 0x0a, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xb9, 0x06, 0x0a, 0x0f, + 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x12, 0x43, 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x0b, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0a, 0x6e, 0x65, + 0x73, 0x74, 0x65, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, + 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x52, 0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x58, 0x0a, 0x0f, 0x65, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x05, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, + 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x44, 0x0a, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x64, + 0x65, 0x63, 0x6c, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, + 0x66, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x52, 0x09, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x63, 0x6c, 0x12, 0x39, 0x0a, 0x07, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x55, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0d, + 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, + 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4e, 0x61, + 0x6d, 0x65, 0x1a, 0x7a, 0x0a, 0x0e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, + 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x40, 0x0a, 0x07, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x37, + 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0xcc, 0x04, 0x0a, 0x15, 0x45, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, + 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, + 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x59, 0x0a, 0x0b, 0x64, + 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x32, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, + 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x03, 0x88, 0x01, 0x02, 0x52, 0x0b, 0x64, 0x65, 0x63, 0x6c, 0x61, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x73, 0x18, 0x32, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, + 0x6d, 0x0a, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x38, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x56, 0x65, + 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x3a, + 0x0a, 0x55, 0x4e, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x45, 0x44, 0x42, 0x03, 0x88, 0x01, 0x02, + 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x94, + 0x01, 0x0a, 0x0b, 0x44, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, + 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, + 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4a, + 0x04, 0x08, 0x04, 0x10, 0x05, 0x22, 0x34, 0x0a, 0x11, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x45, + 0x43, 0x4c, 0x41, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x55, + 0x4e, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x01, 0x2a, 0x09, 0x08, 0xe8, 0x07, + 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xc1, 0x06, 0x0a, 0x14, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x41, 0x0a, 0x05, 0x6c, + 0x61, 0x62, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x41, 0x0a, - 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x67, + 0x6f, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x3e, + 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, - 0x12, 0x3e, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, - 0x0a, 0x0b, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, - 0x1b, 0x0a, 0x09, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x6a, 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, + 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, + 0x0a, 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x65, + 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, + 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, + 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1b, 0x0a, + 0x09, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x6a, 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, + 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x22, 0xb6, 0x02, 0x0a, + 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x4f, + 0x55, 0x42, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, + 0x4c, 0x4f, 0x41, 0x54, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, + 0x4e, 0x54, 0x36, 0x34, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, + 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x05, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x08, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x09, 0x12, 0x0e, 0x0a, 0x0a, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x0a, 0x12, 0x10, 0x0a, 0x0c, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x0b, 0x12, 0x0e, 0x0a, + 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x53, 0x10, 0x0c, 0x12, 0x0f, 0x0a, + 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x0d, 0x12, 0x0d, + 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x0e, 0x12, 0x11, 0x0a, + 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x0f, + 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, + 0x34, 0x10, 0x10, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, + 0x33, 0x32, 0x10, 0x11, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, + 0x54, 0x36, 0x34, 0x10, 0x12, 0x22, 0x43, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x12, + 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, + 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x50, 0x45, + 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, + 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0x02, 0x22, 0x63, 0x0a, 0x14, 0x4f, 0x6e, + 0x65, 0x6f, 0x66, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, + 0xe3, 0x02, 0x0a, 0x13, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3f, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x36, 0x0a, 0x07, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x22, 0xb6, - 0x02, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, - 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x05, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x54, - 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x07, 0x12, 0x0d, 0x0a, - 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x08, 0x12, 0x0f, 0x0a, 0x0b, - 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x09, 0x12, 0x0e, 0x0a, - 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x0a, 0x12, 0x10, 0x0a, - 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x0b, 0x12, - 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x53, 0x10, 0x0c, 0x12, - 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x0d, - 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x0e, 0x12, - 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, - 0x10, 0x0f, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, - 0x44, 0x36, 0x34, 0x10, 0x10, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, - 0x4e, 0x54, 0x33, 0x32, 0x10, 0x11, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, - 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x12, 0x22, 0x43, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, - 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, - 0x41, 0x4c, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, - 0x50, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, - 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0x02, 0x22, 0x63, 0x0a, 0x14, - 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, - 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x22, 0xe3, 0x02, 0x0a, 0x13, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3f, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x67, + 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x5d, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, + 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, - 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x36, + 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, + 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, + 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x3b, 0x0a, 0x11, 0x45, 0x6e, 0x75, 0x6d, + 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x83, 0x01, 0x0a, 0x18, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x5d, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x3b, 0x0a, 0x11, 0x45, 0x6e, - 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, - 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x83, 0x01, 0x0a, 0x18, 0x45, 0x6e, 0x75, 0x6d, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, - 0x12, 0x3b, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa7, 0x01, - 0x0a, 0x16, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x06, - 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x39, 0x0a, 0x07, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, + 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x16, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, + 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x06, 0x6d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, + 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x39, 0x0a, 0x07, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x89, 0x02, 0x0a, 0x15, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x30, 0x0a, + 0x10, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, + 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0f, + 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x12, + 0x30, 0x0a, 0x10, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x69, 0x6e, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, + 0x52, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, + 0x67, 0x22, 0xad, 0x09, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6a, 0x61, 0x76, 0x61, 0x50, 0x61, 0x63, + 0x6b, 0x61, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, + 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x12, 0x6a, 0x61, 0x76, 0x61, 0x4f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, + 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x6a, 0x61, 0x76, 0x61, + 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x44, 0x0a, + 0x1d, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x65, + 0x71, 0x75, 0x61, 0x6c, 0x73, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x14, + 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x19, 0x6a, 0x61, 0x76, 0x61, 0x47, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x45, 0x71, 0x75, 0x61, 0x6c, 0x73, 0x41, 0x6e, 0x64, 0x48, + 0x61, 0x73, 0x68, 0x12, 0x3a, 0x0a, 0x16, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x73, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x75, 0x74, 0x66, 0x38, 0x18, 0x1b, 0x20, + 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x13, 0x6a, 0x61, 0x76, 0x61, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x74, 0x66, 0x38, 0x12, + 0x53, 0x0a, 0x0c, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x18, + 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, + 0x3a, 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, 0x52, 0x0b, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, + 0x65, 0x46, 0x6f, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x6f, 0x50, 0x61, 0x63, 0x6b, + 0x61, 0x67, 0x65, 0x12, 0x35, 0x0a, 0x13, 0x63, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, + 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, + 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x63, 0x63, 0x47, 0x65, 0x6e, 0x65, 0x72, + 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x39, 0x0a, 0x15, 0x6a, 0x61, + 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, + 0x52, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x35, 0x0a, 0x13, 0x70, 0x79, 0x5f, 0x67, 0x65, 0x6e, 0x65, + 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x12, 0x20, 0x01, + 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x70, 0x79, 0x47, 0x65, 0x6e, + 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0a, + 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x17, 0x20, 0x01, 0x28, 0x08, + 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, + 0x74, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x10, 0x63, 0x63, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x5f, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x04, 0x74, + 0x72, 0x75, 0x65, 0x52, 0x0e, 0x63, 0x63, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x72, 0x65, + 0x6e, 0x61, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, + 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x24, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, + 0x6f, 0x62, 0x6a, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, + 0x29, 0x0a, 0x10, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x18, 0x25, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x73, 0x68, 0x61, 0x72, + 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x77, + 0x69, 0x66, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x27, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x73, 0x77, 0x69, 0x66, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x28, 0x0a, + 0x10, 0x70, 0x68, 0x70, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, + 0x78, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x68, 0x70, 0x43, 0x6c, 0x61, 0x73, + 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x68, 0x70, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x29, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x70, 0x68, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x34, 0x0a, 0x16, + 0x70, 0x68, 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x2c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x70, 0x68, + 0x70, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x75, 0x62, 0x79, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x18, 0x2d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x75, 0x62, 0x79, 0x50, 0x61, + 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x73, 0x18, 0x32, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, + 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x89, 0x02, 0x0a, 0x15, 0x4d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x75, 0x74, 0x70, 0x75, - 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, - 0x30, 0x0a, 0x10, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, - 0x52, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, - 0x67, 0x12, 0x30, 0x0a, 0x10, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, - 0x73, 0x65, 0x52, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x69, 0x6e, 0x67, 0x22, 0xad, 0x09, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, - 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6a, 0x61, 0x76, 0x61, 0x50, - 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, - 0x75, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6a, 0x61, 0x76, 0x61, 0x4f, 0x75, 0x74, 0x65, 0x72, 0x43, - 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x13, 0x6a, 0x61, 0x76, 0x61, - 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, - 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x6a, 0x61, - 0x76, 0x61, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, - 0x44, 0x0a, 0x1d, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, - 0x5f, 0x65, 0x71, 0x75, 0x61, 0x6c, 0x73, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, - 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x19, 0x6a, 0x61, 0x76, 0x61, - 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x45, 0x71, 0x75, 0x61, 0x6c, 0x73, 0x41, 0x6e, - 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3a, 0x0a, 0x16, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x73, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x75, 0x74, 0x66, 0x38, 0x18, - 0x1b, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x13, 0x6a, 0x61, - 0x76, 0x61, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x74, 0x66, - 0x38, 0x12, 0x53, 0x0a, 0x0c, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x5f, 0x66, 0x6f, - 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, - 0x64, 0x65, 0x3a, 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, 0x52, 0x0b, 0x6f, 0x70, 0x74, 0x69, 0x6d, - 0x69, 0x7a, 0x65, 0x46, 0x6f, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, - 0x6b, 0x61, 0x67, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x6f, 0x50, 0x61, - 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x35, 0x0a, 0x13, 0x63, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x65, - 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x10, 0x20, 0x01, - 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x63, 0x63, 0x47, 0x65, 0x6e, - 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x39, 0x0a, 0x15, - 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, - 0x73, 0x65, 0x52, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x35, 0x0a, 0x13, 0x70, 0x79, 0x5f, 0x67, 0x65, - 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x12, - 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x70, 0x79, 0x47, - 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x25, - 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x17, 0x20, 0x01, - 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, - 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x10, 0x63, 0x63, 0x5f, 0x65, 0x6e, 0x61, 0x62, - 0x6c, 0x65, 0x5f, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x08, 0x3a, - 0x04, 0x74, 0x72, 0x75, 0x65, 0x52, 0x0e, 0x63, 0x63, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, - 0x72, 0x65, 0x6e, 0x61, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x6f, 0x62, 0x6a, 0x63, 0x5f, 0x63, 0x6c, - 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x24, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0f, 0x6f, 0x62, 0x6a, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, - 0x78, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x25, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x73, 0x68, - 0x61, 0x72, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, - 0x73, 0x77, 0x69, 0x66, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x27, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x73, 0x77, 0x69, 0x66, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, - 0x28, 0x0a, 0x10, 0x70, 0x68, 0x70, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, - 0x66, 0x69, 0x78, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x68, 0x70, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x68, 0x70, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x29, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0c, 0x70, 0x68, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x34, - 0x0a, 0x16, 0x70, 0x68, 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x2c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, - 0x70, 0x68, 0x70, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4e, 0x61, 0x6d, 0x65, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x75, 0x62, 0x79, 0x5f, 0x70, 0x61, 0x63, - 0x6b, 0x61, 0x67, 0x65, 0x18, 0x2d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x75, 0x62, 0x79, - 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x73, 0x18, 0x32, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, - 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, - 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, - 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x0a, 0x0c, 0x4f, 0x70, - 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x50, - 0x45, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x49, - 0x5a, 0x45, 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c, 0x4c, 0x49, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4e, - 0x54, 0x49, 0x4d, 0x45, 0x10, 0x03, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, - 0x02, 0x4a, 0x04, 0x08, 0x2a, 0x10, 0x2b, 0x4a, 0x04, 0x08, 0x26, 0x10, 0x27, 0x52, 0x14, 0x70, - 0x68, 0x70, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x22, 0xf4, 0x03, 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3c, 0x0a, 0x17, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x77, 0x69, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x14, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x57, 0x69, 0x72, 0x65, 0x46, 0x6f, - 0x72, 0x6d, 0x61, 0x74, 0x12, 0x4c, 0x0a, 0x1f, 0x6e, 0x6f, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, - 0x61, 0x72, 0x64, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x61, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, - 0x61, 0x6c, 0x73, 0x65, 0x52, 0x1c, 0x6e, 0x6f, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, - 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, - 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x70, - 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, - 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x56, 0x0a, 0x26, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, - 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, - 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, - 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x22, 0x64, 0x65, 0x70, 0x72, - 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x4a, 0x73, 0x6f, 0x6e, - 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x12, 0x37, - 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, - 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x04, - 0x10, 0x05, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x4a, 0x04, 0x08, 0x06, 0x10, 0x07, 0x4a, 0x04, - 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x22, 0x9d, 0x0d, 0x0a, 0x0c, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x63, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, - 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x54, 0x79, 0x70, 0x65, 0x3a, - 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x52, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, - 0x0a, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, - 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x47, 0x0a, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x09, 0x4a, 0x53, - 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x52, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x12, - 0x19, 0x0a, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, - 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x12, 0x2e, 0x0a, 0x0f, 0x75, 0x6e, - 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x6c, 0x61, 0x7a, 0x79, 0x18, 0x0f, 0x20, - 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0e, 0x75, 0x6e, 0x76, 0x65, - 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x4c, 0x61, 0x7a, 0x79, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, - 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, - 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, - 0x64, 0x12, 0x19, 0x0a, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, - 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x12, 0x28, 0x0a, 0x0c, - 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, 0x18, 0x10, 0x20, 0x01, - 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0b, 0x64, 0x65, 0x62, 0x75, 0x67, - 0x52, 0x65, 0x64, 0x61, 0x63, 0x74, 0x12, 0x4b, 0x0a, 0x09, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, - 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x13, - 0x20, 0x03, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, + 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x0a, 0x0c, 0x4f, 0x70, 0x74, 0x69, + 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x50, 0x45, 0x45, + 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x49, 0x5a, 0x45, + 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c, 0x4c, 0x49, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, + 0x4d, 0x45, 0x10, 0x03, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, + 0x04, 0x08, 0x2a, 0x10, 0x2b, 0x4a, 0x04, 0x08, 0x26, 0x10, 0x27, 0x52, 0x14, 0x70, 0x68, 0x70, + 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x22, 0xf4, 0x03, 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3c, 0x0a, 0x17, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, + 0x73, 0x65, 0x74, 0x5f, 0x77, 0x69, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x14, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x57, 0x69, 0x72, 0x65, 0x46, 0x6f, 0x72, 0x6d, + 0x61, 0x74, 0x12, 0x4c, 0x0a, 0x1f, 0x6e, 0x6f, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, + 0x64, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, + 0x73, 0x65, 0x52, 0x1c, 0x6e, 0x6f, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x44, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, + 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, + 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x65, + 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x56, 0x0a, 0x26, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x18, 0x0b, + 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x22, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, + 0x61, 0x74, 0x65, 0x64, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x69, + 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x08, + 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, + 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, + 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, + 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x4a, 0x04, 0x08, 0x06, 0x10, 0x07, 0x4a, 0x04, 0x08, 0x08, + 0x10, 0x09, 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x22, 0x9d, 0x0d, 0x0a, 0x0c, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x63, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x06, 0x53, + 0x54, 0x52, 0x49, 0x4e, 0x47, 0x52, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x70, 0x61, + 0x63, 0x6b, 0x65, 0x64, 0x12, 0x47, 0x0a, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, - 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x12, 0x57, 0x0a, - 0x10, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x73, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x6f, 0x6e, 0x73, 0x2e, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, + 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x52, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, + 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, + 0x73, 0x65, 0x52, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x12, 0x2e, 0x0a, 0x0f, 0x75, 0x6e, 0x76, 0x65, + 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x6c, 0x61, 0x7a, 0x79, 0x18, 0x0f, 0x20, 0x01, 0x28, + 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0e, 0x75, 0x6e, 0x76, 0x65, 0x72, 0x69, + 0x66, 0x69, 0x65, 0x64, 0x4c, 0x61, 0x7a, 0x79, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, + 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, + 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, + 0x19, 0x0a, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, + 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x12, 0x28, 0x0a, 0x0c, 0x64, 0x65, + 0x62, 0x75, 0x67, 0x5f, 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, + 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0b, 0x64, 0x65, 0x62, 0x75, 0x67, 0x52, 0x65, + 0x64, 0x61, 0x63, 0x74, 0x12, 0x4b, 0x0a, 0x09, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x0f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x73, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, - 0x55, 0x0a, 0x0f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x75, 0x70, 0x70, 0x6f, - 0x72, 0x74, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, - 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x0e, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, - 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, - 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, - 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x1a, 0x5a, 0x0a, 0x0e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x65, - 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x96, 0x02, 0x0a, - 0x0e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x12, - 0x47, 0x0a, 0x12, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x74, 0x72, 0x6f, - 0x64, 0x75, 0x63, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, - 0x74, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x47, 0x0a, 0x12, 0x65, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, - 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, - 0x64, 0x12, 0x2f, 0x0a, 0x13, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, - 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x61, 0x72, 0x6e, 0x69, - 0x6e, 0x67, 0x12, 0x41, 0x0a, 0x0f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, - 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x22, 0x2f, 0x0a, 0x05, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, - 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f, - 0x52, 0x44, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x50, - 0x49, 0x45, 0x43, 0x45, 0x10, 0x02, 0x22, 0x35, 0x0a, 0x06, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, - 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0d, - 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x22, 0x55, 0x0a, - 0x0f, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x15, 0x0a, 0x11, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, - 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x52, 0x45, 0x54, 0x45, 0x4e, - 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x14, - 0x0a, 0x10, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4f, 0x55, 0x52, - 0x43, 0x45, 0x10, 0x02, 0x22, 0x8c, 0x02, 0x0a, 0x10, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, - 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, - 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x54, 0x41, 0x52, 0x47, - 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x4e, 0x53, 0x49, 0x4f, - 0x4e, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, - 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, - 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x46, 0x49, 0x45, 0x4c, 0x44, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x41, 0x52, - 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x4e, 0x45, 0x4f, 0x46, 0x10, 0x05, - 0x12, 0x14, 0x0a, 0x10, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, - 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x06, 0x12, 0x1a, 0x0a, 0x16, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, - 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x4e, 0x54, 0x52, 0x59, - 0x10, 0x07, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12, 0x54, - 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, - 0x44, 0x10, 0x09, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, - 0x08, 0x04, 0x10, 0x05, 0x4a, 0x04, 0x08, 0x12, 0x10, 0x13, 0x22, 0xac, 0x01, 0x0a, 0x0c, 0x4f, - 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, - 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x74, + 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x48, 0x0a, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x13, 0x20, 0x03, + 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, + 0x70, 0x65, 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x12, 0x57, 0x0a, 0x10, 0x65, + 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x18, + 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, + 0x75, 0x6c, 0x74, 0x52, 0x0f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, + 0x75, 0x6c, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, + 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x55, 0x0a, + 0x0f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, + 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x75, 0x70, + 0x70, 0x6f, 0x72, 0x74, 0x52, 0x0e, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x75, 0x70, + 0x70, 0x6f, 0x72, 0x74, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, - 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xd1, 0x02, 0x0a, 0x0b, 0x45, 0x6e, - 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, - 0x6f, 0x77, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, - 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, - 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, - 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, - 0x64, 0x12, 0x56, 0x0a, 0x26, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, - 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x22, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, - 0x64, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, + 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x5a, + 0x0a, 0x0e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x12, 0x32, 0x0a, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x65, 0x64, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x96, 0x02, 0x0a, 0x0e, 0x46, + 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x47, 0x0a, + 0x12, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x74, 0x72, 0x6f, 0x64, 0x75, + 0x63, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x74, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x47, 0x0a, 0x12, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x65, 0x64, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, + 0x2f, 0x0a, 0x13, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x77, + 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x64, 0x65, + 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, + 0x12, 0x41, 0x0a, 0x0f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x64, 0x22, 0x2f, 0x0a, 0x05, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, + 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f, 0x52, 0x44, + 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x49, 0x45, + 0x43, 0x45, 0x10, 0x02, 0x22, 0x35, 0x0a, 0x06, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0d, + 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x0d, 0x0a, + 0x09, 0x4a, 0x53, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, + 0x4a, 0x53, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x22, 0x55, 0x0a, 0x0f, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x15, + 0x0a, 0x11, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, + 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, + 0x4f, 0x4e, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, + 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, + 0x10, 0x02, 0x22, 0x8c, 0x02, 0x0a, 0x10, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, 0x47, 0x45, + 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, + 0x12, 0x14, 0x0a, 0x10, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x46, 0x49, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x4e, 0x53, 0x49, 0x4f, 0x4e, 0x5f, + 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, 0x47, 0x45, + 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x03, + 0x12, 0x15, 0x0a, 0x11, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x46, 0x49, 0x45, 0x4c, 0x44, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x41, 0x52, 0x47, 0x45, + 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x4e, 0x45, 0x4f, 0x46, 0x10, 0x05, 0x12, 0x14, + 0x0a, 0x10, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, + 0x55, 0x4d, 0x10, 0x06, 0x12, 0x1a, 0x0a, 0x16, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x4e, 0x54, 0x52, 0x59, 0x10, 0x07, + 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x41, 0x52, + 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x10, + 0x09, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x04, + 0x10, 0x05, 0x4a, 0x04, 0x08, 0x12, 0x10, 0x13, 0x22, 0xac, 0x01, 0x0a, 0x0c, 0x4f, 0x6e, 0x65, + 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, @@ -4969,274 +4949,296 @@ var file_google_protobuf_descriptor_proto_rawDesc = []byte{ 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, - 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0xd8, 0x02, - 0x0a, 0x10, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, - 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, + 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xd1, 0x02, 0x0a, 0x0b, 0x45, 0x6e, 0x75, 0x6d, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x6f, 0x77, + 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x6c, + 0x6c, 0x6f, 0x77, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, + 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, + 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, + 0x56, 0x0a, 0x26, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x65, + 0x67, 0x61, 0x63, 0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, + 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x42, + 0x02, 0x18, 0x01, 0x52, 0x22, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x4c, + 0x65, 0x67, 0x61, 0x63, 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, + 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, + 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, + 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, + 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, + 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0xd8, 0x02, 0x0a, 0x10, + 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, + 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, + 0x12, 0x28, 0x0a, 0x0c, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0b, 0x64, + 0x65, 0x62, 0x75, 0x67, 0x52, 0x65, 0x64, 0x61, 0x63, 0x74, 0x12, 0x55, 0x0a, 0x0f, 0x66, 0x65, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, + 0x74, 0x52, 0x0e, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, + 0x74, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, + 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, + 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, + 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xd5, 0x01, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x73, 0x12, 0x28, 0x0a, 0x0c, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x72, 0x65, 0x64, 0x61, - 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, - 0x0b, 0x64, 0x65, 0x62, 0x75, 0x67, 0x52, 0x65, 0x64, 0x61, 0x63, 0x74, 0x12, 0x55, 0x0a, 0x0f, - 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x75, 0x70, 0x70, - 0x6f, 0x72, 0x74, 0x52, 0x0e, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x75, 0x70, 0x70, - 0x6f, 0x72, 0x74, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, + 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, + 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, + 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x99, + 0x03, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x21, + 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, + 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x71, 0x0a, 0x11, 0x69, 0x64, 0x65, 0x6d, 0x70, + 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x22, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, + 0x76, 0x65, 0x6c, 0x3a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x43, 0x59, + 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x52, 0x10, 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, + 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x23, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, + 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, - 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xd5, 0x01, 0x0a, 0x0e, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, - 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x50, 0x0a, + 0x10, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, + 0x6c, 0x12, 0x17, 0x0a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x43, 0x59, + 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4e, 0x4f, + 0x5f, 0x53, 0x49, 0x44, 0x45, 0x5f, 0x45, 0x46, 0x46, 0x45, 0x43, 0x54, 0x53, 0x10, 0x01, 0x12, + 0x0e, 0x0a, 0x0a, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x54, 0x10, 0x02, 0x2a, + 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x9a, 0x03, 0x0a, 0x13, 0x55, + 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, + 0x69, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, + 0x0a, 0x12, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x6e, 0x65, 0x67, 0x61, + 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, + 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x01, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x67, 0x67, + 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x4a, 0x0a, 0x08, 0x4e, + 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x5f, + 0x70, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x61, 0x6d, 0x65, + 0x50, 0x61, 0x72, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x02, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xa7, 0x0a, 0x0a, 0x0a, 0x46, 0x65, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x12, 0x91, 0x01, 0x0a, 0x0e, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x3f, 0x88, 0x01, 0x01, 0x98, + 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45, 0x58, 0x50, 0x4c, 0x49, 0x43, + 0x49, 0x54, 0x18, 0x84, 0x07, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x43, + 0x49, 0x54, 0x18, 0xe7, 0x07, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45, 0x58, 0x50, 0x4c, 0x49, 0x43, + 0x49, 0x54, 0x18, 0xe8, 0x07, 0xb2, 0x01, 0x03, 0x08, 0xe8, 0x07, 0x52, 0x0d, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x6c, 0x0a, 0x09, 0x65, 0x6e, + 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, - 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, - 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, 0x0a, 0x14, 0x75, - 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, - 0x22, 0x99, 0x03, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, - 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, - 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x71, 0x0a, 0x11, 0x69, 0x64, 0x65, - 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x22, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, - 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x3a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, - 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x52, 0x10, 0x69, 0x64, 0x65, 0x6d, - 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x37, 0x0a, 0x08, - 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x23, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, - 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0x50, 0x0a, 0x10, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, - 0x76, 0x65, 0x6c, 0x12, 0x17, 0x0a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, - 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, - 0x4e, 0x4f, 0x5f, 0x53, 0x49, 0x44, 0x45, 0x5f, 0x45, 0x46, 0x46, 0x45, 0x43, 0x54, 0x53, 0x10, - 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x54, 0x10, - 0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x9a, 0x03, 0x0a, - 0x13, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, - 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, - 0x74, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, - 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, - 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x6e, 0x65, - 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, - 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, - 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, - 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x4a, 0x0a, - 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x61, 0x6d, - 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x61, - 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x65, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x02, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xa7, 0x0a, 0x0a, 0x0a, 0x46, 0x65, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x12, 0x91, 0x01, 0x0a, 0x0e, 0x66, 0x69, 0x65, - 0x6c, 0x64, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x3f, 0x88, 0x01, - 0x01, 0x98, 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45, 0x58, 0x50, 0x4c, - 0x49, 0x43, 0x49, 0x54, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x49, 0x4d, 0x50, 0x4c, - 0x49, 0x43, 0x49, 0x54, 0x18, 0xe7, 0x07, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45, 0x58, 0x50, 0x4c, - 0x49, 0x43, 0x49, 0x54, 0x18, 0xe8, 0x07, 0xb2, 0x01, 0x03, 0x08, 0xe8, 0x07, 0x52, 0x0d, 0x66, - 0x69, 0x65, 0x6c, 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x6c, 0x0a, 0x09, - 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x45, 0x6e, 0x75, - 0x6d, 0x54, 0x79, 0x70, 0x65, 0x42, 0x29, 0x88, 0x01, 0x01, 0x98, 0x01, 0x06, 0x98, 0x01, 0x01, - 0xa2, 0x01, 0x0b, 0x12, 0x06, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0x18, 0xe6, 0x07, 0xa2, 0x01, - 0x09, 0x12, 0x04, 0x4f, 0x50, 0x45, 0x4e, 0x18, 0xe7, 0x07, 0xb2, 0x01, 0x03, 0x08, 0xe8, 0x07, - 0x52, 0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x98, 0x01, 0x0a, 0x17, 0x72, - 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x6e, - 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, - 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, - 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x42, - 0x2d, 0x88, 0x01, 0x01, 0x98, 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45, - 0x58, 0x50, 0x41, 0x4e, 0x44, 0x45, 0x44, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x0b, 0x12, 0x06, 0x50, - 0x41, 0x43, 0x4b, 0x45, 0x44, 0x18, 0xe7, 0x07, 0xb2, 0x01, 0x03, 0x08, 0xe8, 0x07, 0x52, 0x15, - 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x63, - 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x7e, 0x0a, 0x0f, 0x75, 0x74, 0x66, 0x38, 0x5f, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x55, 0x74, 0x66, 0x38, - 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x29, 0x88, 0x01, 0x01, 0x98, - 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x09, 0x12, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x18, 0xe6, - 0x07, 0xa2, 0x01, 0x0b, 0x12, 0x06, 0x56, 0x45, 0x52, 0x49, 0x46, 0x59, 0x18, 0xe7, 0x07, 0xb2, - 0x01, 0x03, 0x08, 0xe8, 0x07, 0x52, 0x0e, 0x75, 0x74, 0x66, 0x38, 0x56, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x7e, 0x0a, 0x10, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x2b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x42, 0x26, 0x88, 0x01, - 0x01, 0x98, 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x14, 0x12, 0x0f, 0x4c, 0x45, 0x4e, 0x47, - 0x54, 0x48, 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x45, 0x44, 0x18, 0xe6, 0x07, 0xb2, 0x01, - 0x03, 0x08, 0xe8, 0x07, 0x52, 0x0f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x63, - 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x82, 0x01, 0x0a, 0x0b, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, - 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x6f, 0x72, - 0x6d, 0x61, 0x74, 0x42, 0x39, 0x88, 0x01, 0x01, 0x98, 0x01, 0x03, 0x98, 0x01, 0x06, 0x98, 0x01, - 0x01, 0xa2, 0x01, 0x17, 0x12, 0x12, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, 0x5f, 0x42, 0x45, 0x53, - 0x54, 0x5f, 0x45, 0x46, 0x46, 0x4f, 0x52, 0x54, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x0a, 0x12, 0x05, - 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x18, 0xe7, 0x07, 0xb2, 0x01, 0x03, 0x08, 0xe8, 0x07, 0x52, 0x0a, - 0x6a, 0x73, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0x5c, 0x0a, 0x0d, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x46, - 0x49, 0x45, 0x4c, 0x44, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x43, 0x45, 0x5f, 0x55, 0x4e, - 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x45, 0x58, 0x50, 0x4c, 0x49, - 0x43, 0x49, 0x54, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x43, 0x49, - 0x54, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, 0x5f, 0x52, 0x45, - 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0x03, 0x22, 0x37, 0x0a, 0x08, 0x45, 0x6e, 0x75, 0x6d, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4f, - 0x50, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0x10, - 0x02, 0x22, 0x56, 0x0a, 0x15, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, - 0x6c, 0x64, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x23, 0x0a, 0x1f, 0x52, 0x45, - 0x50, 0x45, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x46, 0x49, 0x45, 0x4c, 0x44, 0x5f, 0x45, 0x4e, 0x43, - 0x4f, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, - 0x0a, 0x0a, 0x06, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x45, - 0x58, 0x50, 0x41, 0x4e, 0x44, 0x45, 0x44, 0x10, 0x02, 0x22, 0x49, 0x0a, 0x0e, 0x55, 0x74, 0x66, - 0x38, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x17, 0x55, - 0x54, 0x46, 0x38, 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, - 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x56, 0x45, 0x52, 0x49, - 0x46, 0x59, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x03, 0x22, 0x04, - 0x08, 0x01, 0x10, 0x01, 0x22, 0x53, 0x0a, 0x0f, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, - 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x1c, 0x0a, 0x18, 0x4d, 0x45, 0x53, 0x53, 0x41, - 0x47, 0x45, 0x5f, 0x45, 0x4e, 0x43, 0x4f, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, - 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x45, 0x4e, 0x47, 0x54, 0x48, 0x5f, - 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x45, - 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x10, 0x02, 0x22, 0x48, 0x0a, 0x0a, 0x4a, 0x73, 0x6f, - 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x17, 0x0a, 0x13, 0x4a, 0x53, 0x4f, 0x4e, 0x5f, - 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, - 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4c, - 0x45, 0x47, 0x41, 0x43, 0x59, 0x5f, 0x42, 0x45, 0x53, 0x54, 0x5f, 0x45, 0x46, 0x46, 0x4f, 0x52, - 0x54, 0x10, 0x02, 0x2a, 0x06, 0x08, 0xe8, 0x07, 0x10, 0x8b, 0x4e, 0x2a, 0x06, 0x08, 0x8b, 0x4e, - 0x10, 0x90, 0x4e, 0x2a, 0x06, 0x08, 0x90, 0x4e, 0x10, 0x91, 0x4e, 0x4a, 0x06, 0x08, 0xe7, 0x07, - 0x10, 0xe8, 0x07, 0x22, 0xef, 0x03, 0x0a, 0x12, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, - 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x58, 0x0a, 0x08, 0x64, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x67, + 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x54, + 0x79, 0x70, 0x65, 0x42, 0x29, 0x88, 0x01, 0x01, 0x98, 0x01, 0x06, 0x98, 0x01, 0x01, 0xa2, 0x01, + 0x0b, 0x12, 0x06, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0x18, 0x84, 0x07, 0xa2, 0x01, 0x09, 0x12, + 0x04, 0x4f, 0x50, 0x45, 0x4e, 0x18, 0xe7, 0x07, 0xb2, 0x01, 0x03, 0x08, 0xe8, 0x07, 0x52, 0x08, + 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x98, 0x01, 0x0a, 0x17, 0x72, 0x65, 0x70, + 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x6e, 0x63, 0x6f, + 0x64, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x42, 0x2d, 0x88, + 0x01, 0x01, 0x98, 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45, 0x58, 0x50, + 0x41, 0x4e, 0x44, 0x45, 0x44, 0x18, 0x84, 0x07, 0xa2, 0x01, 0x0b, 0x12, 0x06, 0x50, 0x41, 0x43, + 0x4b, 0x45, 0x44, 0x18, 0xe7, 0x07, 0xb2, 0x01, 0x03, 0x08, 0xe8, 0x07, 0x52, 0x15, 0x72, 0x65, + 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x63, 0x6f, 0x64, + 0x69, 0x6e, 0x67, 0x12, 0x7e, 0x0a, 0x0f, 0x75, 0x74, 0x66, 0x38, 0x5f, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, - 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x73, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x45, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x08, 0x64, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x73, 0x12, 0x41, 0x0a, 0x0f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x5f, - 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, + 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x55, 0x74, 0x66, 0x38, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x29, 0x88, 0x01, 0x01, 0x98, 0x01, 0x04, + 0x98, 0x01, 0x01, 0xa2, 0x01, 0x09, 0x12, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x18, 0x84, 0x07, 0xa2, + 0x01, 0x0b, 0x12, 0x06, 0x56, 0x45, 0x52, 0x49, 0x46, 0x59, 0x18, 0xe7, 0x07, 0xb2, 0x01, 0x03, + 0x08, 0xe8, 0x07, 0x52, 0x0e, 0x75, 0x74, 0x66, 0x38, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x7e, 0x0a, 0x10, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x65, + 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, - 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x69, 0x6d, - 0x75, 0x6d, 0x5f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x69, - 0x6d, 0x75, 0x6d, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xf8, 0x01, 0x0a, 0x18, 0x46, - 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4e, 0x0a, 0x14, 0x6f, - 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x42, 0x26, 0x88, 0x01, 0x01, 0x98, + 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x14, 0x12, 0x0f, 0x4c, 0x45, 0x4e, 0x47, 0x54, 0x48, + 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x45, 0x44, 0x18, 0x84, 0x07, 0xb2, 0x01, 0x03, 0x08, + 0xe8, 0x07, 0x52, 0x0f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x63, 0x6f, 0x64, + 0x69, 0x6e, 0x67, 0x12, 0x82, 0x01, 0x0a, 0x0b, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, + 0x6d, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x13, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x61, - 0x62, 0x6c, 0x65, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x0e, 0x66, - 0x69, 0x78, 0x65, 0x64, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, - 0x52, 0x0d, 0x66, 0x69, 0x78, 0x65, 0x64, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x4a, - 0x04, 0x08, 0x01, 0x10, 0x02, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x52, 0x08, 0x66, 0x65, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x73, 0x22, 0xa7, 0x02, 0x0a, 0x0e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x44, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4c, 0x6f, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xce, - 0x01, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, - 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, - 0x61, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x6c, - 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, - 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, - 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x10, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, - 0x6e, 0x74, 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x64, - 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, - 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x17, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x44, - 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, - 0xd0, 0x02, 0x0a, 0x11, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, - 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4d, 0x0a, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, - 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xeb, 0x01, 0x0a, 0x0a, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, - 0x62, 0x65, 0x67, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x62, 0x65, 0x67, - 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x03, 0x65, 0x6e, 0x64, 0x12, 0x52, 0x0a, 0x08, 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x36, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, - 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x52, 0x08, - 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x22, 0x28, 0x0a, 0x08, 0x53, 0x65, 0x6d, 0x61, - 0x6e, 0x74, 0x69, 0x63, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x07, - 0x0a, 0x03, 0x53, 0x45, 0x54, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x49, 0x41, 0x53, - 0x10, 0x02, 0x2a, 0xa7, 0x02, 0x0a, 0x07, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x13, - 0x0a, 0x0f, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, - 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0e, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4c, - 0x45, 0x47, 0x41, 0x43, 0x59, 0x10, 0x84, 0x07, 0x12, 0x13, 0x0a, 0x0e, 0x45, 0x44, 0x49, 0x54, - 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x32, 0x10, 0xe6, 0x07, 0x12, 0x13, 0x0a, - 0x0e, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x33, 0x10, - 0xe7, 0x07, 0x12, 0x11, 0x0a, 0x0c, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x32, 0x30, - 0x32, 0x33, 0x10, 0xe8, 0x07, 0x12, 0x11, 0x0a, 0x0c, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x32, 0x30, 0x32, 0x34, 0x10, 0xe9, 0x07, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x44, 0x49, 0x54, - 0x49, 0x4f, 0x4e, 0x5f, 0x31, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, - 0x01, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x32, 0x5f, 0x54, - 0x45, 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x02, 0x12, 0x1d, 0x0a, 0x17, 0x45, 0x44, - 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x37, 0x5f, 0x54, 0x45, 0x53, 0x54, - 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x9d, 0x8d, 0x06, 0x12, 0x1d, 0x0a, 0x17, 0x45, 0x44, 0x49, - 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x38, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, - 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x9e, 0x8d, 0x06, 0x12, 0x1d, 0x0a, 0x17, 0x45, 0x44, 0x49, 0x54, - 0x49, 0x4f, 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x39, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, 0x4f, - 0x4e, 0x4c, 0x59, 0x10, 0x9f, 0x8d, 0x06, 0x12, 0x13, 0x0a, 0x0b, 0x45, 0x44, 0x49, 0x54, 0x49, - 0x4f, 0x4e, 0x5f, 0x4d, 0x41, 0x58, 0x10, 0xff, 0xff, 0xff, 0xff, 0x07, 0x42, 0x7e, 0x0a, 0x13, - 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x42, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x48, 0x01, 0x5a, 0x2d, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x6f, 0x72, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, - 0x02, 0x1a, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, + 0x74, 0x42, 0x39, 0x88, 0x01, 0x01, 0x98, 0x01, 0x03, 0x98, 0x01, 0x06, 0x98, 0x01, 0x01, 0xa2, + 0x01, 0x17, 0x12, 0x12, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, 0x5f, 0x42, 0x45, 0x53, 0x54, 0x5f, + 0x45, 0x46, 0x46, 0x4f, 0x52, 0x54, 0x18, 0x84, 0x07, 0xa2, 0x01, 0x0a, 0x12, 0x05, 0x41, 0x4c, + 0x4c, 0x4f, 0x57, 0x18, 0xe7, 0x07, 0xb2, 0x01, 0x03, 0x08, 0xe8, 0x07, 0x52, 0x0a, 0x6a, 0x73, + 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0x5c, 0x0a, 0x0d, 0x46, 0x69, 0x65, 0x6c, + 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x46, 0x49, 0x45, + 0x4c, 0x44, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, + 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x45, 0x58, 0x50, 0x4c, 0x49, 0x43, 0x49, + 0x54, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x43, 0x49, 0x54, 0x10, + 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, 0x5f, 0x52, 0x45, 0x51, 0x55, + 0x49, 0x52, 0x45, 0x44, 0x10, 0x03, 0x22, 0x37, 0x0a, 0x08, 0x45, 0x6e, 0x75, 0x6d, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4f, 0x50, 0x45, + 0x4e, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0x10, 0x02, 0x22, + 0x56, 0x0a, 0x15, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x23, 0x0a, 0x1f, 0x52, 0x45, 0x50, 0x45, + 0x41, 0x54, 0x45, 0x44, 0x5f, 0x46, 0x49, 0x45, 0x4c, 0x44, 0x5f, 0x45, 0x4e, 0x43, 0x4f, 0x44, + 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, + 0x06, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x45, 0x58, 0x50, + 0x41, 0x4e, 0x44, 0x45, 0x44, 0x10, 0x02, 0x22, 0x49, 0x0a, 0x0e, 0x55, 0x74, 0x66, 0x38, 0x56, + 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x17, 0x55, 0x54, 0x46, + 0x38, 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, + 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x56, 0x45, 0x52, 0x49, 0x46, 0x59, + 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x03, 0x22, 0x04, 0x08, 0x01, + 0x10, 0x01, 0x22, 0x53, 0x0a, 0x0f, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x63, + 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x1c, 0x0a, 0x18, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, + 0x5f, 0x45, 0x4e, 0x43, 0x4f, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, + 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x45, 0x4e, 0x47, 0x54, 0x48, 0x5f, 0x50, 0x52, + 0x45, 0x46, 0x49, 0x58, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x45, 0x4c, 0x49, + 0x4d, 0x49, 0x54, 0x45, 0x44, 0x10, 0x02, 0x22, 0x48, 0x0a, 0x0a, 0x4a, 0x73, 0x6f, 0x6e, 0x46, + 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x17, 0x0a, 0x13, 0x4a, 0x53, 0x4f, 0x4e, 0x5f, 0x46, 0x4f, + 0x52, 0x4d, 0x41, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x09, + 0x0a, 0x05, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4c, 0x45, 0x47, + 0x41, 0x43, 0x59, 0x5f, 0x42, 0x45, 0x53, 0x54, 0x5f, 0x45, 0x46, 0x46, 0x4f, 0x52, 0x54, 0x10, + 0x02, 0x2a, 0x06, 0x08, 0xe8, 0x07, 0x10, 0x8b, 0x4e, 0x2a, 0x06, 0x08, 0x8b, 0x4e, 0x10, 0x90, + 0x4e, 0x2a, 0x06, 0x08, 0x90, 0x4e, 0x10, 0x91, 0x4e, 0x4a, 0x06, 0x08, 0xe7, 0x07, 0x10, 0xe8, + 0x07, 0x22, 0xef, 0x03, 0x0a, 0x12, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, + 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x58, 0x0a, 0x08, 0x64, 0x65, 0x66, 0x61, + 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, + 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x08, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x73, 0x12, 0x41, 0x0a, 0x0f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x5f, 0x65, 0x64, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x45, 0x64, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, + 0x5f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, + 0x6d, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xf8, 0x01, 0x0a, 0x18, 0x46, 0x65, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, + 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4e, 0x0a, 0x14, 0x6f, 0x76, 0x65, + 0x72, 0x72, 0x69, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x53, 0x65, 0x74, 0x52, 0x13, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x61, 0x62, 0x6c, + 0x65, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x0e, 0x66, 0x69, 0x78, + 0x65, 0x64, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x0d, + 0x66, 0x69, 0x78, 0x65, 0x64, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x4a, 0x04, 0x08, + 0x01, 0x10, 0x02, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x73, 0x22, 0xb5, 0x02, 0x0a, 0x0e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, + 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x44, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xce, 0x01, 0x0a, + 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, + 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, + 0x68, 0x12, 0x16, 0x0a, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x42, + 0x02, 0x10, 0x01, 0x52, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x6c, 0x65, 0x61, + 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, + 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, + 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x10, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, + 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x17, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74, + 0x61, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2a, 0x0c, 0x08, + 0x80, 0xec, 0xca, 0xff, 0x01, 0x10, 0x81, 0xec, 0xca, 0xff, 0x01, 0x22, 0xd0, 0x02, 0x0a, 0x11, + 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x4d, 0x0a, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, + 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x1a, 0xeb, 0x01, 0x0a, 0x0a, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, + 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x65, 0x67, 0x69, + 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x12, 0x10, + 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, + 0x12, 0x52, 0x0a, 0x08, 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x36, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, + 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x53, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x52, 0x08, 0x73, 0x65, 0x6d, 0x61, + 0x6e, 0x74, 0x69, 0x63, 0x22, 0x28, 0x0a, 0x08, 0x53, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, + 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x45, + 0x54, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x49, 0x41, 0x53, 0x10, 0x02, 0x2a, 0xa7, + 0x02, 0x0a, 0x07, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x44, + 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, + 0x13, 0x0a, 0x0e, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4c, 0x45, 0x47, 0x41, 0x43, + 0x59, 0x10, 0x84, 0x07, 0x12, 0x13, 0x0a, 0x0e, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x32, 0x10, 0xe6, 0x07, 0x12, 0x13, 0x0a, 0x0e, 0x45, 0x44, 0x49, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x33, 0x10, 0xe7, 0x07, 0x12, 0x11, + 0x0a, 0x0c, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x32, 0x30, 0x32, 0x33, 0x10, 0xe8, + 0x07, 0x12, 0x11, 0x0a, 0x0c, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x32, 0x30, 0x32, + 0x34, 0x10, 0xe9, 0x07, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x31, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x01, 0x12, 0x17, 0x0a, + 0x13, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x32, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, + 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x02, 0x12, 0x1d, 0x0a, 0x17, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, + 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x37, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, + 0x59, 0x10, 0x9d, 0x8d, 0x06, 0x12, 0x1d, 0x0a, 0x17, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x39, 0x39, 0x39, 0x39, 0x38, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, + 0x10, 0x9e, 0x8d, 0x06, 0x12, 0x1d, 0x0a, 0x17, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x39, 0x39, 0x39, 0x39, 0x39, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, + 0x9f, 0x8d, 0x06, 0x12, 0x13, 0x0a, 0x0b, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, + 0x41, 0x58, 0x10, 0xff, 0xff, 0xff, 0xff, 0x07, 0x42, 0x7e, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, + 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x48, 0x01, 0x5a, 0x2d, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, + 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, + 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1a, 0x47, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x52, 0x65, + 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, } var ( @@ -5404,6 +5406,8 @@ func file_google_protobuf_descriptor_proto_init() { return &v.sizeCache case 2: return &v.unknownFields + case 3: + return &v.extensionFields default: return nil } @@ -5676,6 +5680,8 @@ func file_google_protobuf_descriptor_proto_init() { return &v.sizeCache case 2: return &v.unknownFields + case 3: + return &v.extensionFields default: return nil } diff --git a/gen/ts/google/protobuf/descriptor_pb.js b/gen/ts/google/protobuf/descriptor_pb.js index fc791305b..03e3215c4 100644 --- a/gen/ts/google/protobuf/descriptor_pb.js +++ b/gen/ts/google/protobuf/descriptor_pb.js @@ -82,7 +82,7 @@ goog.exportSymbol('proto.google.protobuf.UninterpretedOption.NamePart', null, gl * @constructor */ proto.google.protobuf.FileDescriptorSet = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.google.protobuf.FileDescriptorSet.repeatedFields_, null); + jspb.Message.initialize(this, opt_data, 0, 2, proto.google.protobuf.FileDescriptorSet.repeatedFields_, null); }; goog.inherits(proto.google.protobuf.FileDescriptorSet, jspb.Message); if (goog.DEBUG && !COMPILED) { @@ -92,6 +92,36 @@ if (goog.DEBUG && !COMPILED) { */ proto.google.protobuf.FileDescriptorSet.displayName = 'proto.google.protobuf.FileDescriptorSet'; } + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.FileDescriptorSet.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.FileDescriptorSet.extensionsBinary = {}; + /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -991,7 +1021,7 @@ if (goog.DEBUG && !COMPILED) { * @constructor */ proto.google.protobuf.SourceCodeInfo = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.google.protobuf.SourceCodeInfo.repeatedFields_, null); + jspb.Message.initialize(this, opt_data, 0, 2, proto.google.protobuf.SourceCodeInfo.repeatedFields_, null); }; goog.inherits(proto.google.protobuf.SourceCodeInfo, jspb.Message); if (goog.DEBUG && !COMPILED) { @@ -1001,6 +1031,36 @@ if (goog.DEBUG && !COMPILED) { */ proto.google.protobuf.SourceCodeInfo.displayName = 'proto.google.protobuf.SourceCodeInfo'; } + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.SourceCodeInfo.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.google.protobuf.SourceCodeInfo.extensionsBinary = {}; + /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -1107,6 +1167,9 @@ proto.google.protobuf.FileDescriptorSet.toObject = function(includeInstance, msg proto.google.protobuf.FileDescriptorProto.toObject, includeInstance) }; + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.google.protobuf.FileDescriptorSet.extensions, proto.google.protobuf.FileDescriptorSet.prototype.getExtension, + includeInstance); if (includeInstance) { obj.$jspbMessageInstance = msg; } @@ -1147,7 +1210,10 @@ proto.google.protobuf.FileDescriptorSet.deserializeBinaryFromReader = function(m msg.addFile(value); break; default: - reader.skipField(); + jspb.Message.readBinaryExtension(msg, reader, + proto.google.protobuf.FileDescriptorSet.extensionsBinary, + proto.google.protobuf.FileDescriptorSet.prototype.getExtension, + proto.google.protobuf.FileDescriptorSet.prototype.setExtension); break; } } @@ -1183,6 +1249,8 @@ proto.google.protobuf.FileDescriptorSet.serializeBinaryToWriter = function(messa proto.google.protobuf.FileDescriptorProto.serializeBinaryToWriter ); } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.google.protobuf.FileDescriptorSet.extensionsBinary, proto.google.protobuf.FileDescriptorSet.prototype.getExtension); }; @@ -12185,6 +12253,9 @@ proto.google.protobuf.SourceCodeInfo.toObject = function(includeInstance, msg) { proto.google.protobuf.SourceCodeInfo.Location.toObject, includeInstance) }; + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.google.protobuf.SourceCodeInfo.extensions, proto.google.protobuf.SourceCodeInfo.prototype.getExtension, + includeInstance); if (includeInstance) { obj.$jspbMessageInstance = msg; } @@ -12225,7 +12296,10 @@ proto.google.protobuf.SourceCodeInfo.deserializeBinaryFromReader = function(msg, msg.addLocation(value); break; default: - reader.skipField(); + jspb.Message.readBinaryExtension(msg, reader, + proto.google.protobuf.SourceCodeInfo.extensionsBinary, + proto.google.protobuf.SourceCodeInfo.prototype.getExtension, + proto.google.protobuf.SourceCodeInfo.prototype.setExtension); break; } } @@ -12261,6 +12335,8 @@ proto.google.protobuf.SourceCodeInfo.serializeBinaryToWriter = function(message, proto.google.protobuf.SourceCodeInfo.Location.serializeBinaryToWriter ); } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.google.protobuf.SourceCodeInfo.extensionsBinary, proto.google.protobuf.SourceCodeInfo.prototype.getExtension); }; From eec963dc61f1853a17d0f3f0f6cde22c210a1d63 Mon Sep 17 00:00:00 2001 From: Max Baumann Date: Wed, 8 Jan 2025 21:52:05 +0100 Subject: [PATCH 8/8] fix lint issues --- .golangci.yaml | 2 -- services/user-svc/internal/hwkc/models.go | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 53ab8d633..ea8eba1cb 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -8,11 +8,9 @@ linters: - depguard # no need - ireturn # no need - funlen # we tend to have long funlens, who cares? - - execinquery # deprecated - goimports # unused - gochecknoglobals # we currently make use of globals - godot # petty linter - - gomnd # deprecated - gomoddirectives # not needed - gofumpt # false positives - mnd # too many false-positives diff --git a/services/user-svc/internal/hwkc/models.go b/services/user-svc/internal/hwkc/models.go index 97247ae7c..66b8883c7 100644 --- a/services/user-svc/internal/hwkc/models.go +++ b/services/user-svc/internal/hwkc/models.go @@ -9,12 +9,12 @@ type User struct { type Organization struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` - DisplayName *string `json:"displayName,omitempty"` + DisplayName *string `json:"display_name,omitempty"` Attributes OrganizationAttributes `json:"attributes,omitempty"` } type OrganizationAttributes struct { - IsPersonal []string `json:"isPersonal"` + IsPersonal []string `json:"is_personal"` } func (o *Organization) IsPersonal() bool {