diff --git a/perxis-proto b/perxis-proto index 53a6df870f5695939261f5cb6914c13090a4047b..d1034eb2bd4ae4158089aeb4ef48768b8a8e72b1 160000 --- a/perxis-proto +++ b/perxis-proto @@ -1 +1 @@ -Subproject commit 53a6df870f5695939261f5cb6914c13090a4047b +Subproject commit d1034eb2bd4ae4158089aeb4ef48768b8a8e72b1 diff --git a/pkg/auth/principal.go b/pkg/auth/principal.go index 78da09cb27f493f034720d40d91f33b7b6ce7313..004db35f2eab6433b1889861e964666ab4a71a21 100644 --- a/pkg/auth/principal.go +++ b/pkg/auth/principal.go @@ -3,7 +3,6 @@ package auth import ( "context" - "git.perx.ru/perxis/perxis-go/pkg/data" "git.perx.ru/perxis/perxis-go/pkg/environments" "git.perx.ru/perxis/perxis-go/pkg/members" "git.perx.ru/perxis/perxis-go/pkg/permission" @@ -46,41 +45,5 @@ type OrganizationAccessor interface { } func hasEnvironmentAccess(ctx context.Context, envsrv environments.Environments, role *roles.Role, envID string) bool { - if role == nil || role.SpaceID == "" || envID == "" { - return false - } - - if role.AllowManagement { - return true - } - - envs := role.Environments - - // Если явно не указаны доступные окружения - доступ по умолчанию к окружению master - if len(envs) == 0 { - envs = []string{environments.DefaultEnvironment} - } - - for _, ce := range envs { - if envID == ce || data.GlobMatch(envID, ce) { - return true - } - } - - e, err := envsrv.Get(WithSystem(ctx), role.SpaceID, envID) - if err != nil || e == nil { - return false - } - - aliases := append(e.Aliases, e.ID) - - for _, ce := range envs { - for _, al := range aliases { - if al == ce || data.GlobMatch(al, ce) { - return true - } - } - } - - return false + return role != nil && role.CanAccessEnvironment(ctx, &environments.Environment{SpaceID: role.SpaceID, ID: envID}, envsrv) } diff --git a/pkg/delivery/transport/grpc/protobuf_type_converters.microgen.go b/pkg/delivery/transport/grpc/protobuf_type_converters.microgen.go index dbbb951d484c903909bf774295ff1851a30995be..21c22460089b5f4c5291991a5df3cd62015234ac 100644 --- a/pkg/delivery/transport/grpc/protobuf_type_converters.microgen.go +++ b/pkg/delivery/transport/grpc/protobuf_type_converters.microgen.go @@ -199,8 +199,6 @@ func PtrItemsItemToProto(item *items.Item) (*itemspb.Item, error) { CreatedBy: item.CreatedBy, UpdatedBy: item.UpdatedBy, RevisionId: item.RevisionID, - PublishedBy: item.PublishedBy, - ArchivedBy: item.ArchivedBy, Locale: item.Locale, //Hidden, Template, Deleted - не передается для delivery } @@ -217,8 +215,6 @@ func PtrItemsItemToProto(item *items.Item) (*itemspb.Item, error) { //protoItem.Permissions - не передается для delivery protoItem.CreatedRevAt, _ = ptypes.TimestampProto(item.CreatedRevAt) - protoItem.PublishedAt, _ = ptypes.TimestampProto(item.PublishedAt) - protoItem.ArchivedAt, _ = ptypes.TimestampProto(item.ArchivedAt) protoItem.CreatedAt, _ = ptypes.TimestampProto(item.CreatedAt) protoItem.UpdatedAt, _ = ptypes.TimestampProto(item.UpdatedAt) @@ -239,8 +235,6 @@ func ProtoToPtrItemsItem(protoItem *itemspb.Item) (*items.Item, error) { CreatedBy: protoItem.CreatedBy, UpdatedBy: protoItem.UpdatedBy, RevisionID: protoItem.RevisionId, - PublishedBy: protoItem.PublishedBy, - ArchivedBy: protoItem.ArchivedBy, Locale: protoItem.Locale, //Hidden, Template, Deleted - не передается для delivery } @@ -250,8 +244,6 @@ func ProtoToPtrItemsItem(protoItem *itemspb.Item) (*items.Item, error) { //item.Permissions - не передается для delivery item.CreatedRevAt, _ = ptypes.Timestamp(protoItem.CreatedRevAt) - item.PublishedAt, _ = ptypes.Timestamp(protoItem.PublishedAt) - item.ArchivedAt, _ = ptypes.Timestamp(protoItem.ArchivedAt) item.CreatedAt, _ = ptypes.Timestamp(protoItem.CreatedAt) item.UpdatedAt, _ = ptypes.Timestamp(protoItem.UpdatedAt) diff --git a/pkg/items/item.go b/pkg/items/item.go index fc3a5154f621b601c02761c126be3ce72aa979ca..4c74d12185274530739eaaf441c75c6a96ead065 100644 --- a/pkg/items/item.go +++ b/pkg/items/item.go @@ -104,10 +104,6 @@ type Item struct { Locale string `json:"locale" bson:"-"` Translations map[string]map[string]interface{} `json:"translations" bson:"translations,omitempty"` RevisionID string `json:"revId,omitempty" bson:"revision_id"` - PublishedAt time.Time `json:"publishedAt,omitempty" bson:"published_at,omitempty"` - PublishedBy string `json:"publishedBy,omitempty" bson:"published_by,omitempty"` - ArchivedAt time.Time `json:"archivedAt,omitempty" bson:"archived_at,omitempty"` - ArchivedBy string `json:"archivedBy,omitempty" bson:"archived_by,omitempty"` Permissions *Permissions `json:"permissions,omitempty" bson:"-"` // Флаги записи @@ -154,10 +150,6 @@ func (i *Item) ToMap() map[string]interface{} { "updated_at": i.UpdatedAt, "updated_by": i.UpdatedBy, "revision_id": i.RevisionID, - "published_at": i.PublishedAt, - "published_by": i.PublishedBy, - "archived_at": i.ArchivedAt, - "archived_by": i.ArchivedBy, "data": i.Data, "translations": i.Translations, "locale": i.Locale, @@ -316,10 +308,6 @@ func (i *Item) SetSystemField(field string, value interface{}) error { i.UpdatedAt, ok = value.(time.Time) case "revision_id": i.RevisionID, ok = value.(string) - case "published_by": - i.PublishedBy, ok = value.(string) - case "published_at": - i.PublishedAt, ok = value.(time.Time) case "hidden": i.Hidden, ok = value.(bool) case "deleted": @@ -360,10 +348,6 @@ func (i *Item) GetSystem(field string) (any, error) { return i.UpdatedAt, nil case "revision_id": return i.RevisionID, nil - case "published_by": - return i.PublishedBy, nil - case "published_at": - return i.PublishedAt, nil case "hidden": return i.Hidden, nil case "deleted": @@ -467,8 +451,6 @@ func ItemToProto(item *Item) *pb.Item { CreatedBy: item.CreatedBy, UpdatedBy: item.UpdatedBy, RevisionId: item.RevisionID, - PublishedBy: item.PublishedBy, - ArchivedBy: item.ArchivedBy, Locale: item.Locale, Hidden: item.Hidden, Template: item.Template, @@ -486,8 +468,6 @@ func ItemToProto(item *Item) *pb.Item { } protoItem.CreatedRevAt = timestamppb.New(item.CreatedRevAt) - protoItem.PublishedAt = timestamppb.New(item.PublishedAt) - protoItem.ArchivedAt = timestamppb.New(item.ArchivedAt) protoItem.CreatedAt = timestamppb.New(item.CreatedAt) protoItem.UpdatedAt = timestamppb.New(item.UpdatedAt) @@ -519,8 +499,6 @@ func ItemFromProto(protoItem *pb.Item) *Item { CreatedBy: protoItem.CreatedBy, UpdatedBy: protoItem.UpdatedBy, RevisionID: protoItem.RevisionId, - PublishedBy: protoItem.PublishedBy, - ArchivedBy: protoItem.ArchivedBy, Locale: protoItem.Locale, Hidden: protoItem.Hidden, Template: protoItem.Template, @@ -549,8 +527,6 @@ func ItemFromProto(protoItem *pb.Item) *Item { } item.CreatedRevAt = protoItem.CreatedRevAt.AsTime() - item.PublishedAt = protoItem.PublishedAt.AsTime() - item.ArchivedAt = protoItem.ArchivedAt.AsTime() item.CreatedAt = protoItem.CreatedAt.AsTime() item.UpdatedAt = protoItem.UpdatedAt.AsTime() diff --git a/pkg/items/mocks/ItemObserver.go b/pkg/items/mocks/ItemObserver.go index a72fb9b529eaf84c5da4c52fc2a62846f15cfb76..c4b4954c210235ff09677615cdffdcb2b2fa38b7 100644 --- a/pkg/items/mocks/ItemObserver.go +++ b/pkg/items/mocks/ItemObserver.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.15.0. DO NOT EDIT. +// Code generated by mockery v2.27.1. DO NOT EDIT. package mocks diff --git a/pkg/items/mocks/ItemReadObserver.go b/pkg/items/mocks/ItemReadObserver.go index b14c8aafee42dabc44999993c56144763e4bd96d..cdbc43d4ce043adce90daabeda427b8bd9f3d670 100644 --- a/pkg/items/mocks/ItemReadObserver.go +++ b/pkg/items/mocks/ItemReadObserver.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.15.0. DO NOT EDIT. +// Code generated by mockery v2.27.1. DO NOT EDIT. package mocks @@ -19,6 +19,11 @@ func (_m *ItemReadObserver) OnPostFind(ctx context.Context, _a1 []*items.Item, t ret := _m.Called(ctx, _a1, total) var r0 []*items.Item + var r1 int + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, []*items.Item, int) ([]*items.Item, int, error)); ok { + return rf(ctx, _a1, total) + } if rf, ok := ret.Get(0).(func(context.Context, []*items.Item, int) []*items.Item); ok { r0 = rf(ctx, _a1, total) } else { @@ -27,14 +32,12 @@ func (_m *ItemReadObserver) OnPostFind(ctx context.Context, _a1 []*items.Item, t } } - var r1 int if rf, ok := ret.Get(1).(func(context.Context, []*items.Item, int) int); ok { r1 = rf(ctx, _a1, total) } else { r1 = ret.Get(1).(int) } - var r2 error if rf, ok := ret.Get(2).(func(context.Context, []*items.Item, int) error); ok { r2 = rf(ctx, _a1, total) } else { @@ -49,6 +52,10 @@ func (_m *ItemReadObserver) OnPostGet(ctx context.Context, item *items.Item) (*i ret := _m.Called(ctx, item) var r0 *items.Item + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *items.Item) (*items.Item, error)); ok { + return rf(ctx, item) + } if rf, ok := ret.Get(0).(func(context.Context, *items.Item) *items.Item); ok { r0 = rf(ctx, item) } else { @@ -57,7 +64,6 @@ func (_m *ItemReadObserver) OnPostGet(ctx context.Context, item *items.Item) (*i } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *items.Item) error); ok { r1 = rf(ctx, item) } else { diff --git a/pkg/items/mocks/Items.go b/pkg/items/mocks/Items.go index 6ecfdeaacd17c7c9d0accf53c6f1817405e7da60..1f6833ff8ac1db35c895fc30cf50968a0fcb4349 100644 --- a/pkg/items/mocks/Items.go +++ b/pkg/items/mocks/Items.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.15.0. DO NOT EDIT. +// Code generated by mockery v2.27.1. DO NOT EDIT. package mocks @@ -28,6 +28,10 @@ func (_m *Items) Aggregate(ctx context.Context, spaceId string, envId string, co ret := _m.Called(_ca...) var r0 map[string]interface{} + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *items.Filter, ...*items.AggregateOptions) (map[string]interface{}, error)); ok { + return rf(ctx, spaceId, envId, collectionId, filter, options...) + } if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *items.Filter, ...*items.AggregateOptions) map[string]interface{}); ok { r0 = rf(ctx, spaceId, envId, collectionId, filter, options...) } else { @@ -36,7 +40,6 @@ func (_m *Items) Aggregate(ctx context.Context, spaceId string, envId string, co } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *items.Filter, ...*items.AggregateOptions) error); ok { r1 = rf(ctx, spaceId, envId, collectionId, filter, options...) } else { @@ -58,6 +61,10 @@ func (_m *Items) AggregatePublished(ctx context.Context, spaceId string, envId s ret := _m.Called(_ca...) var r0 map[string]interface{} + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *items.Filter, ...*items.AggregatePublishedOptions) (map[string]interface{}, error)); ok { + return rf(ctx, spaceId, envId, collectionId, filter, options...) + } if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *items.Filter, ...*items.AggregatePublishedOptions) map[string]interface{}); ok { r0 = rf(ctx, spaceId, envId, collectionId, filter, options...) } else { @@ -66,7 +73,6 @@ func (_m *Items) AggregatePublished(ctx context.Context, spaceId string, envId s } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *items.Filter, ...*items.AggregatePublishedOptions) error); ok { r1 = rf(ctx, spaceId, envId, collectionId, filter, options...) } else { @@ -109,6 +115,10 @@ func (_m *Items) Create(ctx context.Context, item *items.Item, opts ...*items.Cr ret := _m.Called(_ca...) var r0 *items.Item + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *items.Item, ...*items.CreateOptions) (*items.Item, error)); ok { + return rf(ctx, item, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *items.Item, ...*items.CreateOptions) *items.Item); ok { r0 = rf(ctx, item, opts...) } else { @@ -117,7 +127,6 @@ func (_m *Items) Create(ctx context.Context, item *items.Item, opts ...*items.Cr } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *items.Item, ...*items.CreateOptions) error); ok { r1 = rf(ctx, item, opts...) } else { @@ -160,6 +169,11 @@ func (_m *Items) Find(ctx context.Context, spaceId string, envId string, collect ret := _m.Called(_ca...) var r0 []*items.Item + var r1 int + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *items.Filter, ...*items.FindOptions) ([]*items.Item, int, error)); ok { + return rf(ctx, spaceId, envId, collectionId, filter, options...) + } if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *items.Filter, ...*items.FindOptions) []*items.Item); ok { r0 = rf(ctx, spaceId, envId, collectionId, filter, options...) } else { @@ -168,14 +182,12 @@ func (_m *Items) Find(ctx context.Context, spaceId string, envId string, collect } } - var r1 int if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *items.Filter, ...*items.FindOptions) int); ok { r1 = rf(ctx, spaceId, envId, collectionId, filter, options...) } else { r1 = ret.Get(1).(int) } - var r2 error if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *items.Filter, ...*items.FindOptions) error); ok { r2 = rf(ctx, spaceId, envId, collectionId, filter, options...) } else { @@ -197,6 +209,11 @@ func (_m *Items) FindArchived(ctx context.Context, spaceId string, envId string, ret := _m.Called(_ca...) var r0 []*items.Item + var r1 int + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *items.Filter, ...*items.FindArchivedOptions) ([]*items.Item, int, error)); ok { + return rf(ctx, spaceId, envId, collectionId, filter, options...) + } if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *items.Filter, ...*items.FindArchivedOptions) []*items.Item); ok { r0 = rf(ctx, spaceId, envId, collectionId, filter, options...) } else { @@ -205,14 +222,12 @@ func (_m *Items) FindArchived(ctx context.Context, spaceId string, envId string, } } - var r1 int if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *items.Filter, ...*items.FindArchivedOptions) int); ok { r1 = rf(ctx, spaceId, envId, collectionId, filter, options...) } else { r1 = ret.Get(1).(int) } - var r2 error if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *items.Filter, ...*items.FindArchivedOptions) error); ok { r2 = rf(ctx, spaceId, envId, collectionId, filter, options...) } else { @@ -234,6 +249,11 @@ func (_m *Items) FindPublished(ctx context.Context, spaceId string, envId string ret := _m.Called(_ca...) var r0 []*items.Item + var r1 int + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *items.Filter, ...*items.FindPublishedOptions) ([]*items.Item, int, error)); ok { + return rf(ctx, spaceId, envId, collectionId, filter, options...) + } if rf, ok := ret.Get(0).(func(context.Context, string, string, string, *items.Filter, ...*items.FindPublishedOptions) []*items.Item); ok { r0 = rf(ctx, spaceId, envId, collectionId, filter, options...) } else { @@ -242,14 +262,12 @@ func (_m *Items) FindPublished(ctx context.Context, spaceId string, envId string } } - var r1 int if rf, ok := ret.Get(1).(func(context.Context, string, string, string, *items.Filter, ...*items.FindPublishedOptions) int); ok { r1 = rf(ctx, spaceId, envId, collectionId, filter, options...) } else { r1 = ret.Get(1).(int) } - var r2 error if rf, ok := ret.Get(2).(func(context.Context, string, string, string, *items.Filter, ...*items.FindPublishedOptions) error); ok { r2 = rf(ctx, spaceId, envId, collectionId, filter, options...) } else { @@ -271,6 +289,10 @@ func (_m *Items) Get(ctx context.Context, spaceId string, envId string, collecti ret := _m.Called(_ca...) var r0 *items.Item + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, ...*items.GetOptions) (*items.Item, error)); ok { + return rf(ctx, spaceId, envId, collectionId, itemId, options...) + } if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, ...*items.GetOptions) *items.Item); ok { r0 = rf(ctx, spaceId, envId, collectionId, itemId, options...) } else { @@ -279,7 +301,6 @@ func (_m *Items) Get(ctx context.Context, spaceId string, envId string, collecti } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string, ...*items.GetOptions) error); ok { r1 = rf(ctx, spaceId, envId, collectionId, itemId, options...) } else { @@ -301,6 +322,10 @@ func (_m *Items) GetPublished(ctx context.Context, spaceId string, envId string, ret := _m.Called(_ca...) var r0 *items.Item + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, ...*items.GetPublishedOptions) (*items.Item, error)); ok { + return rf(ctx, spaceId, envId, collectionId, itemId, options...) + } if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, ...*items.GetPublishedOptions) *items.Item); ok { r0 = rf(ctx, spaceId, envId, collectionId, itemId, options...) } else { @@ -309,7 +334,6 @@ func (_m *Items) GetPublished(ctx context.Context, spaceId string, envId string, } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string, ...*items.GetPublishedOptions) error); ok { r1 = rf(ctx, spaceId, envId, collectionId, itemId, options...) } else { @@ -331,6 +355,10 @@ func (_m *Items) GetRevision(ctx context.Context, spaceId string, envId string, ret := _m.Called(_ca...) var r0 *items.Item + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, string, ...*items.GetRevisionOptions) (*items.Item, error)); ok { + return rf(ctx, spaceId, envId, collectionId, itemId, revisionId, options...) + } if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, string, ...*items.GetRevisionOptions) *items.Item); ok { r0 = rf(ctx, spaceId, envId, collectionId, itemId, revisionId, options...) } else { @@ -339,7 +367,6 @@ func (_m *Items) GetRevision(ctx context.Context, spaceId string, envId string, } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string, string, ...*items.GetRevisionOptions) error); ok { r1 = rf(ctx, spaceId, envId, collectionId, itemId, revisionId, options...) } else { @@ -361,6 +388,11 @@ func (_m *Items) Introspect(ctx context.Context, item *items.Item, opts ...*item ret := _m.Called(_ca...) var r0 *items.Item + var r1 *schema.Schema + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, *items.Item, ...*items.IntrospectOptions) (*items.Item, *schema.Schema, error)); ok { + return rf(ctx, item, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *items.Item, ...*items.IntrospectOptions) *items.Item); ok { r0 = rf(ctx, item, opts...) } else { @@ -369,7 +401,6 @@ func (_m *Items) Introspect(ctx context.Context, item *items.Item, opts ...*item } } - var r1 *schema.Schema if rf, ok := ret.Get(1).(func(context.Context, *items.Item, ...*items.IntrospectOptions) *schema.Schema); ok { r1 = rf(ctx, item, opts...) } else { @@ -378,7 +409,6 @@ func (_m *Items) Introspect(ctx context.Context, item *items.Item, opts ...*item } } - var r2 error if rf, ok := ret.Get(2).(func(context.Context, *items.Item, ...*items.IntrospectOptions) error); ok { r2 = rf(ctx, item, opts...) } else { @@ -400,6 +430,10 @@ func (_m *Items) ListRevisions(ctx context.Context, spaceId string, envId string ret := _m.Called(_ca...) var r0 []*items.Item + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, ...*items.ListRevisionsOptions) ([]*items.Item, error)); ok { + return rf(ctx, spaceId, envId, collectionId, itemId, options...) + } if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, ...*items.ListRevisionsOptions) []*items.Item); ok { r0 = rf(ctx, spaceId, envId, collectionId, itemId, options...) } else { @@ -408,7 +442,6 @@ func (_m *Items) ListRevisions(ctx context.Context, spaceId string, envId string } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string, ...*items.ListRevisionsOptions) error); ok { r1 = rf(ctx, spaceId, envId, collectionId, itemId, options...) } else { diff --git a/pkg/items/mocks/Middleware.go b/pkg/items/mocks/Middleware.go index 7830ca7447342c08772a78b63dbbe8ffbdc5591f..89adb97469b8df07f8acfc380339e5115ac21478 100644 --- a/pkg/items/mocks/Middleware.go +++ b/pkg/items/mocks/Middleware.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.15.0. DO NOT EDIT. +// Code generated by mockery v2.27.1. DO NOT EDIT. package mocks diff --git a/pkg/items/mocks/PreSaver.go b/pkg/items/mocks/PreSaver.go index 2a78120e30ea79dd3a73750dd409641f72304b73..eb4e0cc2831e523db94d2c6881fef15b0353dc92 100644 --- a/pkg/items/mocks/PreSaver.go +++ b/pkg/items/mocks/PreSaver.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.15.0. DO NOT EDIT. +// Code generated by mockery v2.27.1. DO NOT EDIT. package mocks @@ -21,6 +21,11 @@ func (_m *PreSaver) PreSave(ctx context.Context, f *field.Field, v interface{}, ret := _m.Called(ctx, f, v, itemCtx) var r0 interface{} + var r1 bool + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, *field.Field, interface{}, *items.Context) (interface{}, bool, error)); ok { + return rf(ctx, f, v, itemCtx) + } if rf, ok := ret.Get(0).(func(context.Context, *field.Field, interface{}, *items.Context) interface{}); ok { r0 = rf(ctx, f, v, itemCtx) } else { @@ -29,14 +34,12 @@ func (_m *PreSaver) PreSave(ctx context.Context, f *field.Field, v interface{}, } } - var r1 bool if rf, ok := ret.Get(1).(func(context.Context, *field.Field, interface{}, *items.Context) bool); ok { r1 = rf(ctx, f, v, itemCtx) } else { r1 = ret.Get(1).(bool) } - var r2 error if rf, ok := ret.Get(2).(func(context.Context, *field.Field, interface{}, *items.Context) error); ok { r2 = rf(ctx, f, v, itemCtx) } else { diff --git a/pkg/items/mocks/ProcessDataFunc.go b/pkg/items/mocks/ProcessDataFunc.go index 5aa99801f9ea5479de292a590c9ce27c79d25620..cb04ca90c304c51574dfdeb3a297bbd71fbbf80d 100644 --- a/pkg/items/mocks/ProcessDataFunc.go +++ b/pkg/items/mocks/ProcessDataFunc.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.15.0. DO NOT EDIT. +// Code generated by mockery v2.27.1. DO NOT EDIT. package mocks @@ -20,6 +20,10 @@ func (_m *ProcessDataFunc) Execute(ctx context.Context, sch *schema.Schema, data ret := _m.Called(ctx, sch, data) var r0 map[string]interface{} + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *schema.Schema, map[string]interface{}) (map[string]interface{}, error)); ok { + return rf(ctx, sch, data) + } if rf, ok := ret.Get(0).(func(context.Context, *schema.Schema, map[string]interface{}) map[string]interface{}); ok { r0 = rf(ctx, sch, data) } else { @@ -28,7 +32,6 @@ func (_m *ProcessDataFunc) Execute(ctx context.Context, sch *schema.Schema, data } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *schema.Schema, map[string]interface{}) error); ok { r1 = rf(ctx, sch, data) } else { diff --git a/pkg/items/mocks/Storage.go b/pkg/items/mocks/Storage.go index 9c502969ad292d0f99ad247394001ca0e8e29011..5630fc8b09c1a036a1580a6e1b85052ca93beecd 100644 --- a/pkg/items/mocks/Storage.go +++ b/pkg/items/mocks/Storage.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.15.0. DO NOT EDIT. +// Code generated by mockery v2.27.1. DO NOT EDIT. package mocks @@ -29,6 +29,10 @@ func (_m *Storage) Aggregate(ctx context.Context, coll *collections.Collection, ret := _m.Called(_ca...) var r0 map[string]interface{} + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *collections.Collection, *items.Filter, ...*items.AggregateOptions) (map[string]interface{}, error)); ok { + return rf(ctx, coll, filter, options...) + } if rf, ok := ret.Get(0).(func(context.Context, *collections.Collection, *items.Filter, ...*items.AggregateOptions) map[string]interface{}); ok { r0 = rf(ctx, coll, filter, options...) } else { @@ -37,7 +41,6 @@ func (_m *Storage) Aggregate(ctx context.Context, coll *collections.Collection, } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *collections.Collection, *items.Filter, ...*items.AggregateOptions) error); ok { r1 = rf(ctx, coll, filter, options...) } else { @@ -59,6 +62,10 @@ func (_m *Storage) AggregatePublished(ctx context.Context, coll *collections.Col ret := _m.Called(_ca...) var r0 map[string]interface{} + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *collections.Collection, *items.Filter, ...*items.AggregatePublishedOptions) (map[string]interface{}, error)); ok { + return rf(ctx, coll, filter, options...) + } if rf, ok := ret.Get(0).(func(context.Context, *collections.Collection, *items.Filter, ...*items.AggregatePublishedOptions) map[string]interface{}); ok { r0 = rf(ctx, coll, filter, options...) } else { @@ -67,7 +74,6 @@ func (_m *Storage) AggregatePublished(ctx context.Context, coll *collections.Col } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *collections.Collection, *items.Filter, ...*items.AggregatePublishedOptions) error); ok { r1 = rf(ctx, coll, filter, options...) } else { @@ -145,6 +151,10 @@ func (_m *Storage) Create(ctx context.Context, coll *collections.Collection, ite ret := _m.Called(_ca...) var r0 *items.Item + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *collections.Collection, *items.Item, ...*items.CreateOptions) (*items.Item, error)); ok { + return rf(ctx, coll, item, options...) + } if rf, ok := ret.Get(0).(func(context.Context, *collections.Collection, *items.Item, ...*items.CreateOptions) *items.Item); ok { r0 = rf(ctx, coll, item, options...) } else { @@ -153,7 +163,6 @@ func (_m *Storage) Create(ctx context.Context, coll *collections.Collection, ite } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *collections.Collection, *items.Item, ...*items.CreateOptions) error); ok { r1 = rf(ctx, coll, item, options...) } else { @@ -189,6 +198,11 @@ func (_m *Storage) Find(ctx context.Context, coll *collections.Collection, filte ret := _m.Called(_ca...) var r0 []*items.Item + var r1 int + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, *collections.Collection, *items.Filter, ...*items.FindOptions) ([]*items.Item, int, error)); ok { + return rf(ctx, coll, filter, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *collections.Collection, *items.Filter, ...*items.FindOptions) []*items.Item); ok { r0 = rf(ctx, coll, filter, opts...) } else { @@ -197,14 +211,12 @@ func (_m *Storage) Find(ctx context.Context, coll *collections.Collection, filte } } - var r1 int if rf, ok := ret.Get(1).(func(context.Context, *collections.Collection, *items.Filter, ...*items.FindOptions) int); ok { r1 = rf(ctx, coll, filter, opts...) } else { r1 = ret.Get(1).(int) } - var r2 error if rf, ok := ret.Get(2).(func(context.Context, *collections.Collection, *items.Filter, ...*items.FindOptions) error); ok { r2 = rf(ctx, coll, filter, opts...) } else { @@ -226,6 +238,11 @@ func (_m *Storage) FindArchived(ctx context.Context, coll *collections.Collectio ret := _m.Called(_ca...) var r0 []*items.Item + var r1 int + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, *collections.Collection, *items.Filter, ...*items.FindArchivedOptions) ([]*items.Item, int, error)); ok { + return rf(ctx, coll, filter, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *collections.Collection, *items.Filter, ...*items.FindArchivedOptions) []*items.Item); ok { r0 = rf(ctx, coll, filter, opts...) } else { @@ -234,14 +251,12 @@ func (_m *Storage) FindArchived(ctx context.Context, coll *collections.Collectio } } - var r1 int if rf, ok := ret.Get(1).(func(context.Context, *collections.Collection, *items.Filter, ...*items.FindArchivedOptions) int); ok { r1 = rf(ctx, coll, filter, opts...) } else { r1 = ret.Get(1).(int) } - var r2 error if rf, ok := ret.Get(2).(func(context.Context, *collections.Collection, *items.Filter, ...*items.FindArchivedOptions) error); ok { r2 = rf(ctx, coll, filter, opts...) } else { @@ -263,6 +278,11 @@ func (_m *Storage) FindPublished(ctx context.Context, coll *collections.Collecti ret := _m.Called(_ca...) var r0 []*items.Item + var r1 int + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, *collections.Collection, *items.Filter, ...*items.FindPublishedOptions) ([]*items.Item, int, error)); ok { + return rf(ctx, coll, filter, opts...) + } if rf, ok := ret.Get(0).(func(context.Context, *collections.Collection, *items.Filter, ...*items.FindPublishedOptions) []*items.Item); ok { r0 = rf(ctx, coll, filter, opts...) } else { @@ -271,14 +291,12 @@ func (_m *Storage) FindPublished(ctx context.Context, coll *collections.Collecti } } - var r1 int if rf, ok := ret.Get(1).(func(context.Context, *collections.Collection, *items.Filter, ...*items.FindPublishedOptions) int); ok { r1 = rf(ctx, coll, filter, opts...) } else { r1 = ret.Get(1).(int) } - var r2 error if rf, ok := ret.Get(2).(func(context.Context, *collections.Collection, *items.Filter, ...*items.FindPublishedOptions) error); ok { r2 = rf(ctx, coll, filter, opts...) } else { @@ -300,6 +318,10 @@ func (_m *Storage) GetRevision(ctx context.Context, coll *collections.Collection ret := _m.Called(_ca...) var r0 *items.Item + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *collections.Collection, string, string, ...*items.GetRevisionOptions) (*items.Item, error)); ok { + return rf(ctx, coll, itemId, revisionId, options...) + } if rf, ok := ret.Get(0).(func(context.Context, *collections.Collection, string, string, ...*items.GetRevisionOptions) *items.Item); ok { r0 = rf(ctx, coll, itemId, revisionId, options...) } else { @@ -308,7 +330,6 @@ func (_m *Storage) GetRevision(ctx context.Context, coll *collections.Collection } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *collections.Collection, string, string, ...*items.GetRevisionOptions) error); ok { r1 = rf(ctx, coll, itemId, revisionId, options...) } else { @@ -344,6 +365,10 @@ func (_m *Storage) ListRevisions(ctx context.Context, coll *collections.Collecti ret := _m.Called(_ca...) var r0 []*items.Item + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *collections.Collection, string, ...*items.ListRevisionsOptions) ([]*items.Item, error)); ok { + return rf(ctx, coll, itemId, options...) + } if rf, ok := ret.Get(0).(func(context.Context, *collections.Collection, string, ...*items.ListRevisionsOptions) []*items.Item); ok { r0 = rf(ctx, coll, itemId, options...) } else { @@ -352,7 +377,6 @@ func (_m *Storage) ListRevisions(ctx context.Context, coll *collections.Collecti } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, *collections.Collection, string, ...*items.ListRevisionsOptions) error); ok { r1 = rf(ctx, coll, itemId, options...) } else { diff --git a/pkg/roles/role.go b/pkg/roles/role.go index eecafb64135a8b4545fe7ef894529641ddbab69a..370470675cd40ae417d38b2ae8b8f7c4e7a63cfe 100644 --- a/pkg/roles/role.go +++ b/pkg/roles/role.go @@ -34,8 +34,8 @@ type Role struct { AllowManagement bool `json:"allow_management" bson:"allow_management"` } -func (r Role) CanAccessEnvironment(ctx context.Context, service environments.Environments, spaceID, envID string) bool { - if spaceID == "" || envID == "" { +func (r Role) CanAccessEnvironment(ctx context.Context, env *environments.Environment, service environments.Environments) bool { + if env.SpaceID == "" || env.ID == "" { return false } @@ -48,24 +48,24 @@ func (r Role) CanAccessEnvironment(ctx context.Context, service environments.Env r.Environments = []string{environments.DefaultEnvironment} } - for _, e := range r.Environments { - if envID == e || data.GlobMatch(envID, e) { + // Если окружение передано не полное, это означает, что надо его перезапросить + if env.Description == "" && env.Aliases == nil && env.StateInfo == nil { + if data.GlobMatch(env.ID, r.Environments...) { return true } - } - env, err := service.Get(ctx, spaceID, envID) - if err != nil || env == nil { - return false + var err error + env, err = service.Get(ctx, env.SpaceID, env.ID) + if err != nil || env == nil { + return false + } } aliases := append(env.Aliases, env.ID) - for _, e := range r.Environments { - for _, a := range aliases { - if a == e || data.GlobMatch(a, e) { - return true - } + for _, a := range aliases { + if data.GlobMatch(a, r.Environments...) { + return true } } diff --git a/pkg/auth/principal_test.go b/pkg/roles/role_test.go similarity index 83% rename from pkg/auth/principal_test.go rename to pkg/roles/role_test.go index 54e04ee4a8bf96151f9dfa9cf1edff0342ab03dd..ca794b1855cd96915dbe2002f144f3b907a50aa3 100644 --- a/pkg/auth/principal_test.go +++ b/pkg/roles/role_test.go @@ -1,4 +1,4 @@ -package auth +package roles import ( "context" @@ -6,16 +6,15 @@ import ( "git.perx.ru/perxis/perxis-go/pkg/environments" mocksenvs "git.perx.ru/perxis/perxis-go/pkg/environments/mocks" - "git.perx.ru/perxis/perxis-go/pkg/roles" "github.com/stretchr/testify/mock" ) -func Test_hasEnvironmentAccess(t *testing.T) { +func TestRoleCanAccessEnvironment(t *testing.T) { type args struct { ctx context.Context envscall func(envsservice *mocksenvs.Environments) - role *roles.Role - envID string + role *Role + env *environments.Environment } tests := []struct { name string @@ -26,13 +25,13 @@ func Test_hasEnvironmentAccess(t *testing.T) { name: "simple", args: args{ ctx: context.Background(), - role: &roles.Role{ + role: &Role{ ID: "1", SpaceID: "space", Description: "Current", Environments: []string{"env1", "env2"}, }, - envID: "env1", + env: &environments.Environment{ID: "env1", SpaceID: "sp"}, }, want: true, }, @@ -47,13 +46,13 @@ func Test_hasEnvironmentAccess(t *testing.T) { Aliases: []string{"master"}, }, nil).Once() }, - role: &roles.Role{ + role: &Role{ ID: "1", SpaceID: "space", Description: "Current", Environments: []string{"e*"}, }, - envID: "env", + env: &environments.Environment{ID: "env", SpaceID: "sp"}, }, want: true, }, @@ -68,13 +67,13 @@ func Test_hasEnvironmentAccess(t *testing.T) { Aliases: []string{"master"}, }, nil).Once() }, - role: &roles.Role{ + role: &Role{ ID: "1", SpaceID: "space", Description: "Current", Environments: []string{"*n*"}, }, - envID: "env", + env: &environments.Environment{ID: "env", SpaceID: "sp"}, }, want: true, }, @@ -89,13 +88,13 @@ func Test_hasEnvironmentAccess(t *testing.T) { Aliases: []string{"master"}, }, nil).Once() }, - role: &roles.Role{ + role: &Role{ ID: "1", SpaceID: "space", Description: "Current", Environments: []string{"*1"}, }, - envID: "env", + env: &environments.Environment{ID: "env", SpaceID: "sp"}, }, want: true, }, @@ -110,13 +109,13 @@ func Test_hasEnvironmentAccess(t *testing.T) { Aliases: []string{"master"}, }, nil).Once() }, - role: &roles.Role{ + role: &Role{ ID: "1", SpaceID: "space", Description: "Current", Environments: []string{"ma*"}, }, - envID: "env1", + env: &environments.Environment{ID: "env1", SpaceID: "sp"}, }, want: true, }, @@ -131,13 +130,13 @@ func Test_hasEnvironmentAccess(t *testing.T) { Aliases: []string{"master"}, }, nil).Once() }, - role: &roles.Role{ + role: &Role{ ID: "1", SpaceID: "space", Description: "Current", Environments: []string{"*"}, }, - envID: "env1", + env: &environments.Environment{ID: "env1", SpaceID: "sp"}, }, want: true, }, @@ -152,13 +151,13 @@ func Test_hasEnvironmentAccess(t *testing.T) { Aliases: []string{"master"}, }, nil).Once() }, - role: &roles.Role{ + role: &Role{ ID: "1", SpaceID: "space", Description: "Current", Environments: []string{"q*"}, }, - envID: "env1", + env: &environments.Environment{ID: "env1", SpaceID: "sp"}, }, want: false, }, @@ -170,7 +169,7 @@ func Test_hasEnvironmentAccess(t *testing.T) { tt.args.envscall(envsservice) } - if got := hasEnvironmentAccess(tt.args.ctx, envsservice, tt.args.role, tt.args.envID); got != tt.want { + if got := tt.args.role.CanAccessEnvironment(tt.args.ctx, tt.args.env, envsservice); got != tt.want { t.Errorf("hasEnvironmentAccess() = %v, want %v", got, tt.want) } }) diff --git a/proto/items/items.pb.go b/proto/items/items.pb.go index 161f7772531618b3e2eb9220f13931f04f560a0b..c334f0d43f428774856cfddcc36a59a4b834a91b 100644 --- a/proto/items/items.pb.go +++ b/proto/items/items.pb.go @@ -8,7 +8,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.29.0 +// protoc-gen-go v1.30.0 // protoc v3.21.12 // source: items/items.proto @@ -359,7 +359,7 @@ func (x *Permissions) GetHardDelete() bool { return false } -//* +// * // Пользовательская запись type Item struct { state protoimpl.MessageState @@ -379,10 +379,6 @@ type Item struct { Data *structpb.Struct `protobuf:"bytes,11,opt,name=data,proto3" json:"data,omitempty"` Translations map[string]*structpb.Struct `protobuf:"bytes,12,rep,name=translations,proto3" json:"translations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` RevisionId string `protobuf:"bytes,13,opt,name=revision_id,json=revisionId,proto3" json:"revision_id,omitempty"` - PublishedAt *timestamppb.Timestamp `protobuf:"bytes,14,opt,name=published_at,json=publishedAt,proto3" json:"published_at,omitempty"` - PublishedBy string `protobuf:"bytes,15,opt,name=published_by,json=publishedBy,proto3" json:"published_by,omitempty"` - ArchivedAt *timestamppb.Timestamp `protobuf:"bytes,16,opt,name=archived_at,json=archivedAt,proto3" json:"archived_at,omitempty"` - ArchivedBy string `protobuf:"bytes,17,opt,name=archived_by,json=archivedBy,proto3" json:"archived_by,omitempty"` Locale string `protobuf:"bytes,18,opt,name=locale,proto3" json:"locale,omitempty"` Deleted bool `protobuf:"varint,19,opt,name=deleted,proto3" json:"deleted,omitempty"` Hidden bool `protobuf:"varint,20,opt,name=hidden,proto3" json:"hidden,omitempty"` @@ -513,34 +509,6 @@ func (x *Item) GetRevisionId() string { return "" } -func (x *Item) GetPublishedAt() *timestamppb.Timestamp { - if x != nil { - return x.PublishedAt - } - return nil -} - -func (x *Item) GetPublishedBy() string { - if x != nil { - return x.PublishedBy - } - return "" -} - -func (x *Item) GetArchivedAt() *timestamppb.Timestamp { - if x != nil { - return x.ArchivedAt - } - return nil -} - -func (x *Item) GetArchivedBy() string { - if x != nil { - return x.ArchivedBy - } - return "" -} - func (x *Item) GetLocale() string { if x != nil { return x.Locale @@ -999,7 +967,7 @@ type CreateOptions struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UpdateAttrs bool `protobuf:"varint,1,opt,name=update_attrs,json=updateAttrs,proto3" json:"update_attrs,omitempty"` + UpdateAttrs bool `protobuf:"varint,1,opt,name=update_attrs,json=updateAttrs,proto3" json:"update_attrs,omitempty"` // позволяет обновить системные поля: created_by, created_at, created_rev_at, updated_by, updated_at } func (x *CreateOptions) Reset() { @@ -1125,7 +1093,7 @@ type UpdateOptions struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UpdateAttrs bool `protobuf:"varint,1,opt,name=update_attrs,json=updateAttrs,proto3" json:"update_attrs,omitempty"` + UpdateAttrs bool `protobuf:"varint,1,opt,name=update_attrs,json=updateAttrs,proto3" json:"update_attrs,omitempty"` // позволяет обновить системные поля: created_by, created_at, created_rev_at, updated_by, updated_at } func (x *UpdateOptions) Reset() { @@ -1219,8 +1187,8 @@ type DeleteOptions struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UpdateAttrs bool `protobuf:"varint,1,opt,name=update_attrs,json=updateAttrs,proto3" json:"update_attrs,omitempty"` - Erase bool `protobuf:"varint,2,opt,name=erase,proto3" json:"erase,omitempty"` + UpdateAttrs bool `protobuf:"varint,1,opt,name=update_attrs,json=updateAttrs,proto3" json:"update_attrs,omitempty"` // позволяет обновить системные поля: created_by, created_at, created_rev_at, updated_by, updated_at + Erase bool `protobuf:"varint,2,opt,name=erase,proto3" json:"erase,omitempty"` // полное удаление без сохранения удаленной версии объекта } func (x *DeleteOptions) Reset() { @@ -1274,7 +1242,7 @@ type UndeleteOptions struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UpdateAttrs bool `protobuf:"varint,1,opt,name=update_attrs,json=updateAttrs,proto3" json:"update_attrs,omitempty"` + UpdateAttrs bool `protobuf:"varint,1,opt,name=update_attrs,json=updateAttrs,proto3" json:"update_attrs,omitempty"` // позволяет обновить системные поля: created_by, created_at, created_rev_at, updated_by, updated_at } func (x *UndeleteOptions) Reset() { @@ -1321,7 +1289,7 @@ type PublishOptions struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UpdateAttrs bool `protobuf:"varint,1,opt,name=update_attrs,json=updateAttrs,proto3" json:"update_attrs,omitempty"` + UpdateAttrs bool `protobuf:"varint,1,opt,name=update_attrs,json=updateAttrs,proto3" json:"update_attrs,omitempty"` // позволяет обновить системные поля: created_by, created_at, created_rev_at, updated_by, updated_at } func (x *PublishOptions) Reset() { @@ -1368,7 +1336,7 @@ type UnpublishOptions struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UpdateAttrs bool `protobuf:"varint,1,opt,name=update_attrs,json=updateAttrs,proto3" json:"update_attrs,omitempty"` + UpdateAttrs bool `protobuf:"varint,1,opt,name=update_attrs,json=updateAttrs,proto3" json:"update_attrs,omitempty"` // позволяет обновить системные поля: created_by, created_at, created_rev_at, updated_by, updated_at } func (x *UnpublishOptions) Reset() { @@ -2212,7 +2180,7 @@ type DeleteRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Item *Item `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` + Item *Item `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` // важны только переданные внутри идентификаторы или, если указана опция update_attrs, поля которые изменяются: created_by, created_at, created_rev_at, updated_by, updated_at Options *DeleteOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` } @@ -2766,7 +2734,7 @@ func (x *AggregateRequest) GetOptions() *AggregateOptions { return nil } -//* +// * // Содержит в себе набор `название:значение`. Название соответствует переданному в AggregateOptions ключу. type AggregateResponse struct { state protoimpl.MessageState @@ -3193,7 +3161,7 @@ func (x *ListRevisionsResponse) GetItems() []*Item { return nil } -//* +// * // Запрос на архивирование элемента type ArchiveRequest struct { state protoimpl.MessageState @@ -3460,7 +3428,7 @@ var file_items_items_proto_rawDesc = []byte{ 0x6c, 0x65, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x73, 0x6f, 0x66, 0x74, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x68, 0x61, 0x72, 0x64, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x68, 0x61, 0x72, - 0x64, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x22, 0xa9, 0x08, 0x0a, 0x04, 0x49, 0x74, 0x65, 0x6d, + 0x64, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x22, 0xe9, 0x06, 0x0a, 0x04, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x65, @@ -3495,19 +3463,7 @@ var file_items_items_proto_rawDesc = []byte{ 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x76, - 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x3d, 0x0a, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, - 0x73, 0x68, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x6c, 0x69, - 0x73, 0x68, 0x65, 0x64, 0x41, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, - 0x68, 0x65, 0x64, 0x5f, 0x62, 0x79, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x75, - 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x42, 0x79, 0x12, 0x3b, 0x0a, 0x0b, 0x61, 0x72, 0x63, - 0x68, 0x69, 0x76, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x61, 0x72, 0x63, 0x68, - 0x69, 0x76, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, - 0x65, 0x64, 0x5f, 0x62, 0x79, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x72, 0x63, - 0x68, 0x69, 0x76, 0x65, 0x64, 0x42, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x13, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x69, 0x64, @@ -4055,97 +4011,95 @@ var file_items_items_proto_depIdxs = []int32{ 58, // 6: content.items.Item.updated_at:type_name -> google.protobuf.Timestamp 59, // 7: content.items.Item.data:type_name -> google.protobuf.Struct 55, // 8: content.items.Item.translations:type_name -> content.items.Item.TranslationsEntry - 58, // 9: content.items.Item.published_at:type_name -> google.protobuf.Timestamp - 58, // 10: content.items.Item.archived_at:type_name -> google.protobuf.Timestamp - 5, // 11: content.items.Item.permissions:type_name -> content.items.Permissions - 60, // 12: content.items.Filter.data:type_name -> common.Filter - 61, // 13: content.items.FindOptions.options:type_name -> common.FindOptions - 61, // 14: content.items.FindPublishedOptions.options:type_name -> common.FindOptions - 61, // 15: content.items.FindArchivedOptions.options:type_name -> common.FindOptions - 61, // 16: content.items.ListRevisionsOptions.options:type_name -> common.FindOptions - 56, // 17: content.items.AggregateOptions.fields:type_name -> content.items.AggregateOptions.FieldsEntry - 57, // 18: content.items.AggregatePublishedOptions.fields:type_name -> content.items.AggregatePublishedOptions.FieldsEntry - 6, // 19: content.items.CreateRequest.item:type_name -> content.items.Item - 13, // 20: content.items.CreateRequest.options:type_name -> content.items.CreateOptions - 6, // 21: content.items.CreateResponse.created:type_name -> content.items.Item - 6, // 22: content.items.IntrospectRequest.item:type_name -> content.items.Item - 6, // 23: content.items.IntrospectResponse.item:type_name -> content.items.Item - 62, // 24: content.items.IntrospectResponse.validation_errors:type_name -> common.Error.BadRequest.FieldViolation - 6, // 25: content.items.GetResponse.item:type_name -> content.items.Item - 12, // 26: content.items.FindRequest.filter:type_name -> content.items.Filter - 14, // 27: content.items.FindRequest.options:type_name -> content.items.FindOptions - 6, // 28: content.items.FindResponse.items:type_name -> content.items.Item - 6, // 29: content.items.UpdateRequest.item:type_name -> content.items.Item - 15, // 30: content.items.UpdateRequest.options:type_name -> content.items.UpdateOptions - 6, // 31: content.items.DeleteRequest.item:type_name -> content.items.Item - 17, // 32: content.items.DeleteRequest.options:type_name -> content.items.DeleteOptions - 6, // 33: content.items.UndeleteRequest.item:type_name -> content.items.Item - 18, // 34: content.items.UndeleteRequest.options:type_name -> content.items.UndeleteOptions - 6, // 35: content.items.PublishRequest.item:type_name -> content.items.Item - 19, // 36: content.items.PublishRequest.options:type_name -> content.items.PublishOptions - 6, // 37: content.items.UnpublishRequest.item:type_name -> content.items.Item - 20, // 38: content.items.UnpublishRequest.options:type_name -> content.items.UnpublishOptions - 16, // 39: content.items.GetPublishedRequest.options:type_name -> content.items.GetPublishedOptions - 6, // 40: content.items.GetPublishedResponse.item:type_name -> content.items.Item - 12, // 41: content.items.FindPublishedRequest.filter:type_name -> content.items.Filter - 21, // 42: content.items.FindPublishedRequest.options:type_name -> content.items.FindPublishedOptions - 6, // 43: content.items.FindPublishedResponse.items:type_name -> content.items.Item - 12, // 44: content.items.AggregateRequest.filter:type_name -> content.items.Filter - 24, // 45: content.items.AggregateRequest.options:type_name -> content.items.AggregateOptions - 59, // 46: content.items.AggregateResponse.result:type_name -> google.protobuf.Struct - 12, // 47: content.items.AggregatePublishedRequest.filter:type_name -> content.items.Filter - 25, // 48: content.items.AggregatePublishedRequest.options:type_name -> content.items.AggregatePublishedOptions - 59, // 49: content.items.AggregatePublishedResponse.result:type_name -> google.protobuf.Struct - 6, // 50: content.items.GetRevisionResponse.item:type_name -> content.items.Item - 23, // 51: content.items.ListRevisionsRequest.options:type_name -> content.items.ListRevisionsOptions - 6, // 52: content.items.ListRevisionsResponse.items:type_name -> content.items.Item - 6, // 53: content.items.ArchiveRequest.item:type_name -> content.items.Item - 6, // 54: content.items.UnarchiveRequest.item:type_name -> content.items.Item - 12, // 55: content.items.FindArchivedRequest.filter:type_name -> content.items.Filter - 22, // 56: content.items.FindArchivedRequest.options:type_name -> content.items.FindArchivedOptions - 6, // 57: content.items.FindArchivedResponse.items:type_name -> content.items.Item - 59, // 58: content.items.Item.TranslationsEntry.value:type_name -> google.protobuf.Struct - 26, // 59: content.items.Items.Create:input_type -> content.items.CreateRequest - 28, // 60: content.items.Items.Introspect:input_type -> content.items.IntrospectRequest - 30, // 61: content.items.Items.Get:input_type -> content.items.GetRequest - 32, // 62: content.items.Items.Find:input_type -> content.items.FindRequest - 34, // 63: content.items.Items.Update:input_type -> content.items.UpdateRequest - 35, // 64: content.items.Items.Delete:input_type -> content.items.DeleteRequest - 36, // 65: content.items.Items.Undelete:input_type -> content.items.UndeleteRequest - 37, // 66: content.items.Items.Publish:input_type -> content.items.PublishRequest - 38, // 67: content.items.Items.Unpublish:input_type -> content.items.UnpublishRequest - 39, // 68: content.items.Items.GetPublished:input_type -> content.items.GetPublishedRequest - 41, // 69: content.items.Items.FindPublished:input_type -> content.items.FindPublishedRequest - 43, // 70: content.items.Items.Aggregate:input_type -> content.items.AggregateRequest - 45, // 71: content.items.Items.AggregatePublished:input_type -> content.items.AggregatePublishedRequest - 47, // 72: content.items.Items.GetRevision:input_type -> content.items.GetRevisionRequest - 49, // 73: content.items.Items.ListRevisions:input_type -> content.items.ListRevisionsRequest - 51, // 74: content.items.Items.Archive:input_type -> content.items.ArchiveRequest - 53, // 75: content.items.Items.FindArchived:input_type -> content.items.FindArchivedRequest - 52, // 76: content.items.Items.Unarchive:input_type -> content.items.UnarchiveRequest - 27, // 77: content.items.Items.Create:output_type -> content.items.CreateResponse - 29, // 78: content.items.Items.Introspect:output_type -> content.items.IntrospectResponse - 31, // 79: content.items.Items.Get:output_type -> content.items.GetResponse - 33, // 80: content.items.Items.Find:output_type -> content.items.FindResponse - 63, // 81: content.items.Items.Update:output_type -> google.protobuf.Empty - 63, // 82: content.items.Items.Delete:output_type -> google.protobuf.Empty - 63, // 83: content.items.Items.Undelete:output_type -> google.protobuf.Empty - 63, // 84: content.items.Items.Publish:output_type -> google.protobuf.Empty - 63, // 85: content.items.Items.Unpublish:output_type -> google.protobuf.Empty - 40, // 86: content.items.Items.GetPublished:output_type -> content.items.GetPublishedResponse - 42, // 87: content.items.Items.FindPublished:output_type -> content.items.FindPublishedResponse - 44, // 88: content.items.Items.Aggregate:output_type -> content.items.AggregateResponse - 46, // 89: content.items.Items.AggregatePublished:output_type -> content.items.AggregatePublishedResponse - 48, // 90: content.items.Items.GetRevision:output_type -> content.items.GetRevisionResponse - 50, // 91: content.items.Items.ListRevisions:output_type -> content.items.ListRevisionsResponse - 63, // 92: content.items.Items.Archive:output_type -> google.protobuf.Empty - 54, // 93: content.items.Items.FindArchived:output_type -> content.items.FindArchivedResponse - 63, // 94: content.items.Items.Unarchive:output_type -> google.protobuf.Empty - 77, // [77:95] is the sub-list for method output_type - 59, // [59:77] is the sub-list for method input_type - 59, // [59:59] is the sub-list for extension type_name - 59, // [59:59] is the sub-list for extension extendee - 0, // [0:59] is the sub-list for field type_name + 5, // 9: content.items.Item.permissions:type_name -> content.items.Permissions + 60, // 10: content.items.Filter.data:type_name -> common.Filter + 61, // 11: content.items.FindOptions.options:type_name -> common.FindOptions + 61, // 12: content.items.FindPublishedOptions.options:type_name -> common.FindOptions + 61, // 13: content.items.FindArchivedOptions.options:type_name -> common.FindOptions + 61, // 14: content.items.ListRevisionsOptions.options:type_name -> common.FindOptions + 56, // 15: content.items.AggregateOptions.fields:type_name -> content.items.AggregateOptions.FieldsEntry + 57, // 16: content.items.AggregatePublishedOptions.fields:type_name -> content.items.AggregatePublishedOptions.FieldsEntry + 6, // 17: content.items.CreateRequest.item:type_name -> content.items.Item + 13, // 18: content.items.CreateRequest.options:type_name -> content.items.CreateOptions + 6, // 19: content.items.CreateResponse.created:type_name -> content.items.Item + 6, // 20: content.items.IntrospectRequest.item:type_name -> content.items.Item + 6, // 21: content.items.IntrospectResponse.item:type_name -> content.items.Item + 62, // 22: content.items.IntrospectResponse.validation_errors:type_name -> common.Error.BadRequest.FieldViolation + 6, // 23: content.items.GetResponse.item:type_name -> content.items.Item + 12, // 24: content.items.FindRequest.filter:type_name -> content.items.Filter + 14, // 25: content.items.FindRequest.options:type_name -> content.items.FindOptions + 6, // 26: content.items.FindResponse.items:type_name -> content.items.Item + 6, // 27: content.items.UpdateRequest.item:type_name -> content.items.Item + 15, // 28: content.items.UpdateRequest.options:type_name -> content.items.UpdateOptions + 6, // 29: content.items.DeleteRequest.item:type_name -> content.items.Item + 17, // 30: content.items.DeleteRequest.options:type_name -> content.items.DeleteOptions + 6, // 31: content.items.UndeleteRequest.item:type_name -> content.items.Item + 18, // 32: content.items.UndeleteRequest.options:type_name -> content.items.UndeleteOptions + 6, // 33: content.items.PublishRequest.item:type_name -> content.items.Item + 19, // 34: content.items.PublishRequest.options:type_name -> content.items.PublishOptions + 6, // 35: content.items.UnpublishRequest.item:type_name -> content.items.Item + 20, // 36: content.items.UnpublishRequest.options:type_name -> content.items.UnpublishOptions + 16, // 37: content.items.GetPublishedRequest.options:type_name -> content.items.GetPublishedOptions + 6, // 38: content.items.GetPublishedResponse.item:type_name -> content.items.Item + 12, // 39: content.items.FindPublishedRequest.filter:type_name -> content.items.Filter + 21, // 40: content.items.FindPublishedRequest.options:type_name -> content.items.FindPublishedOptions + 6, // 41: content.items.FindPublishedResponse.items:type_name -> content.items.Item + 12, // 42: content.items.AggregateRequest.filter:type_name -> content.items.Filter + 24, // 43: content.items.AggregateRequest.options:type_name -> content.items.AggregateOptions + 59, // 44: content.items.AggregateResponse.result:type_name -> google.protobuf.Struct + 12, // 45: content.items.AggregatePublishedRequest.filter:type_name -> content.items.Filter + 25, // 46: content.items.AggregatePublishedRequest.options:type_name -> content.items.AggregatePublishedOptions + 59, // 47: content.items.AggregatePublishedResponse.result:type_name -> google.protobuf.Struct + 6, // 48: content.items.GetRevisionResponse.item:type_name -> content.items.Item + 23, // 49: content.items.ListRevisionsRequest.options:type_name -> content.items.ListRevisionsOptions + 6, // 50: content.items.ListRevisionsResponse.items:type_name -> content.items.Item + 6, // 51: content.items.ArchiveRequest.item:type_name -> content.items.Item + 6, // 52: content.items.UnarchiveRequest.item:type_name -> content.items.Item + 12, // 53: content.items.FindArchivedRequest.filter:type_name -> content.items.Filter + 22, // 54: content.items.FindArchivedRequest.options:type_name -> content.items.FindArchivedOptions + 6, // 55: content.items.FindArchivedResponse.items:type_name -> content.items.Item + 59, // 56: content.items.Item.TranslationsEntry.value:type_name -> google.protobuf.Struct + 26, // 57: content.items.Items.Create:input_type -> content.items.CreateRequest + 28, // 58: content.items.Items.Introspect:input_type -> content.items.IntrospectRequest + 30, // 59: content.items.Items.Get:input_type -> content.items.GetRequest + 32, // 60: content.items.Items.Find:input_type -> content.items.FindRequest + 34, // 61: content.items.Items.Update:input_type -> content.items.UpdateRequest + 35, // 62: content.items.Items.Delete:input_type -> content.items.DeleteRequest + 36, // 63: content.items.Items.Undelete:input_type -> content.items.UndeleteRequest + 37, // 64: content.items.Items.Publish:input_type -> content.items.PublishRequest + 38, // 65: content.items.Items.Unpublish:input_type -> content.items.UnpublishRequest + 39, // 66: content.items.Items.GetPublished:input_type -> content.items.GetPublishedRequest + 41, // 67: content.items.Items.FindPublished:input_type -> content.items.FindPublishedRequest + 43, // 68: content.items.Items.Aggregate:input_type -> content.items.AggregateRequest + 45, // 69: content.items.Items.AggregatePublished:input_type -> content.items.AggregatePublishedRequest + 47, // 70: content.items.Items.GetRevision:input_type -> content.items.GetRevisionRequest + 49, // 71: content.items.Items.ListRevisions:input_type -> content.items.ListRevisionsRequest + 51, // 72: content.items.Items.Archive:input_type -> content.items.ArchiveRequest + 53, // 73: content.items.Items.FindArchived:input_type -> content.items.FindArchivedRequest + 52, // 74: content.items.Items.Unarchive:input_type -> content.items.UnarchiveRequest + 27, // 75: content.items.Items.Create:output_type -> content.items.CreateResponse + 29, // 76: content.items.Items.Introspect:output_type -> content.items.IntrospectResponse + 31, // 77: content.items.Items.Get:output_type -> content.items.GetResponse + 33, // 78: content.items.Items.Find:output_type -> content.items.FindResponse + 63, // 79: content.items.Items.Update:output_type -> google.protobuf.Empty + 63, // 80: content.items.Items.Delete:output_type -> google.protobuf.Empty + 63, // 81: content.items.Items.Undelete:output_type -> google.protobuf.Empty + 63, // 82: content.items.Items.Publish:output_type -> google.protobuf.Empty + 63, // 83: content.items.Items.Unpublish:output_type -> google.protobuf.Empty + 40, // 84: content.items.Items.GetPublished:output_type -> content.items.GetPublishedResponse + 42, // 85: content.items.Items.FindPublished:output_type -> content.items.FindPublishedResponse + 44, // 86: content.items.Items.Aggregate:output_type -> content.items.AggregateResponse + 46, // 87: content.items.Items.AggregatePublished:output_type -> content.items.AggregatePublishedResponse + 48, // 88: content.items.Items.GetRevision:output_type -> content.items.GetRevisionResponse + 50, // 89: content.items.Items.ListRevisions:output_type -> content.items.ListRevisionsResponse + 63, // 90: content.items.Items.Archive:output_type -> google.protobuf.Empty + 54, // 91: content.items.Items.FindArchived:output_type -> content.items.FindArchivedResponse + 63, // 92: content.items.Items.Unarchive:output_type -> google.protobuf.Empty + 75, // [75:93] is the sub-list for method output_type + 57, // [57:75] is the sub-list for method input_type + 57, // [57:57] is the sub-list for extension type_name + 57, // [57:57] is the sub-list for extension extendee + 0, // [0:57] is the sub-list for field type_name } func init() { file_items_items_proto_init() } diff --git a/proto/items/items_grpc.pb.go b/proto/items/items_grpc.pb.go index 08f6c91b7015e34ac5c765bc0f41496f801fb32c..7c7d321a9b1a57290a874dc8723679e9b6e755f2 100644 --- a/proto/items/items_grpc.pb.go +++ b/proto/items/items_grpc.pb.go @@ -1,3 +1,11 @@ +//* +// # Items +// +// API Сервиса работы с пользовательским записями (Items) +// +// Предоставляет доступ к записям пользовательских коллекций +// + // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 @@ -19,20 +27,41 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + Items_Create_FullMethodName = "/content.items.Items/Create" + Items_Introspect_FullMethodName = "/content.items.Items/Introspect" + Items_Get_FullMethodName = "/content.items.Items/Get" + Items_Find_FullMethodName = "/content.items.Items/Find" + Items_Update_FullMethodName = "/content.items.Items/Update" + Items_Delete_FullMethodName = "/content.items.Items/Delete" + Items_Undelete_FullMethodName = "/content.items.Items/Undelete" + Items_Publish_FullMethodName = "/content.items.Items/Publish" + Items_Unpublish_FullMethodName = "/content.items.Items/Unpublish" + Items_GetPublished_FullMethodName = "/content.items.Items/GetPublished" + Items_FindPublished_FullMethodName = "/content.items.Items/FindPublished" + Items_Aggregate_FullMethodName = "/content.items.Items/Aggregate" + Items_AggregatePublished_FullMethodName = "/content.items.Items/AggregatePublished" + Items_GetRevision_FullMethodName = "/content.items.Items/GetRevision" + Items_ListRevisions_FullMethodName = "/content.items.Items/ListRevisions" + Items_Archive_FullMethodName = "/content.items.Items/Archive" + Items_FindArchived_FullMethodName = "/content.items.Items/FindArchived" + Items_Unarchive_FullMethodName = "/content.items.Items/Unarchive" +) + // ItemsClient is the client API for Items service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type ItemsClient interface { - //* + // * // Создать запись Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) - //* + // * // Валидация данных записи Introspect(ctx context.Context, in *IntrospectRequest, opts ...grpc.CallOption) (*IntrospectResponse, error) - //* + // * // Получение записи по идентификатору Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) - //* + // * // Поиск по текущим записям Find(ctx context.Context, in *FindRequest, opts ...grpc.CallOption) (*FindResponse, error) Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) @@ -42,10 +71,10 @@ type ItemsClient interface { Unpublish(ctx context.Context, in *UnpublishRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) GetPublished(ctx context.Context, in *GetPublishedRequest, opts ...grpc.CallOption) (*GetPublishedResponse, error) FindPublished(ctx context.Context, in *FindPublishedRequest, opts ...grpc.CallOption) (*FindPublishedResponse, error) - //* + // * // Расчет значений по существующим данным. Например, получение среднего значения поля Aggregate(ctx context.Context, in *AggregateRequest, opts ...grpc.CallOption) (*AggregateResponse, error) - //* + // * // Расчет значений по существующим **опубликованным** данным. AggregatePublished(ctx context.Context, in *AggregatePublishedRequest, opts ...grpc.CallOption) (*AggregatePublishedResponse, error) GetRevision(ctx context.Context, in *GetRevisionRequest, opts ...grpc.CallOption) (*GetRevisionResponse, error) @@ -65,7 +94,7 @@ func NewItemsClient(cc grpc.ClientConnInterface) ItemsClient { func (c *itemsClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { out := new(CreateResponse) - err := c.cc.Invoke(ctx, "/content.items.Items/Create", in, out, opts...) + err := c.cc.Invoke(ctx, Items_Create_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -74,7 +103,7 @@ func (c *itemsClient) Create(ctx context.Context, in *CreateRequest, opts ...grp func (c *itemsClient) Introspect(ctx context.Context, in *IntrospectRequest, opts ...grpc.CallOption) (*IntrospectResponse, error) { out := new(IntrospectResponse) - err := c.cc.Invoke(ctx, "/content.items.Items/Introspect", in, out, opts...) + err := c.cc.Invoke(ctx, Items_Introspect_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -83,7 +112,7 @@ func (c *itemsClient) Introspect(ctx context.Context, in *IntrospectRequest, opt func (c *itemsClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { out := new(GetResponse) - err := c.cc.Invoke(ctx, "/content.items.Items/Get", in, out, opts...) + err := c.cc.Invoke(ctx, Items_Get_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -92,7 +121,7 @@ func (c *itemsClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.Call func (c *itemsClient) Find(ctx context.Context, in *FindRequest, opts ...grpc.CallOption) (*FindResponse, error) { out := new(FindResponse) - err := c.cc.Invoke(ctx, "/content.items.Items/Find", in, out, opts...) + err := c.cc.Invoke(ctx, Items_Find_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -101,7 +130,7 @@ func (c *itemsClient) Find(ctx context.Context, in *FindRequest, opts ...grpc.Ca func (c *itemsClient) Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/content.items.Items/Update", in, out, opts...) + err := c.cc.Invoke(ctx, Items_Update_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -110,7 +139,7 @@ func (c *itemsClient) Update(ctx context.Context, in *UpdateRequest, opts ...grp func (c *itemsClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/content.items.Items/Delete", in, out, opts...) + err := c.cc.Invoke(ctx, Items_Delete_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -119,7 +148,7 @@ func (c *itemsClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grp func (c *itemsClient) Undelete(ctx context.Context, in *UndeleteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/content.items.Items/Undelete", in, out, opts...) + err := c.cc.Invoke(ctx, Items_Undelete_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -128,7 +157,7 @@ func (c *itemsClient) Undelete(ctx context.Context, in *UndeleteRequest, opts .. func (c *itemsClient) Publish(ctx context.Context, in *PublishRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/content.items.Items/Publish", in, out, opts...) + err := c.cc.Invoke(ctx, Items_Publish_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -137,7 +166,7 @@ func (c *itemsClient) Publish(ctx context.Context, in *PublishRequest, opts ...g func (c *itemsClient) Unpublish(ctx context.Context, in *UnpublishRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/content.items.Items/Unpublish", in, out, opts...) + err := c.cc.Invoke(ctx, Items_Unpublish_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -146,7 +175,7 @@ func (c *itemsClient) Unpublish(ctx context.Context, in *UnpublishRequest, opts func (c *itemsClient) GetPublished(ctx context.Context, in *GetPublishedRequest, opts ...grpc.CallOption) (*GetPublishedResponse, error) { out := new(GetPublishedResponse) - err := c.cc.Invoke(ctx, "/content.items.Items/GetPublished", in, out, opts...) + err := c.cc.Invoke(ctx, Items_GetPublished_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -155,7 +184,7 @@ func (c *itemsClient) GetPublished(ctx context.Context, in *GetPublishedRequest, func (c *itemsClient) FindPublished(ctx context.Context, in *FindPublishedRequest, opts ...grpc.CallOption) (*FindPublishedResponse, error) { out := new(FindPublishedResponse) - err := c.cc.Invoke(ctx, "/content.items.Items/FindPublished", in, out, opts...) + err := c.cc.Invoke(ctx, Items_FindPublished_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -164,7 +193,7 @@ func (c *itemsClient) FindPublished(ctx context.Context, in *FindPublishedReques func (c *itemsClient) Aggregate(ctx context.Context, in *AggregateRequest, opts ...grpc.CallOption) (*AggregateResponse, error) { out := new(AggregateResponse) - err := c.cc.Invoke(ctx, "/content.items.Items/Aggregate", in, out, opts...) + err := c.cc.Invoke(ctx, Items_Aggregate_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -173,7 +202,7 @@ func (c *itemsClient) Aggregate(ctx context.Context, in *AggregateRequest, opts func (c *itemsClient) AggregatePublished(ctx context.Context, in *AggregatePublishedRequest, opts ...grpc.CallOption) (*AggregatePublishedResponse, error) { out := new(AggregatePublishedResponse) - err := c.cc.Invoke(ctx, "/content.items.Items/AggregatePublished", in, out, opts...) + err := c.cc.Invoke(ctx, Items_AggregatePublished_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -182,7 +211,7 @@ func (c *itemsClient) AggregatePublished(ctx context.Context, in *AggregatePubli func (c *itemsClient) GetRevision(ctx context.Context, in *GetRevisionRequest, opts ...grpc.CallOption) (*GetRevisionResponse, error) { out := new(GetRevisionResponse) - err := c.cc.Invoke(ctx, "/content.items.Items/GetRevision", in, out, opts...) + err := c.cc.Invoke(ctx, Items_GetRevision_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -191,7 +220,7 @@ func (c *itemsClient) GetRevision(ctx context.Context, in *GetRevisionRequest, o func (c *itemsClient) ListRevisions(ctx context.Context, in *ListRevisionsRequest, opts ...grpc.CallOption) (*ListRevisionsResponse, error) { out := new(ListRevisionsResponse) - err := c.cc.Invoke(ctx, "/content.items.Items/ListRevisions", in, out, opts...) + err := c.cc.Invoke(ctx, Items_ListRevisions_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -200,7 +229,7 @@ func (c *itemsClient) ListRevisions(ctx context.Context, in *ListRevisionsReques func (c *itemsClient) Archive(ctx context.Context, in *ArchiveRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/content.items.Items/Archive", in, out, opts...) + err := c.cc.Invoke(ctx, Items_Archive_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -209,7 +238,7 @@ func (c *itemsClient) Archive(ctx context.Context, in *ArchiveRequest, opts ...g func (c *itemsClient) FindArchived(ctx context.Context, in *FindArchivedRequest, opts ...grpc.CallOption) (*FindArchivedResponse, error) { out := new(FindArchivedResponse) - err := c.cc.Invoke(ctx, "/content.items.Items/FindArchived", in, out, opts...) + err := c.cc.Invoke(ctx, Items_FindArchived_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -218,7 +247,7 @@ func (c *itemsClient) FindArchived(ctx context.Context, in *FindArchivedRequest, func (c *itemsClient) Unarchive(ctx context.Context, in *UnarchiveRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/content.items.Items/Unarchive", in, out, opts...) + err := c.cc.Invoke(ctx, Items_Unarchive_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -229,16 +258,16 @@ func (c *itemsClient) Unarchive(ctx context.Context, in *UnarchiveRequest, opts // All implementations must embed UnimplementedItemsServer // for forward compatibility type ItemsServer interface { - //* + // * // Создать запись Create(context.Context, *CreateRequest) (*CreateResponse, error) - //* + // * // Валидация данных записи Introspect(context.Context, *IntrospectRequest) (*IntrospectResponse, error) - //* + // * // Получение записи по идентификатору Get(context.Context, *GetRequest) (*GetResponse, error) - //* + // * // Поиск по текущим записям Find(context.Context, *FindRequest) (*FindResponse, error) Update(context.Context, *UpdateRequest) (*emptypb.Empty, error) @@ -248,10 +277,10 @@ type ItemsServer interface { Unpublish(context.Context, *UnpublishRequest) (*emptypb.Empty, error) GetPublished(context.Context, *GetPublishedRequest) (*GetPublishedResponse, error) FindPublished(context.Context, *FindPublishedRequest) (*FindPublishedResponse, error) - //* + // * // Расчет значений по существующим данным. Например, получение среднего значения поля Aggregate(context.Context, *AggregateRequest) (*AggregateResponse, error) - //* + // * // Расчет значений по существующим **опубликованным** данным. AggregatePublished(context.Context, *AggregatePublishedRequest) (*AggregatePublishedResponse, error) GetRevision(context.Context, *GetRevisionRequest) (*GetRevisionResponse, error) @@ -343,7 +372,7 @@ func _Items_Create_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/content.items.Items/Create", + FullMethod: Items_Create_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ItemsServer).Create(ctx, req.(*CreateRequest)) @@ -361,7 +390,7 @@ func _Items_Introspect_Handler(srv interface{}, ctx context.Context, dec func(in } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/content.items.Items/Introspect", + FullMethod: Items_Introspect_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ItemsServer).Introspect(ctx, req.(*IntrospectRequest)) @@ -379,7 +408,7 @@ func _Items_Get_Handler(srv interface{}, ctx context.Context, dec func(interface } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/content.items.Items/Get", + FullMethod: Items_Get_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ItemsServer).Get(ctx, req.(*GetRequest)) @@ -397,7 +426,7 @@ func _Items_Find_Handler(srv interface{}, ctx context.Context, dec func(interfac } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/content.items.Items/Find", + FullMethod: Items_Find_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ItemsServer).Find(ctx, req.(*FindRequest)) @@ -415,7 +444,7 @@ func _Items_Update_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/content.items.Items/Update", + FullMethod: Items_Update_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ItemsServer).Update(ctx, req.(*UpdateRequest)) @@ -433,7 +462,7 @@ func _Items_Delete_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/content.items.Items/Delete", + FullMethod: Items_Delete_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ItemsServer).Delete(ctx, req.(*DeleteRequest)) @@ -451,7 +480,7 @@ func _Items_Undelete_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/content.items.Items/Undelete", + FullMethod: Items_Undelete_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ItemsServer).Undelete(ctx, req.(*UndeleteRequest)) @@ -469,7 +498,7 @@ func _Items_Publish_Handler(srv interface{}, ctx context.Context, dec func(inter } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/content.items.Items/Publish", + FullMethod: Items_Publish_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ItemsServer).Publish(ctx, req.(*PublishRequest)) @@ -487,7 +516,7 @@ func _Items_Unpublish_Handler(srv interface{}, ctx context.Context, dec func(int } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/content.items.Items/Unpublish", + FullMethod: Items_Unpublish_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ItemsServer).Unpublish(ctx, req.(*UnpublishRequest)) @@ -505,7 +534,7 @@ func _Items_GetPublished_Handler(srv interface{}, ctx context.Context, dec func( } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/content.items.Items/GetPublished", + FullMethod: Items_GetPublished_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ItemsServer).GetPublished(ctx, req.(*GetPublishedRequest)) @@ -523,7 +552,7 @@ func _Items_FindPublished_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/content.items.Items/FindPublished", + FullMethod: Items_FindPublished_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ItemsServer).FindPublished(ctx, req.(*FindPublishedRequest)) @@ -541,7 +570,7 @@ func _Items_Aggregate_Handler(srv interface{}, ctx context.Context, dec func(int } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/content.items.Items/Aggregate", + FullMethod: Items_Aggregate_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ItemsServer).Aggregate(ctx, req.(*AggregateRequest)) @@ -559,7 +588,7 @@ func _Items_AggregatePublished_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/content.items.Items/AggregatePublished", + FullMethod: Items_AggregatePublished_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ItemsServer).AggregatePublished(ctx, req.(*AggregatePublishedRequest)) @@ -577,7 +606,7 @@ func _Items_GetRevision_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/content.items.Items/GetRevision", + FullMethod: Items_GetRevision_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ItemsServer).GetRevision(ctx, req.(*GetRevisionRequest)) @@ -595,7 +624,7 @@ func _Items_ListRevisions_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/content.items.Items/ListRevisions", + FullMethod: Items_ListRevisions_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ItemsServer).ListRevisions(ctx, req.(*ListRevisionsRequest)) @@ -613,7 +642,7 @@ func _Items_Archive_Handler(srv interface{}, ctx context.Context, dec func(inter } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/content.items.Items/Archive", + FullMethod: Items_Archive_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ItemsServer).Archive(ctx, req.(*ArchiveRequest)) @@ -631,7 +660,7 @@ func _Items_FindArchived_Handler(srv interface{}, ctx context.Context, dec func( } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/content.items.Items/FindArchived", + FullMethod: Items_FindArchived_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ItemsServer).FindArchived(ctx, req.(*FindArchivedRequest)) @@ -649,7 +678,7 @@ func _Items_Unarchive_Handler(srv interface{}, ctx context.Context, dec func(int } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/content.items.Items/Unarchive", + FullMethod: Items_Unarchive_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ItemsServer).Unarchive(ctx, req.(*UnarchiveRequest))