refactor app and view can carry belongings

This commit is contained in:
appflowy 2021-07-29 22:22:35 +08:00
parent e67683abc7
commit 6a02520f84
45 changed files with 531 additions and 283 deletions

View File

@ -1,5 +1,6 @@
import 'package:app_flowy/startup/startup.dart'; import 'package:app_flowy/startup/startup.dart';
import 'package:flowy_infra/theme.dart'; import 'package:flowy_infra/theme.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:window_size/window_size.dart'; import 'package:window_size/window_size.dart';
@ -34,7 +35,7 @@ class ApplicationWidget extends StatelessWidget {
return Provider.value( return Provider.value(
value: theme, value: theme,
child: MaterialApp( child: MaterialApp(
title: 'AppFlowy', builder: overlayManagerBuilder(),
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
theme: theme.themeData, theme: theme.themeData,
navigatorKey: AppGlobals.rootNavKey, navigatorKey: AppGlobals.rootNavKey,

View File

@ -2,7 +2,10 @@ import 'package:flowy_sdk/protobuf/flowy-workspace/protobuf.dart';
import 'package:dartz/dartz.dart'; import 'package:dartz/dartz.dart';
typedef AppUpdatedCallback = void Function(String name, String desc); typedef AppUpdatedCallback = void Function(String name, String desc);
typedef AppAddViewCallback = void Function( typedef AppCreateViewCallback = void Function(
Either<List<View>, WorkspaceError> viewsOrFailed);
typedef AppDeleteViewCallback = void Function(
Either<List<View>, WorkspaceError> viewsOrFailed); Either<List<View>, WorkspaceError> viewsOrFailed);
abstract class IApp { abstract class IApp {
@ -14,7 +17,7 @@ abstract class IApp {
abstract class IAppWatch { abstract class IAppWatch {
void startWatching( void startWatching(
{AppAddViewCallback? addViewCallback, {AppCreateViewCallback? addViewCallback,
AppUpdatedCallback? updatedCallback}); AppUpdatedCallback? updatedCallback});
Future<void> stopWatching(); Future<void> stopWatching();

View File

@ -1,10 +1,14 @@
import 'package:flowy_sdk/protobuf/flowy-workspace/protobuf.dart'; import 'package:flowy_sdk/protobuf/flowy-workspace/protobuf.dart';
import 'package:dartz/dartz.dart'; import 'package:dartz/dartz.dart';
typedef WorkspaceAddAppCallback = void Function( typedef WorkspaceCreateAppCallback = void Function(
Either<List<App>, WorkspaceError> appsOrFail); Either<List<App>, WorkspaceError> appsOrFail);
typedef WorkspaceUpdatedCallback = void Function(String name, String desc); typedef WorkspaceUpdatedCallback = void Function(String name, String desc);
typedef WorkspaceDeleteAppCallback = void Function(
Either<List<App>, WorkspaceError> appsOrFail);
abstract class IWorkspace { abstract class IWorkspace {
Future<Either<App, WorkspaceError>> createApp( Future<Either<App, WorkspaceError>> createApp(
{required String name, String? desc}); {required String name, String? desc});
@ -14,7 +18,7 @@ abstract class IWorkspace {
abstract class IWorkspaceWatch { abstract class IWorkspaceWatch {
void startWatching( void startWatching(
{WorkspaceAddAppCallback? addAppCallback, {WorkspaceCreateAppCallback? addAppCallback,
WorkspaceUpdatedCallback? updatedCallback}); WorkspaceUpdatedCallback? updatedCallback});
Future<void> stopWatching(); Future<void> stopWatching();

View File

@ -51,10 +51,9 @@ class IAppWatchImpl extends IAppWatch {
@override @override
void startWatching( void startWatching(
{AppAddViewCallback? addViewCallback, {AppCreateViewCallback? addViewCallback,
AppUpdatedCallback? updatedCallback}) { AppUpdatedCallback? updatedCallback}) {
repo.startWatching( repo.startWatching(createView: addViewCallback, update: updatedCallback);
addViewCallback: addViewCallback, updatedCallback: updatedCallback);
} }
@override @override

View File

@ -23,7 +23,7 @@ class IViewWatchImpl extends IViewWatch {
@override @override
void startWatching({ViewUpdatedCallback? updatedCallback}) { void startWatching({ViewUpdatedCallback? updatedCallback}) {
repo.startWatching(updatedCallback: updatedCallback); repo.startWatching(update: updatedCallback);
} }
@override @override

View File

@ -37,10 +37,9 @@ class IWorkspaceWatchImpl extends IWorkspaceWatch {
@override @override
void startWatching( void startWatching(
{WorkspaceAddAppCallback? addAppCallback, {WorkspaceCreateAppCallback? addAppCallback,
WorkspaceUpdatedCallback? updatedCallback}) { WorkspaceUpdatedCallback? updatedCallback}) {
repo.startWatching( repo.startWatching(createApp: addAppCallback, update: updatedCallback);
addAppCallback: addAppCallback, updatedCallback: updatedCallback);
} }
@override @override

View File

@ -21,7 +21,7 @@ class AppRepository {
Future<Either<App, WorkspaceError>> getAppDesc() { Future<Either<App, WorkspaceError>> getAppDesc() {
final request = QueryAppRequest.create() final request = QueryAppRequest.create()
..appId = appId ..appId = appId
..readViews = false; ..readBelongings = false;
return WorkspaceEventReadApp(request).send(); return WorkspaceEventReadApp(request).send();
} }
@ -40,11 +40,11 @@ class AppRepository {
Future<Either<List<View>, WorkspaceError>> getViews() { Future<Either<List<View>, WorkspaceError>> getViews() {
final request = QueryAppRequest.create() final request = QueryAppRequest.create()
..appId = appId ..appId = appId
..readViews = true; ..readBelongings = true;
return WorkspaceEventReadApp(request).send().then((result) { return WorkspaceEventReadApp(request).send().then((result) {
return result.fold( return result.fold(
(app) => left(app.views.items), (app) => left(app.belongings.items),
(error) => right(error), (error) => right(error),
); );
}); });
@ -53,8 +53,9 @@ class AppRepository {
class AppWatchRepository { class AppWatchRepository {
StreamSubscription<ObservableSubject>? _subscription; StreamSubscription<ObservableSubject>? _subscription;
AppAddViewCallback? _addViewCallback; AppCreateViewCallback? _createView;
AppUpdatedCallback? _updatedCallback; AppDeleteViewCallback? _deleteView;
AppUpdatedCallback? _update;
String appId; String appId;
late AppRepository _repo; late AppRepository _repo;
AppWatchRepository({ AppWatchRepository({
@ -64,10 +65,12 @@ class AppWatchRepository {
} }
void startWatching( void startWatching(
{AppAddViewCallback? addViewCallback, {AppCreateViewCallback? createView,
AppUpdatedCallback? updatedCallback}) { AppDeleteViewCallback? deleteView,
_addViewCallback = addViewCallback; AppUpdatedCallback? update}) {
_updatedCallback = updatedCallback; _createView = createView;
_deleteView = deleteView;
_update = update;
_subscription = RustStreamReceiver.listen((observable) { _subscription = RustStreamReceiver.listen((observable) {
if (observable.subjectId != appId) { if (observable.subjectId != appId) {
return; return;
@ -82,24 +85,35 @@ class AppWatchRepository {
void _handleObservableType(WorkspaceObservable ty) { void _handleObservableType(WorkspaceObservable ty) {
switch (ty) { switch (ty) {
case WorkspaceObservable.AppAddView: case WorkspaceObservable.AppCreateView:
if (_addViewCallback == null) { if (_createView == null) {
return; return;
} }
_repo.getViews().then((result) { _repo.getViews().then((result) {
result.fold( result.fold(
(views) => _addViewCallback!(left(views)), (views) => _createView!(left(views)),
(error) => _addViewCallback!(right(error)), (error) => _createView!(right(error)),
); );
}); });
break; break;
case WorkspaceObservable.AppUpdateDesc: case WorkspaceObservable.AppDeleteView:
if (_updatedCallback == null) { if (_deleteView == null) {
return;
}
_repo.getViews().then((result) {
result.fold(
(views) => _deleteView!(left(views)),
(error) => _deleteView!(right(error)),
);
});
break;
case WorkspaceObservable.AppUpdated:
if (_update == null) {
return; return;
} }
_repo.getAppDesc().then((result) { _repo.getAppDesc().then((result) {
result.fold( result.fold(
(app) => _updatedCallback!(app.name, app.desc), (app) => _update!(app.name, app.desc),
(error) => Log.error(error), (error) => Log.error(error),
); );
}); });

View File

@ -26,7 +26,7 @@ class ViewRepository {
class ViewWatchRepository { class ViewWatchRepository {
StreamSubscription<ObservableSubject>? _subscription; StreamSubscription<ObservableSubject>? _subscription;
ViewUpdatedCallback? _updatedCallback; ViewUpdatedCallback? _update;
View view; View view;
late ViewRepository _repo; late ViewRepository _repo;
ViewWatchRepository({ ViewWatchRepository({
@ -36,9 +36,9 @@ class ViewWatchRepository {
} }
void startWatching({ void startWatching({
ViewUpdatedCallback? updatedCallback, ViewUpdatedCallback? update,
}) { }) {
_updatedCallback = updatedCallback; _update = update;
_subscription = RustStreamReceiver.listen((observable) { _subscription = RustStreamReceiver.listen((observable) {
if (observable.subjectId != view.id) { if (observable.subjectId != view.id) {
return; return;
@ -53,13 +53,13 @@ class ViewWatchRepository {
void _handleObservableType(WorkspaceObservable ty) { void _handleObservableType(WorkspaceObservable ty) {
switch (ty) { switch (ty) {
case WorkspaceObservable.ViewUpdateDesc: case WorkspaceObservable.ViewUpdated:
if (_updatedCallback == null) { if (_update == null) {
return; return;
} }
_repo.readView().then((result) { _repo.readView().then((result) {
result.fold( result.fold(
(view) => _updatedCallback!(view), (view) => _update!(view),
(error) => Log.error(error), (error) => Log.error(error),
); );
}); });

View File

@ -53,8 +53,9 @@ class WorkspaceRepo {
class WorkspaceWatchRepo { class WorkspaceWatchRepo {
StreamSubscription<ObservableSubject>? _subscription; StreamSubscription<ObservableSubject>? _subscription;
WorkspaceAddAppCallback? _addAppCallback; WorkspaceCreateAppCallback? _createApp;
WorkspaceUpdatedCallback? _updatedCallback; WorkspaceDeleteAppCallback? _deleteApp;
WorkspaceUpdatedCallback? _update;
final UserDetail user; final UserDetail user;
late WorkspaceRepo _repo; late WorkspaceRepo _repo;
@ -64,11 +65,14 @@ class WorkspaceWatchRepo {
_repo = WorkspaceRepo(user: user); _repo = WorkspaceRepo(user: user);
} }
void startWatching( void startWatching({
{WorkspaceAddAppCallback? addAppCallback, WorkspaceCreateAppCallback? createApp,
WorkspaceUpdatedCallback? updatedCallback}) { WorkspaceDeleteAppCallback? deleteApp,
_addAppCallback = addAppCallback; WorkspaceUpdatedCallback? update,
_updatedCallback = updatedCallback; }) {
_createApp = createApp;
_deleteApp = deleteApp;
_update = update;
_subscription = RustStreamReceiver.listen((observable) { _subscription = RustStreamReceiver.listen((observable) {
if (observable.subjectId != user.workspace) { if (observable.subjectId != user.workspace) {
@ -84,25 +88,36 @@ class WorkspaceWatchRepo {
void _handleObservableType(WorkspaceObservable ty) { void _handleObservableType(WorkspaceObservable ty) {
switch (ty) { switch (ty) {
case WorkspaceObservable.WorkspaceUpdateDesc: case WorkspaceObservable.WorkspaceUpdated:
if (_updatedCallback == null) { if (_update == null) {
return; return;
} }
_repo.getWorkspace().then((result) { _repo.getWorkspace().then((result) {
result.fold( result.fold(
(workspace) => _updatedCallback!(workspace.name, workspace.desc), (workspace) => _update!(workspace.name, workspace.desc),
(error) => Log.error(error), (error) => Log.error(error),
); );
}); });
break; break;
case WorkspaceObservable.WorkspaceAddApp: case WorkspaceObservable.WorkspaceCreateApp:
if (_addAppCallback == null) { if (_createApp == null) {
return; return;
} }
_repo.getWorkspace(readApps: true).then((result) { _repo.getWorkspace(readApps: true).then((result) {
result.fold( result.fold(
(workspace) => _addAppCallback!(left(workspace.apps.items)), (workspace) => _createApp!(left(workspace.apps.items)),
(error) => _addAppCallback!(right(error)), (error) => _createApp!(right(error)),
);
});
break;
case WorkspaceObservable.WorkspaceDeleteApp:
if (_deleteApp == null) {
return;
}
_repo.getWorkspace(readApps: true).then((result) {
result.fold(
(workspace) => _deleteApp!(left(workspace.apps.items)),
(error) => _deleteApp!(right(error)),
); );
}); });
break; break;

View File

@ -1,5 +1,6 @@
import 'package:app_flowy/workspace/application/app/app_bloc.dart'; import 'package:app_flowy/workspace/application/app/app_bloc.dart';
import 'package:expandable/expandable.dart'; import 'package:expandable/expandable.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flowy_infra_ui/style_widget/icon_button.dart'; import 'package:flowy_infra_ui/style_widget/icon_button.dart';
import 'package:flowy_infra_ui/widget/spacing.dart'; import 'package:flowy_infra_ui/widget/spacing.dart';
import 'package:flowy_infra_ui/style_widget/text_button.dart'; import 'package:flowy_infra_ui/style_widget/text_button.dart';
@ -45,7 +46,7 @@ class AppHeader extends StatelessWidget {
child: FlowyTextButton( child: FlowyTextButton(
app.name, app.name,
onPressed: () { onPressed: () {
debugPrint('show app document'); debugPrint('show app');
}, },
), ),
), ),
@ -53,6 +54,8 @@ class AppHeader extends StatelessWidget {
// icon: const Icon(Icons.add), // icon: const Icon(Icons.add),
// onPressed: () { // onPressed: () {
// debugPrint('add view'); // debugPrint('add view');
// FlowyOverlay.of(context)
// .insert(widget: Text('test'), identifier: 'identifier');
// }, // },
// ), // ),
PopupMenuButton( PopupMenuButton(

View File

@ -156,7 +156,7 @@ class App extends $pb.GeneratedMessage {
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'workspaceId') ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'workspaceId')
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc') ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc')
..aOM<$0.RepeatedView>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'views', subBuilder: $0.RepeatedView.create) ..aOM<$0.RepeatedView>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'belongings', subBuilder: $0.RepeatedView.create)
..aInt64(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'version') ..aInt64(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'version')
..hasRequiredFields = false ..hasRequiredFields = false
; ;
@ -167,7 +167,7 @@ class App extends $pb.GeneratedMessage {
$core.String? workspaceId, $core.String? workspaceId,
$core.String? name, $core.String? name,
$core.String? desc, $core.String? desc,
$0.RepeatedView? views, $0.RepeatedView? belongings,
$fixnum.Int64? version, $fixnum.Int64? version,
}) { }) {
final _result = create(); final _result = create();
@ -183,8 +183,8 @@ class App extends $pb.GeneratedMessage {
if (desc != null) { if (desc != null) {
_result.desc = desc; _result.desc = desc;
} }
if (views != null) { if (belongings != null) {
_result.views = views; _result.belongings = belongings;
} }
if (version != null) { if (version != null) {
_result.version = version; _result.version = version;
@ -249,15 +249,15 @@ class App extends $pb.GeneratedMessage {
void clearDesc() => clearField(4); void clearDesc() => clearField(4);
@$pb.TagNumber(5) @$pb.TagNumber(5)
$0.RepeatedView get views => $_getN(4); $0.RepeatedView get belongings => $_getN(4);
@$pb.TagNumber(5) @$pb.TagNumber(5)
set views($0.RepeatedView v) { setField(5, v); } set belongings($0.RepeatedView v) { setField(5, v); }
@$pb.TagNumber(5) @$pb.TagNumber(5)
$core.bool hasViews() => $_has(4); $core.bool hasBelongings() => $_has(4);
@$pb.TagNumber(5) @$pb.TagNumber(5)
void clearViews() => clearField(5); void clearBelongings() => clearField(5);
@$pb.TagNumber(5) @$pb.TagNumber(5)
$0.RepeatedView ensureViews() => $_ensure(4); $0.RepeatedView ensureBelongings() => $_ensure(4);
@$pb.TagNumber(6) @$pb.TagNumber(6)
$fixnum.Int64 get version => $_getI64(5); $fixnum.Int64 get version => $_getI64(5);

View File

@ -39,13 +39,13 @@ const App$json = const {
const {'1': 'workspace_id', '3': 2, '4': 1, '5': 9, '10': 'workspaceId'}, const {'1': 'workspace_id', '3': 2, '4': 1, '5': 9, '10': 'workspaceId'},
const {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'}, const {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'},
const {'1': 'desc', '3': 4, '4': 1, '5': 9, '10': 'desc'}, const {'1': 'desc', '3': 4, '4': 1, '5': 9, '10': 'desc'},
const {'1': 'views', '3': 5, '4': 1, '5': 11, '6': '.RepeatedView', '10': 'views'}, const {'1': 'belongings', '3': 5, '4': 1, '5': 11, '6': '.RepeatedView', '10': 'belongings'},
const {'1': 'version', '3': 6, '4': 1, '5': 3, '10': 'version'}, const {'1': 'version', '3': 6, '4': 1, '5': 3, '10': 'version'},
], ],
}; };
/// Descriptor for `App`. Decode as a `google.protobuf.DescriptorProto`. /// Descriptor for `App`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List appDescriptor = $convert.base64Decode('CgNBcHASDgoCaWQYASABKAlSAmlkEiEKDHdvcmtzcGFjZV9pZBgCIAEoCVILd29ya3NwYWNlSWQSEgoEbmFtZRgDIAEoCVIEbmFtZRISCgRkZXNjGAQgASgJUgRkZXNjEiMKBXZpZXdzGAUgASgLMg0uUmVwZWF0ZWRWaWV3UgV2aWV3cxIYCgd2ZXJzaW9uGAYgASgDUgd2ZXJzaW9u'); final $typed_data.Uint8List appDescriptor = $convert.base64Decode('CgNBcHASDgoCaWQYASABKAlSAmlkEiEKDHdvcmtzcGFjZV9pZBgCIAEoCVILd29ya3NwYWNlSWQSEgoEbmFtZRgDIAEoCVIEbmFtZRISCgRkZXNjGAQgASgJUgRkZXNjEi0KCmJlbG9uZ2luZ3MYBSABKAsyDS5SZXBlYXRlZFZpZXdSCmJlbG9uZ2luZ3MSGAoHdmVyc2lvbhgGIAEoA1IHdmVyc2lvbg==');
@$core.Deprecated('Use repeatedAppDescriptor instead') @$core.Deprecated('Use repeatedAppDescriptor instead')
const RepeatedApp$json = const { const RepeatedApp$json = const {
'1': 'RepeatedApp', '1': 'RepeatedApp',

View File

@ -12,7 +12,7 @@ import 'package:protobuf/protobuf.dart' as $pb;
class QueryAppRequest extends $pb.GeneratedMessage { class QueryAppRequest extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'QueryAppRequest', createEmptyInstance: create) static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'QueryAppRequest', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'appId') ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'appId')
..aOB(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'readViews') ..aOB(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'readBelongings')
..aOB(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'isTrash') ..aOB(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'isTrash')
..hasRequiredFields = false ..hasRequiredFields = false
; ;
@ -20,15 +20,15 @@ class QueryAppRequest extends $pb.GeneratedMessage {
QueryAppRequest._() : super(); QueryAppRequest._() : super();
factory QueryAppRequest({ factory QueryAppRequest({
$core.String? appId, $core.String? appId,
$core.bool? readViews, $core.bool? readBelongings,
$core.bool? isTrash, $core.bool? isTrash,
}) { }) {
final _result = create(); final _result = create();
if (appId != null) { if (appId != null) {
_result.appId = appId; _result.appId = appId;
} }
if (readViews != null) { if (readBelongings != null) {
_result.readViews = readViews; _result.readBelongings = readBelongings;
} }
if (isTrash != null) { if (isTrash != null) {
_result.isTrash = isTrash; _result.isTrash = isTrash;
@ -66,13 +66,13 @@ class QueryAppRequest extends $pb.GeneratedMessage {
void clearAppId() => clearField(1); void clearAppId() => clearField(1);
@$pb.TagNumber(2) @$pb.TagNumber(2)
$core.bool get readViews => $_getBF(1); $core.bool get readBelongings => $_getBF(1);
@$pb.TagNumber(2) @$pb.TagNumber(2)
set readViews($core.bool v) { $_setBool(1, v); } set readBelongings($core.bool v) { $_setBool(1, v); }
@$pb.TagNumber(2) @$pb.TagNumber(2)
$core.bool hasReadViews() => $_has(1); $core.bool hasReadBelongings() => $_has(1);
@$pb.TagNumber(2) @$pb.TagNumber(2)
void clearReadViews() => clearField(2); void clearReadBelongings() => clearField(2);
@$pb.TagNumber(3) @$pb.TagNumber(3)
$core.bool get isTrash => $_getBF(2); $core.bool get isTrash => $_getBF(2);

View File

@ -13,10 +13,10 @@ const QueryAppRequest$json = const {
'1': 'QueryAppRequest', '1': 'QueryAppRequest',
'2': const [ '2': const [
const {'1': 'app_id', '3': 1, '4': 1, '5': 9, '10': 'appId'}, const {'1': 'app_id', '3': 1, '4': 1, '5': 9, '10': 'appId'},
const {'1': 'read_views', '3': 2, '4': 1, '5': 8, '10': 'readViews'}, const {'1': 'read_belongings', '3': 2, '4': 1, '5': 8, '10': 'readBelongings'},
const {'1': 'is_trash', '3': 3, '4': 1, '5': 8, '10': 'isTrash'}, const {'1': 'is_trash', '3': 3, '4': 1, '5': 8, '10': 'isTrash'},
], ],
}; };
/// Descriptor for `QueryAppRequest`. Decode as a `google.protobuf.DescriptorProto`. /// Descriptor for `QueryAppRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List queryAppRequestDescriptor = $convert.base64Decode('Cg9RdWVyeUFwcFJlcXVlc3QSFQoGYXBwX2lkGAEgASgJUgVhcHBJZBIdCgpyZWFkX3ZpZXdzGAIgASgIUglyZWFkVmlld3MSGQoIaXNfdHJhc2gYAyABKAhSB2lzVHJhc2g='); final $typed_data.Uint8List queryAppRequestDescriptor = $convert.base64Decode('Cg9RdWVyeUFwcFJlcXVlc3QSFQoGYXBwX2lkGAEgASgJUgVhcHBJZBInCg9yZWFkX2JlbG9uZ2luZ3MYAiABKAhSDnJlYWRCZWxvbmdpbmdzEhkKCGlzX3RyYXNoGAMgASgIUgdpc1RyYXNo');

View File

@ -11,19 +11,27 @@ import 'package:protobuf/protobuf.dart' as $pb;
class WorkspaceObservable extends $pb.ProtobufEnum { class WorkspaceObservable extends $pb.ProtobufEnum {
static const WorkspaceObservable Unknown = WorkspaceObservable._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Unknown'); static const WorkspaceObservable Unknown = WorkspaceObservable._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Unknown');
static const WorkspaceObservable WorkspaceUpdateDesc = WorkspaceObservable._(10, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'WorkspaceUpdateDesc'); static const WorkspaceObservable UserCreateWorkspace = WorkspaceObservable._(10, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UserCreateWorkspace');
static const WorkspaceObservable WorkspaceAddApp = WorkspaceObservable._(11, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'WorkspaceAddApp'); static const WorkspaceObservable UserDeleteWorkspace = WorkspaceObservable._(11, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UserDeleteWorkspace');
static const WorkspaceObservable AppUpdateDesc = WorkspaceObservable._(20, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'AppUpdateDesc'); static const WorkspaceObservable WorkspaceUpdated = WorkspaceObservable._(12, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'WorkspaceUpdated');
static const WorkspaceObservable AppAddView = WorkspaceObservable._(21, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'AppAddView'); static const WorkspaceObservable WorkspaceCreateApp = WorkspaceObservable._(13, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'WorkspaceCreateApp');
static const WorkspaceObservable ViewUpdateDesc = WorkspaceObservable._(30, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ViewUpdateDesc'); static const WorkspaceObservable WorkspaceDeleteApp = WorkspaceObservable._(14, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'WorkspaceDeleteApp');
static const WorkspaceObservable AppUpdated = WorkspaceObservable._(21, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'AppUpdated');
static const WorkspaceObservable AppCreateView = WorkspaceObservable._(23, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'AppCreateView');
static const WorkspaceObservable AppDeleteView = WorkspaceObservable._(24, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'AppDeleteView');
static const WorkspaceObservable ViewUpdated = WorkspaceObservable._(31, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ViewUpdated');
static const $core.List<WorkspaceObservable> values = <WorkspaceObservable> [ static const $core.List<WorkspaceObservable> values = <WorkspaceObservable> [
Unknown, Unknown,
WorkspaceUpdateDesc, UserCreateWorkspace,
WorkspaceAddApp, UserDeleteWorkspace,
AppUpdateDesc, WorkspaceUpdated,
AppAddView, WorkspaceCreateApp,
ViewUpdateDesc, WorkspaceDeleteApp,
AppUpdated,
AppCreateView,
AppDeleteView,
ViewUpdated,
]; ];
static final $core.Map<$core.int, WorkspaceObservable> _byValue = $pb.ProtobufEnum.initByValue(values); static final $core.Map<$core.int, WorkspaceObservable> _byValue = $pb.ProtobufEnum.initByValue(values);

View File

@ -13,13 +13,17 @@ const WorkspaceObservable$json = const {
'1': 'WorkspaceObservable', '1': 'WorkspaceObservable',
'2': const [ '2': const [
const {'1': 'Unknown', '2': 0}, const {'1': 'Unknown', '2': 0},
const {'1': 'WorkspaceUpdateDesc', '2': 10}, const {'1': 'UserCreateWorkspace', '2': 10},
const {'1': 'WorkspaceAddApp', '2': 11}, const {'1': 'UserDeleteWorkspace', '2': 11},
const {'1': 'AppUpdateDesc', '2': 20}, const {'1': 'WorkspaceUpdated', '2': 12},
const {'1': 'AppAddView', '2': 21}, const {'1': 'WorkspaceCreateApp', '2': 13},
const {'1': 'ViewUpdateDesc', '2': 30}, const {'1': 'WorkspaceDeleteApp', '2': 14},
const {'1': 'AppUpdated', '2': 21},
const {'1': 'AppCreateView', '2': 23},
const {'1': 'AppDeleteView', '2': 24},
const {'1': 'ViewUpdated', '2': 31},
], ],
}; };
/// Descriptor for `WorkspaceObservable`. Decode as a `google.protobuf.EnumDescriptorProto`. /// Descriptor for `WorkspaceObservable`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List workspaceObservableDescriptor = $convert.base64Decode('ChNXb3Jrc3BhY2VPYnNlcnZhYmxlEgsKB1Vua25vd24QABIXChNXb3Jrc3BhY2VVcGRhdGVEZXNjEAoSEwoPV29ya3NwYWNlQWRkQXBwEAsSEQoNQXBwVXBkYXRlRGVzYxAUEg4KCkFwcEFkZFZpZXcQFRISCg5WaWV3VXBkYXRlRGVzYxAe'); final $typed_data.Uint8List workspaceObservableDescriptor = $convert.base64Decode('ChNXb3Jrc3BhY2VPYnNlcnZhYmxlEgsKB1Vua25vd24QABIXChNVc2VyQ3JlYXRlV29ya3NwYWNlEAoSFwoTVXNlckRlbGV0ZVdvcmtzcGFjZRALEhQKEFdvcmtzcGFjZVVwZGF0ZWQQDBIWChJXb3Jrc3BhY2VDcmVhdGVBcHAQDRIWChJXb3Jrc3BhY2VEZWxldGVBcHAQDhIOCgpBcHBVcGRhdGVkEBUSEQoNQXBwQ3JlYXRlVmlldxAXEhEKDUFwcERlbGV0ZVZpZXcQGBIPCgtWaWV3VXBkYXRlZBAf');

View File

@ -138,6 +138,7 @@ class View extends $pb.GeneratedMessage {
..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc') ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc')
..e<ViewType>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewType', $pb.PbFieldType.OE, defaultOrMaker: ViewType.Blank, valueOf: ViewType.valueOf, enumValues: ViewType.values) ..e<ViewType>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewType', $pb.PbFieldType.OE, defaultOrMaker: ViewType.Blank, valueOf: ViewType.valueOf, enumValues: ViewType.values)
..aInt64(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'version') ..aInt64(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'version')
..aOM<RepeatedView>(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'belongings', subBuilder: RepeatedView.create)
..hasRequiredFields = false ..hasRequiredFields = false
; ;
@ -149,6 +150,7 @@ class View extends $pb.GeneratedMessage {
$core.String? desc, $core.String? desc,
ViewType? viewType, ViewType? viewType,
$fixnum.Int64? version, $fixnum.Int64? version,
RepeatedView? belongings,
}) { }) {
final _result = create(); final _result = create();
if (id != null) { if (id != null) {
@ -169,6 +171,9 @@ class View extends $pb.GeneratedMessage {
if (version != null) { if (version != null) {
_result.version = version; _result.version = version;
} }
if (belongings != null) {
_result.belongings = belongings;
}
return _result; return _result;
} }
factory View.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory View.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
@ -245,6 +250,17 @@ class View extends $pb.GeneratedMessage {
$core.bool hasVersion() => $_has(5); $core.bool hasVersion() => $_has(5);
@$pb.TagNumber(6) @$pb.TagNumber(6)
void clearVersion() => clearField(6); void clearVersion() => clearField(6);
@$pb.TagNumber(7)
RepeatedView get belongings => $_getN(6);
@$pb.TagNumber(7)
set belongings(RepeatedView v) { setField(7, v); }
@$pb.TagNumber(7)
$core.bool hasBelongings() => $_has(6);
@$pb.TagNumber(7)
void clearBelongings() => clearField(7);
@$pb.TagNumber(7)
RepeatedView ensureBelongings() => $_ensure(6);
} }
class RepeatedView extends $pb.GeneratedMessage { class RepeatedView extends $pb.GeneratedMessage {

View File

@ -46,11 +46,12 @@ const View$json = const {
const {'1': 'desc', '3': 4, '4': 1, '5': 9, '10': 'desc'}, const {'1': 'desc', '3': 4, '4': 1, '5': 9, '10': 'desc'},
const {'1': 'view_type', '3': 5, '4': 1, '5': 14, '6': '.ViewType', '10': 'viewType'}, const {'1': 'view_type', '3': 5, '4': 1, '5': 14, '6': '.ViewType', '10': 'viewType'},
const {'1': 'version', '3': 6, '4': 1, '5': 3, '10': 'version'}, const {'1': 'version', '3': 6, '4': 1, '5': 3, '10': 'version'},
const {'1': 'belongings', '3': 7, '4': 1, '5': 11, '6': '.RepeatedView', '10': 'belongings'},
], ],
}; };
/// Descriptor for `View`. Decode as a `google.protobuf.DescriptorProto`. /// Descriptor for `View`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List viewDescriptor = $convert.base64Decode('CgRWaWV3Eg4KAmlkGAEgASgJUgJpZBIgCgxiZWxvbmdfdG9faWQYAiABKAlSCmJlbG9uZ1RvSWQSEgoEbmFtZRgDIAEoCVIEbmFtZRISCgRkZXNjGAQgASgJUgRkZXNjEiYKCXZpZXdfdHlwZRgFIAEoDjIJLlZpZXdUeXBlUgh2aWV3VHlwZRIYCgd2ZXJzaW9uGAYgASgDUgd2ZXJzaW9u'); final $typed_data.Uint8List viewDescriptor = $convert.base64Decode('CgRWaWV3Eg4KAmlkGAEgASgJUgJpZBIgCgxiZWxvbmdfdG9faWQYAiABKAlSCmJlbG9uZ1RvSWQSEgoEbmFtZRgDIAEoCVIEbmFtZRISCgRkZXNjGAQgASgJUgRkZXNjEiYKCXZpZXdfdHlwZRgFIAEoDjIJLlZpZXdUeXBlUgh2aWV3VHlwZRIYCgd2ZXJzaW9uGAYgASgDUgd2ZXJzaW9uEi0KCmJlbG9uZ2luZ3MYByABKAsyDS5SZXBlYXRlZFZpZXdSCmJlbG9uZ2luZ3M=');
@$core.Deprecated('Use repeatedViewDescriptor instead') @$core.Deprecated('Use repeatedViewDescriptor instead')
const RepeatedView$json = const { const RepeatedView$json = const {
'1': 'RepeatedView', '1': 'RepeatedView',

View File

@ -13,6 +13,7 @@ class QueryViewRequest extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'QueryViewRequest', createEmptyInstance: create) static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'QueryViewRequest', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewId') ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewId')
..aOB(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'isTrash') ..aOB(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'isTrash')
..aOB(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'readBelongings')
..hasRequiredFields = false ..hasRequiredFields = false
; ;
@ -20,6 +21,7 @@ class QueryViewRequest extends $pb.GeneratedMessage {
factory QueryViewRequest({ factory QueryViewRequest({
$core.String? viewId, $core.String? viewId,
$core.bool? isTrash, $core.bool? isTrash,
$core.bool? readBelongings,
}) { }) {
final _result = create(); final _result = create();
if (viewId != null) { if (viewId != null) {
@ -28,6 +30,9 @@ class QueryViewRequest extends $pb.GeneratedMessage {
if (isTrash != null) { if (isTrash != null) {
_result.isTrash = isTrash; _result.isTrash = isTrash;
} }
if (readBelongings != null) {
_result.readBelongings = readBelongings;
}
return _result; return _result;
} }
factory QueryViewRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory QueryViewRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
@ -68,5 +73,14 @@ class QueryViewRequest extends $pb.GeneratedMessage {
$core.bool hasIsTrash() => $_has(1); $core.bool hasIsTrash() => $_has(1);
@$pb.TagNumber(2) @$pb.TagNumber(2)
void clearIsTrash() => clearField(2); void clearIsTrash() => clearField(2);
@$pb.TagNumber(3)
$core.bool get readBelongings => $_getBF(2);
@$pb.TagNumber(3)
set readBelongings($core.bool v) { $_setBool(2, v); }
@$pb.TagNumber(3)
$core.bool hasReadBelongings() => $_has(2);
@$pb.TagNumber(3)
void clearReadBelongings() => clearField(3);
} }

View File

@ -14,8 +14,9 @@ const QueryViewRequest$json = const {
'2': const [ '2': const [
const {'1': 'view_id', '3': 1, '4': 1, '5': 9, '10': 'viewId'}, const {'1': 'view_id', '3': 1, '4': 1, '5': 9, '10': 'viewId'},
const {'1': 'is_trash', '3': 2, '4': 1, '5': 8, '10': 'isTrash'}, const {'1': 'is_trash', '3': 2, '4': 1, '5': 8, '10': 'isTrash'},
const {'1': 'read_belongings', '3': 3, '4': 1, '5': 8, '10': 'readBelongings'},
], ],
}; };
/// Descriptor for `QueryViewRequest`. Decode as a `google.protobuf.DescriptorProto`. /// Descriptor for `QueryViewRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List queryViewRequestDescriptor = $convert.base64Decode('ChBRdWVyeVZpZXdSZXF1ZXN0EhcKB3ZpZXdfaWQYASABKAlSBnZpZXdJZBIZCghpc190cmFzaBgCIAEoCFIHaXNUcmFzaA=='); final $typed_data.Uint8List queryViewRequestDescriptor = $convert.base64Decode('ChBRdWVyeVZpZXdSZXF1ZXN0EhcKB3ZpZXdfaWQYASABKAlSBnZpZXdJZBIZCghpc190cmFzaBgCIAEoCFIHaXNUcmFzaBInCg9yZWFkX2JlbG9uZ2luZ3MYAyABKAhSDnJlYWRCZWxvbmdpbmdz');

View File

@ -81,7 +81,7 @@ pub struct App {
pub desc: String, pub desc: String,
#[pb(index = 5)] #[pb(index = 5)]
pub views: RepeatedView, pub belongings: RepeatedView,
#[pb(index = 6)] #[pb(index = 6)]
pub version: i64, pub version: i64,

View File

@ -8,7 +8,7 @@ pub struct QueryAppRequest {
pub app_id: String, pub app_id: String,
#[pb(index = 2)] #[pb(index = 2)]
pub read_views: bool, pub read_belongings: bool,
#[pb(index = 3)] #[pb(index = 3)]
pub is_trash: bool, pub is_trash: bool,
@ -18,13 +18,13 @@ impl QueryAppRequest {
pub fn new(app_id: &str) -> Self { pub fn new(app_id: &str) -> Self {
QueryAppRequest { QueryAppRequest {
app_id: app_id.to_string(), app_id: app_id.to_string(),
read_views: false, read_belongings: false,
is_trash: false, is_trash: false,
} }
} }
pub fn set_read_views(mut self, read_views: bool) -> Self { pub fn set_read_views(mut self, read_views: bool) -> Self {
self.read_views = read_views; self.read_belongings = read_views;
self self
} }
@ -36,7 +36,7 @@ impl QueryAppRequest {
pub struct QueryAppParams { pub struct QueryAppParams {
pub app_id: String, pub app_id: String,
pub read_views: bool, pub read_belongings: bool,
pub is_trash: bool, pub is_trash: bool,
} }
@ -50,7 +50,7 @@ impl TryInto<QueryAppParams> for QueryAppRequest {
Ok(QueryAppParams { Ok(QueryAppParams {
app_id, app_id,
read_views: self.read_views, read_belongings: self.read_belongings,
is_trash: self.is_trash, is_trash: self.is_trash,
}) })
} }

View File

@ -98,6 +98,9 @@ pub struct View {
#[pb(index = 6)] #[pb(index = 6)]
pub version: i64, pub version: i64,
#[pb(index = 7)]
pub belongings: RepeatedView,
} }
#[derive(PartialEq, Debug, Default, ProtoBuf)] #[derive(PartialEq, Debug, Default, ProtoBuf)]

View File

@ -12,6 +12,9 @@ pub struct QueryViewRequest {
#[pb(index = 2)] #[pb(index = 2)]
pub is_trash: bool, pub is_trash: bool,
#[pb(index = 3)]
pub read_belongings: bool,
} }
impl QueryViewRequest { impl QueryViewRequest {
@ -19,6 +22,7 @@ impl QueryViewRequest {
Self { Self {
view_id: view_id.to_owned(), view_id: view_id.to_owned(),
is_trash: false, is_trash: false,
read_belongings: false,
} }
} }
@ -31,6 +35,7 @@ impl QueryViewRequest {
pub struct QueryViewParams { pub struct QueryViewParams {
pub view_id: String, pub view_id: String,
pub is_trash: bool, pub is_trash: bool,
pub read_belongings: bool,
} }
impl TryInto<QueryViewParams> for QueryViewRequest { impl TryInto<QueryViewParams> for QueryViewRequest {
@ -44,6 +49,7 @@ impl TryInto<QueryViewParams> for QueryViewRequest {
Ok(QueryViewParams { Ok(QueryViewParams {
view_id, view_id,
is_trash: self.is_trash, is_trash: self.is_trash,
read_belongings: self.read_belongings,
}) })
} }
} }

View File

@ -59,9 +59,9 @@ pub async fn read_app(
let mut app = app_controller let mut app = app_controller
.read_app(&params.app_id, params.is_trash) .read_app(&params.app_id, params.is_trash)
.await?; .await?;
if params.read_views { if params.read_belongings {
let views = view_controller.read_views_belong_to(&params.app_id).await?; let views = view_controller.read_views_belong_to(&params.app_id).await?;
app.views = RepeatedView { items: views }; app.belongings = RepeatedView { items: views };
} }
response_ok(app) response_ok(app)

View File

@ -6,6 +6,7 @@ use crate::{
DeleteViewRequest, DeleteViewRequest,
QueryViewParams, QueryViewParams,
QueryViewRequest, QueryViewRequest,
RepeatedView,
UpdateViewParams, UpdateViewParams,
UpdateViewRequest, UpdateViewRequest,
View, View,
@ -32,10 +33,15 @@ pub async fn read_view(
controller: Unit<Arc<ViewController>>, controller: Unit<Arc<ViewController>>,
) -> ResponseResult<View, WorkspaceError> { ) -> ResponseResult<View, WorkspaceError> {
let params: QueryViewParams = data.into_inner().try_into()?; let params: QueryViewParams = data.into_inner().try_into()?;
let view = controller let mut view = controller
.read_view(&params.view_id, params.is_trash) .read_view(&params.view_id, params.is_trash)
.await?; .await?;
if params.read_belongings {
let views = controller.read_views_belong_to(&params.view_id).await?;
view.belongings = RepeatedView { items: views }
}
response_ok(view) response_ok(view)
} }

View File

@ -7,13 +7,18 @@ const OBSERVABLE_CATEGORY: &'static str = "Workspace";
pub(crate) enum WorkspaceObservable { pub(crate) enum WorkspaceObservable {
Unknown = 0, Unknown = 0,
WorkspaceUpdateDesc = 10, UserCreateWorkspace = 10,
WorkspaceAddApp = 11, UserDeleteWorkspace = 11,
AppUpdateDesc = 20, WorkspaceUpdated = 12,
AppAddView = 21, WorkspaceCreateApp = 13,
WorkspaceDeleteApp = 14,
ViewUpdateDesc = 30, AppUpdated = 21,
AppCreateView = 23,
AppDeleteView = 24,
ViewUpdated = 31,
} }
impl std::default::Default for WorkspaceObservable { impl std::default::Default for WorkspaceObservable {

View File

@ -489,7 +489,7 @@ pub struct App {
pub workspace_id: ::std::string::String, pub workspace_id: ::std::string::String,
pub name: ::std::string::String, pub name: ::std::string::String,
pub desc: ::std::string::String, pub desc: ::std::string::String,
pub views: ::protobuf::SingularPtrField<super::view_create::RepeatedView>, pub belongings: ::protobuf::SingularPtrField<super::view_create::RepeatedView>,
pub version: i64, pub version: i64,
// special fields // special fields
pub unknown_fields: ::protobuf::UnknownFields, pub unknown_fields: ::protobuf::UnknownFields,
@ -611,37 +611,37 @@ impl App {
::std::mem::replace(&mut self.desc, ::std::string::String::new()) ::std::mem::replace(&mut self.desc, ::std::string::String::new())
} }
// .RepeatedView views = 5; // .RepeatedView belongings = 5;
pub fn get_views(&self) -> &super::view_create::RepeatedView { pub fn get_belongings(&self) -> &super::view_create::RepeatedView {
self.views.as_ref().unwrap_or_else(|| <super::view_create::RepeatedView as ::protobuf::Message>::default_instance()) self.belongings.as_ref().unwrap_or_else(|| <super::view_create::RepeatedView as ::protobuf::Message>::default_instance())
} }
pub fn clear_views(&mut self) { pub fn clear_belongings(&mut self) {
self.views.clear(); self.belongings.clear();
} }
pub fn has_views(&self) -> bool { pub fn has_belongings(&self) -> bool {
self.views.is_some() self.belongings.is_some()
} }
// Param is passed by value, moved // Param is passed by value, moved
pub fn set_views(&mut self, v: super::view_create::RepeatedView) { pub fn set_belongings(&mut self, v: super::view_create::RepeatedView) {
self.views = ::protobuf::SingularPtrField::some(v); self.belongings = ::protobuf::SingularPtrField::some(v);
} }
// Mutable pointer to the field. // Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first. // If field is not initialized, it is initialized with default value first.
pub fn mut_views(&mut self) -> &mut super::view_create::RepeatedView { pub fn mut_belongings(&mut self) -> &mut super::view_create::RepeatedView {
if self.views.is_none() { if self.belongings.is_none() {
self.views.set_default(); self.belongings.set_default();
} }
self.views.as_mut().unwrap() self.belongings.as_mut().unwrap()
} }
// Take field // Take field
pub fn take_views(&mut self) -> super::view_create::RepeatedView { pub fn take_belongings(&mut self) -> super::view_create::RepeatedView {
self.views.take().unwrap_or_else(|| super::view_create::RepeatedView::new()) self.belongings.take().unwrap_or_else(|| super::view_create::RepeatedView::new())
} }
// int64 version = 6; // int64 version = 6;
@ -662,7 +662,7 @@ impl App {
impl ::protobuf::Message for App { impl ::protobuf::Message for App {
fn is_initialized(&self) -> bool { fn is_initialized(&self) -> bool {
for v in &self.views { for v in &self.belongings {
if !v.is_initialized() { if !v.is_initialized() {
return false; return false;
} }
@ -687,7 +687,7 @@ impl ::protobuf::Message for App {
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.desc)?; ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.desc)?;
}, },
5 => { 5 => {
::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.views)?; ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.belongings)?;
}, },
6 => { 6 => {
if wire_type != ::protobuf::wire_format::WireTypeVarint { if wire_type != ::protobuf::wire_format::WireTypeVarint {
@ -720,7 +720,7 @@ impl ::protobuf::Message for App {
if !self.desc.is_empty() { if !self.desc.is_empty() {
my_size += ::protobuf::rt::string_size(4, &self.desc); my_size += ::protobuf::rt::string_size(4, &self.desc);
} }
if let Some(ref v) = self.views.as_ref() { if let Some(ref v) = self.belongings.as_ref() {
let len = v.compute_size(); let len = v.compute_size();
my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
} }
@ -745,7 +745,7 @@ impl ::protobuf::Message for App {
if !self.desc.is_empty() { if !self.desc.is_empty() {
os.write_string(4, &self.desc)?; os.write_string(4, &self.desc)?;
} }
if let Some(ref v) = self.views.as_ref() { if let Some(ref v) = self.belongings.as_ref() {
os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?;
os.write_raw_varint32(v.get_cached_size())?; os.write_raw_varint32(v.get_cached_size())?;
v.write_to_with_cached_sizes(os)?; v.write_to_with_cached_sizes(os)?;
@ -812,9 +812,9 @@ impl ::protobuf::Message for App {
|m: &mut App| { &mut m.desc }, |m: &mut App| { &mut m.desc },
)); ));
fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<super::view_create::RepeatedView>>( fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<super::view_create::RepeatedView>>(
"views", "belongings",
|m: &App| { &m.views }, |m: &App| { &m.belongings },
|m: &mut App| { &mut m.views }, |m: &mut App| { &mut m.belongings },
)); ));
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>(
"version", "version",
@ -841,7 +841,7 @@ impl ::protobuf::Clear for App {
self.workspace_id.clear(); self.workspace_id.clear();
self.name.clear(); self.name.clear();
self.desc.clear(); self.desc.clear();
self.views.clear(); self.belongings.clear();
self.version = 0; self.version = 0;
self.unknown_fields.clear(); self.unknown_fields.clear();
} }
@ -1031,52 +1031,52 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12\x12\n\x04desc\x18\x03\x20\ \x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12\x12\n\x04desc\x18\x03\x20\
\x01(\tR\x04desc\x12,\n\x0bcolor_style\x18\x04\x20\x01(\x0b2\x0b.ColorSt\ \x01(\tR\x04desc\x12,\n\x0bcolor_style\x18\x04\x20\x01(\x0b2\x0b.ColorSt\
yleR\ncolorStyle\"-\n\nColorStyle\x12\x1f\n\x0btheme_color\x18\x01\x20\ yleR\ncolorStyle\"-\n\nColorStyle\x12\x1f\n\x0btheme_color\x18\x01\x20\
\x01(\tR\nthemeColor\"\x9f\x01\n\x03App\x12\x0e\n\x02id\x18\x01\x20\x01(\ \x01(\tR\nthemeColor\"\xa9\x01\n\x03App\x12\x0e\n\x02id\x18\x01\x20\x01(\
\tR\x02id\x12!\n\x0cworkspace_id\x18\x02\x20\x01(\tR\x0bworkspaceId\x12\ \tR\x02id\x12!\n\x0cworkspace_id\x18\x02\x20\x01(\tR\x0bworkspaceId\x12\
\x12\n\x04name\x18\x03\x20\x01(\tR\x04name\x12\x12\n\x04desc\x18\x04\x20\ \x12\n\x04name\x18\x03\x20\x01(\tR\x04name\x12\x12\n\x04desc\x18\x04\x20\
\x01(\tR\x04desc\x12#\n\x05views\x18\x05\x20\x01(\x0b2\r.RepeatedViewR\ \x01(\tR\x04desc\x12-\n\nbelongings\x18\x05\x20\x01(\x0b2\r.RepeatedView\
\x05views\x12\x18\n\x07version\x18\x06\x20\x01(\x03R\x07version\")\n\x0b\ R\nbelongings\x12\x18\n\x07version\x18\x06\x20\x01(\x03R\x07version\")\n\
RepeatedApp\x12\x1a\n\x05items\x18\x01\x20\x03(\x0b2\x04.AppR\x05itemsJ\ \x0bRepeatedApp\x12\x1a\n\x05items\x18\x01\x20\x03(\x0b2\x04.AppR\x05ite\
\x9f\x06\n\x06\x12\x04\0\0\x16\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\t\n\ msJ\x9f\x06\n\x06\x12\x04\0\0\x16\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\
\x02\x03\0\x12\x03\x01\0\x1b\n\n\n\x02\x04\0\x12\x04\x03\0\x08\x01\n\n\n\ \t\n\x02\x03\0\x12\x03\x01\0\x1b\n\n\n\x02\x04\0\x12\x04\x03\0\x08\x01\n\
\x03\x04\0\x01\x12\x03\x03\x08\x18\n\x0b\n\x04\x04\0\x02\0\x12\x03\x04\ \n\n\x03\x04\0\x01\x12\x03\x03\x08\x18\n\x0b\n\x04\x04\0\x02\0\x12\x03\
\x04\x1c\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x04\x04\n\n\x0c\n\x05\x04\0\ \x04\x04\x1c\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x04\x04\n\n\x0c\n\x05\
\x02\0\x01\x12\x03\x04\x0b\x17\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x04\ \x04\0\x02\0\x01\x12\x03\x04\x0b\x17\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\
\x1a\x1b\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x05\x04\x14\n\x0c\n\x05\x04\0\ \x04\x1a\x1b\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x05\x04\x14\n\x0c\n\x05\
\x02\x01\x05\x12\x03\x05\x04\n\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x05\ \x04\0\x02\x01\x05\x12\x03\x05\x04\n\n\x0c\n\x05\x04\0\x02\x01\x01\x12\
\x0b\x0f\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x05\x12\x13\n\x0b\n\x04\ \x03\x05\x0b\x0f\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x05\x12\x13\n\x0b\
\x04\0\x02\x02\x12\x03\x06\x04\x14\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\ \n\x04\x04\0\x02\x02\x12\x03\x06\x04\x14\n\x0c\n\x05\x04\0\x02\x02\x05\
\x06\x04\n\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x06\x0b\x0f\n\x0c\n\x05\ \x12\x03\x06\x04\n\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x06\x0b\x0f\n\
\x04\0\x02\x02\x03\x12\x03\x06\x12\x13\n\x0b\n\x04\x04\0\x02\x03\x12\x03\ \x0c\n\x05\x04\0\x02\x02\x03\x12\x03\x06\x12\x13\n\x0b\n\x04\x04\0\x02\
\x07\x04\x1f\n\x0c\n\x05\x04\0\x02\x03\x06\x12\x03\x07\x04\x0e\n\x0c\n\ \x03\x12\x03\x07\x04\x1f\n\x0c\n\x05\x04\0\x02\x03\x06\x12\x03\x07\x04\
\x05\x04\0\x02\x03\x01\x12\x03\x07\x0f\x1a\n\x0c\n\x05\x04\0\x02\x03\x03\ \x0e\n\x0c\n\x05\x04\0\x02\x03\x01\x12\x03\x07\x0f\x1a\n\x0c\n\x05\x04\0\
\x12\x03\x07\x1d\x1e\n\n\n\x02\x04\x01\x12\x04\t\0\x0b\x01\n\n\n\x03\x04\ \x02\x03\x03\x12\x03\x07\x1d\x1e\n\n\n\x02\x04\x01\x12\x04\t\0\x0b\x01\n\
\x01\x01\x12\x03\t\x08\x12\n\x0b\n\x04\x04\x01\x02\0\x12\x03\n\x04\x1b\n\ \n\n\x03\x04\x01\x01\x12\x03\t\x08\x12\n\x0b\n\x04\x04\x01\x02\0\x12\x03\
\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\n\x04\n\n\x0c\n\x05\x04\x01\x02\0\ \n\x04\x1b\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\n\x04\n\n\x0c\n\x05\x04\
\x01\x12\x03\n\x0b\x16\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\n\x19\x1a\n\ \x01\x02\0\x01\x12\x03\n\x0b\x16\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\n\
\n\n\x02\x04\x02\x12\x04\x0c\0\x13\x01\n\n\n\x03\x04\x02\x01\x12\x03\x0c\ \x19\x1a\n\n\n\x02\x04\x02\x12\x04\x0c\0\x13\x01\n\n\n\x03\x04\x02\x01\
\x08\x0b\n\x0b\n\x04\x04\x02\x02\0\x12\x03\r\x04\x12\n\x0c\n\x05\x04\x02\ \x12\x03\x0c\x08\x0b\n\x0b\n\x04\x04\x02\x02\0\x12\x03\r\x04\x12\n\x0c\n\
\x02\0\x05\x12\x03\r\x04\n\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\r\x0b\r\ \x05\x04\x02\x02\0\x05\x12\x03\r\x04\n\n\x0c\n\x05\x04\x02\x02\0\x01\x12\
\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03\r\x10\x11\n\x0b\n\x04\x04\x02\x02\ \x03\r\x0b\r\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03\r\x10\x11\n\x0b\n\x04\
\x01\x12\x03\x0e\x04\x1c\n\x0c\n\x05\x04\x02\x02\x01\x05\x12\x03\x0e\x04\ \x04\x02\x02\x01\x12\x03\x0e\x04\x1c\n\x0c\n\x05\x04\x02\x02\x01\x05\x12\
\n\n\x0c\n\x05\x04\x02\x02\x01\x01\x12\x03\x0e\x0b\x17\n\x0c\n\x05\x04\ \x03\x0e\x04\n\n\x0c\n\x05\x04\x02\x02\x01\x01\x12\x03\x0e\x0b\x17\n\x0c\
\x02\x02\x01\x03\x12\x03\x0e\x1a\x1b\n\x0b\n\x04\x04\x02\x02\x02\x12\x03\ \n\x05\x04\x02\x02\x01\x03\x12\x03\x0e\x1a\x1b\n\x0b\n\x04\x04\x02\x02\
\x0f\x04\x14\n\x0c\n\x05\x04\x02\x02\x02\x05\x12\x03\x0f\x04\n\n\x0c\n\ \x02\x12\x03\x0f\x04\x14\n\x0c\n\x05\x04\x02\x02\x02\x05\x12\x03\x0f\x04\
\x05\x04\x02\x02\x02\x01\x12\x03\x0f\x0b\x0f\n\x0c\n\x05\x04\x02\x02\x02\ \n\n\x0c\n\x05\x04\x02\x02\x02\x01\x12\x03\x0f\x0b\x0f\n\x0c\n\x05\x04\
\x03\x12\x03\x0f\x12\x13\n\x0b\n\x04\x04\x02\x02\x03\x12\x03\x10\x04\x14\ \x02\x02\x02\x03\x12\x03\x0f\x12\x13\n\x0b\n\x04\x04\x02\x02\x03\x12\x03\
\n\x0c\n\x05\x04\x02\x02\x03\x05\x12\x03\x10\x04\n\n\x0c\n\x05\x04\x02\ \x10\x04\x14\n\x0c\n\x05\x04\x02\x02\x03\x05\x12\x03\x10\x04\n\n\x0c\n\
\x02\x03\x01\x12\x03\x10\x0b\x0f\n\x0c\n\x05\x04\x02\x02\x03\x03\x12\x03\ \x05\x04\x02\x02\x03\x01\x12\x03\x10\x0b\x0f\n\x0c\n\x05\x04\x02\x02\x03\
\x10\x12\x13\n\x0b\n\x04\x04\x02\x02\x04\x12\x03\x11\x04\x1b\n\x0c\n\x05\ \x03\x12\x03\x10\x12\x13\n\x0b\n\x04\x04\x02\x02\x04\x12\x03\x11\x04\x20\
\x04\x02\x02\x04\x06\x12\x03\x11\x04\x10\n\x0c\n\x05\x04\x02\x02\x04\x01\ \n\x0c\n\x05\x04\x02\x02\x04\x06\x12\x03\x11\x04\x10\n\x0c\n\x05\x04\x02\
\x12\x03\x11\x11\x16\n\x0c\n\x05\x04\x02\x02\x04\x03\x12\x03\x11\x19\x1a\ \x02\x04\x01\x12\x03\x11\x11\x1b\n\x0c\n\x05\x04\x02\x02\x04\x03\x12\x03\
\n\x0b\n\x04\x04\x02\x02\x05\x12\x03\x12\x04\x16\n\x0c\n\x05\x04\x02\x02\ \x11\x1e\x1f\n\x0b\n\x04\x04\x02\x02\x05\x12\x03\x12\x04\x16\n\x0c\n\x05\
\x05\x05\x12\x03\x12\x04\t\n\x0c\n\x05\x04\x02\x02\x05\x01\x12\x03\x12\n\ \x04\x02\x02\x05\x05\x12\x03\x12\x04\t\n\x0c\n\x05\x04\x02\x02\x05\x01\
\x11\n\x0c\n\x05\x04\x02\x02\x05\x03\x12\x03\x12\x14\x15\n\n\n\x02\x04\ \x12\x03\x12\n\x11\n\x0c\n\x05\x04\x02\x02\x05\x03\x12\x03\x12\x14\x15\n\
\x03\x12\x04\x14\0\x16\x01\n\n\n\x03\x04\x03\x01\x12\x03\x14\x08\x13\n\ \n\n\x02\x04\x03\x12\x04\x14\0\x16\x01\n\n\n\x03\x04\x03\x01\x12\x03\x14\
\x0b\n\x04\x04\x03\x02\0\x12\x03\x15\x04\x1b\n\x0c\n\x05\x04\x03\x02\0\ \x08\x13\n\x0b\n\x04\x04\x03\x02\0\x12\x03\x15\x04\x1b\n\x0c\n\x05\x04\
\x04\x12\x03\x15\x04\x0c\n\x0c\n\x05\x04\x03\x02\0\x06\x12\x03\x15\r\x10\ \x03\x02\0\x04\x12\x03\x15\x04\x0c\n\x0c\n\x05\x04\x03\x02\0\x06\x12\x03\
\n\x0c\n\x05\x04\x03\x02\0\x01\x12\x03\x15\x11\x16\n\x0c\n\x05\x04\x03\ \x15\r\x10\n\x0c\n\x05\x04\x03\x02\0\x01\x12\x03\x15\x11\x16\n\x0c\n\x05\
\x02\0\x03\x12\x03\x15\x19\x1ab\x06proto3\ \x04\x03\x02\0\x03\x12\x03\x15\x19\x1ab\x06proto3\
"; ";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -27,7 +27,7 @@
pub struct QueryAppRequest { pub struct QueryAppRequest {
// message fields // message fields
pub app_id: ::std::string::String, pub app_id: ::std::string::String,
pub read_views: bool, pub read_belongings: bool,
pub is_trash: bool, pub is_trash: bool,
// special fields // special fields
pub unknown_fields: ::protobuf::UnknownFields, pub unknown_fields: ::protobuf::UnknownFields,
@ -71,19 +71,19 @@ impl QueryAppRequest {
::std::mem::replace(&mut self.app_id, ::std::string::String::new()) ::std::mem::replace(&mut self.app_id, ::std::string::String::new())
} }
// bool read_views = 2; // bool read_belongings = 2;
pub fn get_read_views(&self) -> bool { pub fn get_read_belongings(&self) -> bool {
self.read_views self.read_belongings
} }
pub fn clear_read_views(&mut self) { pub fn clear_read_belongings(&mut self) {
self.read_views = false; self.read_belongings = false;
} }
// Param is passed by value, moved // Param is passed by value, moved
pub fn set_read_views(&mut self, v: bool) { pub fn set_read_belongings(&mut self, v: bool) {
self.read_views = v; self.read_belongings = v;
} }
// bool is_trash = 3; // bool is_trash = 3;
@ -119,7 +119,7 @@ impl ::protobuf::Message for QueryAppRequest {
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
} }
let tmp = is.read_bool()?; let tmp = is.read_bool()?;
self.read_views = tmp; self.read_belongings = tmp;
}, },
3 => { 3 => {
if wire_type != ::protobuf::wire_format::WireTypeVarint { if wire_type != ::protobuf::wire_format::WireTypeVarint {
@ -143,7 +143,7 @@ impl ::protobuf::Message for QueryAppRequest {
if !self.app_id.is_empty() { if !self.app_id.is_empty() {
my_size += ::protobuf::rt::string_size(1, &self.app_id); my_size += ::protobuf::rt::string_size(1, &self.app_id);
} }
if self.read_views != false { if self.read_belongings != false {
my_size += 2; my_size += 2;
} }
if self.is_trash != false { if self.is_trash != false {
@ -158,8 +158,8 @@ impl ::protobuf::Message for QueryAppRequest {
if !self.app_id.is_empty() { if !self.app_id.is_empty() {
os.write_string(1, &self.app_id)?; os.write_string(1, &self.app_id)?;
} }
if self.read_views != false { if self.read_belongings != false {
os.write_bool(2, self.read_views)?; os.write_bool(2, self.read_belongings)?;
} }
if self.is_trash != false { if self.is_trash != false {
os.write_bool(3, self.is_trash)?; os.write_bool(3, self.is_trash)?;
@ -208,9 +208,9 @@ impl ::protobuf::Message for QueryAppRequest {
|m: &mut QueryAppRequest| { &mut m.app_id }, |m: &mut QueryAppRequest| { &mut m.app_id },
)); ));
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
"read_views", "read_belongings",
|m: &QueryAppRequest| { &m.read_views }, |m: &QueryAppRequest| { &m.read_belongings },
|m: &mut QueryAppRequest| { &mut m.read_views }, |m: &mut QueryAppRequest| { &mut m.read_belongings },
)); ));
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
"is_trash", "is_trash",
@ -234,7 +234,7 @@ impl ::protobuf::Message for QueryAppRequest {
impl ::protobuf::Clear for QueryAppRequest { impl ::protobuf::Clear for QueryAppRequest {
fn clear(&mut self) { fn clear(&mut self) {
self.app_id.clear(); self.app_id.clear();
self.read_views = false; self.read_belongings = false;
self.is_trash = false; self.is_trash = false;
self.unknown_fields.clear(); self.unknown_fields.clear();
} }
@ -253,20 +253,20 @@ impl ::protobuf::reflect::ProtobufValue for QueryAppRequest {
} }
static file_descriptor_proto_data: &'static [u8] = b"\ static file_descriptor_proto_data: &'static [u8] = b"\
\n\x0fapp_query.proto\"b\n\x0fQueryAppRequest\x12\x15\n\x06app_id\x18\ \n\x0fapp_query.proto\"l\n\x0fQueryAppRequest\x12\x15\n\x06app_id\x18\
\x01\x20\x01(\tR\x05appId\x12\x1d\n\nread_views\x18\x02\x20\x01(\x08R\tr\ \x01\x20\x01(\tR\x05appId\x12'\n\x0fread_belongings\x18\x02\x20\x01(\x08\
eadViews\x12\x19\n\x08is_trash\x18\x03\x20\x01(\x08R\x07isTrashJ\xcf\x01\ R\x0ereadBelongings\x12\x19\n\x08is_trash\x18\x03\x20\x01(\x08R\x07isTra\
\n\x06\x12\x04\0\0\x06\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\ shJ\xcf\x01\n\x06\x12\x04\0\0\x06\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\
\0\x12\x04\x02\0\x06\x01\n\n\n\x03\x04\0\x01\x12\x03\x02\x08\x17\n\x0b\n\ \n\n\x02\x04\0\x12\x04\x02\0\x06\x01\n\n\n\x03\x04\0\x01\x12\x03\x02\x08\
\x04\x04\0\x02\0\x12\x03\x03\x04\x16\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\ \x17\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x16\n\x0c\n\x05\x04\0\x02\0\
\x03\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03\x0b\x11\n\x0c\n\x05\ \x05\x12\x03\x03\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03\x0b\x11\n\
\x04\0\x02\0\x03\x12\x03\x03\x14\x15\n\x0b\n\x04\x04\0\x02\x01\x12\x03\ \x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x14\x15\n\x0b\n\x04\x04\0\x02\x01\
\x04\x04\x18\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x04\x04\x08\n\x0c\n\ \x12\x03\x04\x04\x1d\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x04\x04\x08\n\
\x05\x04\0\x02\x01\x01\x12\x03\x04\t\x13\n\x0c\n\x05\x04\0\x02\x01\x03\ \x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x04\t\x18\n\x0c\n\x05\x04\0\x02\x01\
\x12\x03\x04\x16\x17\n\x0b\n\x04\x04\0\x02\x02\x12\x03\x05\x04\x16\n\x0c\ \x03\x12\x03\x04\x1b\x1c\n\x0b\n\x04\x04\0\x02\x02\x12\x03\x05\x04\x16\n\
\n\x05\x04\0\x02\x02\x05\x12\x03\x05\x04\x08\n\x0c\n\x05\x04\0\x02\x02\ \x0c\n\x05\x04\0\x02\x02\x05\x12\x03\x05\x04\x08\n\x0c\n\x05\x04\0\x02\
\x01\x12\x03\x05\t\x11\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\x05\x14\x15\ \x02\x01\x12\x03\x05\t\x11\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\x05\x14\
b\x06proto3\ \x15b\x06proto3\
"; ";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -26,11 +26,15 @@
#[derive(Clone,PartialEq,Eq,Debug,Hash)] #[derive(Clone,PartialEq,Eq,Debug,Hash)]
pub enum WorkspaceObservable { pub enum WorkspaceObservable {
Unknown = 0, Unknown = 0,
WorkspaceUpdateDesc = 10, UserCreateWorkspace = 10,
WorkspaceAddApp = 11, UserDeleteWorkspace = 11,
AppUpdateDesc = 20, WorkspaceUpdated = 12,
AppAddView = 21, WorkspaceCreateApp = 13,
ViewUpdateDesc = 30, WorkspaceDeleteApp = 14,
AppUpdated = 21,
AppCreateView = 23,
AppDeleteView = 24,
ViewUpdated = 31,
} }
impl ::protobuf::ProtobufEnum for WorkspaceObservable { impl ::protobuf::ProtobufEnum for WorkspaceObservable {
@ -41,11 +45,15 @@ impl ::protobuf::ProtobufEnum for WorkspaceObservable {
fn from_i32(value: i32) -> ::std::option::Option<WorkspaceObservable> { fn from_i32(value: i32) -> ::std::option::Option<WorkspaceObservable> {
match value { match value {
0 => ::std::option::Option::Some(WorkspaceObservable::Unknown), 0 => ::std::option::Option::Some(WorkspaceObservable::Unknown),
10 => ::std::option::Option::Some(WorkspaceObservable::WorkspaceUpdateDesc), 10 => ::std::option::Option::Some(WorkspaceObservable::UserCreateWorkspace),
11 => ::std::option::Option::Some(WorkspaceObservable::WorkspaceAddApp), 11 => ::std::option::Option::Some(WorkspaceObservable::UserDeleteWorkspace),
20 => ::std::option::Option::Some(WorkspaceObservable::AppUpdateDesc), 12 => ::std::option::Option::Some(WorkspaceObservable::WorkspaceUpdated),
21 => ::std::option::Option::Some(WorkspaceObservable::AppAddView), 13 => ::std::option::Option::Some(WorkspaceObservable::WorkspaceCreateApp),
30 => ::std::option::Option::Some(WorkspaceObservable::ViewUpdateDesc), 14 => ::std::option::Option::Some(WorkspaceObservable::WorkspaceDeleteApp),
21 => ::std::option::Option::Some(WorkspaceObservable::AppUpdated),
23 => ::std::option::Option::Some(WorkspaceObservable::AppCreateView),
24 => ::std::option::Option::Some(WorkspaceObservable::AppDeleteView),
31 => ::std::option::Option::Some(WorkspaceObservable::ViewUpdated),
_ => ::std::option::Option::None _ => ::std::option::Option::None
} }
} }
@ -53,11 +61,15 @@ impl ::protobuf::ProtobufEnum for WorkspaceObservable {
fn values() -> &'static [Self] { fn values() -> &'static [Self] {
static values: &'static [WorkspaceObservable] = &[ static values: &'static [WorkspaceObservable] = &[
WorkspaceObservable::Unknown, WorkspaceObservable::Unknown,
WorkspaceObservable::WorkspaceUpdateDesc, WorkspaceObservable::UserCreateWorkspace,
WorkspaceObservable::WorkspaceAddApp, WorkspaceObservable::UserDeleteWorkspace,
WorkspaceObservable::AppUpdateDesc, WorkspaceObservable::WorkspaceUpdated,
WorkspaceObservable::AppAddView, WorkspaceObservable::WorkspaceCreateApp,
WorkspaceObservable::ViewUpdateDesc, WorkspaceObservable::WorkspaceDeleteApp,
WorkspaceObservable::AppUpdated,
WorkspaceObservable::AppCreateView,
WorkspaceObservable::AppDeleteView,
WorkspaceObservable::ViewUpdated,
]; ];
values values
} }
@ -86,25 +98,35 @@ impl ::protobuf::reflect::ProtobufValue for WorkspaceObservable {
} }
static file_descriptor_proto_data: &'static [u8] = b"\ static file_descriptor_proto_data: &'static [u8] = b"\
\n\x10observable.proto*\x87\x01\n\x13WorkspaceObservable\x12\x0b\n\x07Un\ \n\x10observable.proto*\xe1\x01\n\x13WorkspaceObservable\x12\x0b\n\x07Un\
known\x10\0\x12\x17\n\x13WorkspaceUpdateDesc\x10\n\x12\x13\n\x0fWorkspac\ known\x10\0\x12\x17\n\x13UserCreateWorkspace\x10\n\x12\x17\n\x13UserDele\
eAddApp\x10\x0b\x12\x11\n\rAppUpdateDesc\x10\x14\x12\x0e\n\nAppAddView\ teWorkspace\x10\x0b\x12\x14\n\x10WorkspaceUpdated\x10\x0c\x12\x16\n\x12W\
\x10\x15\x12\x12\n\x0eViewUpdateDesc\x10\x1eJ\xa0\x02\n\x06\x12\x04\0\0\ orkspaceCreateApp\x10\r\x12\x16\n\x12WorkspaceDeleteApp\x10\x0e\x12\x0e\
\t\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x05\0\x12\x04\x02\0\t\ \n\nAppUpdated\x10\x15\x12\x11\n\rAppCreateView\x10\x17\x12\x11\n\rAppDe\
\x01\n\n\n\x03\x05\0\x01\x12\x03\x02\x05\x18\n\x0b\n\x04\x05\0\x02\0\x12\ leteView\x10\x18\x12\x0f\n\x0bViewUpdated\x10\x1fJ\xc4\x03\n\x06\x12\x04\
\x03\x03\x04\x10\n\x0c\n\x05\x05\0\x02\0\x01\x12\x03\x03\x04\x0b\n\x0c\n\ \0\0\r\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x05\0\x12\x04\x02\0\
\x05\x05\0\x02\0\x02\x12\x03\x03\x0e\x0f\n\x0b\n\x04\x05\0\x02\x01\x12\ \r\x01\n\n\n\x03\x05\0\x01\x12\x03\x02\x05\x18\n\x0b\n\x04\x05\0\x02\0\
\x03\x04\x04\x1d\n\x0c\n\x05\x05\0\x02\x01\x01\x12\x03\x04\x04\x17\n\x0c\ \x12\x03\x03\x04\x10\n\x0c\n\x05\x05\0\x02\0\x01\x12\x03\x03\x04\x0b\n\
\n\x05\x05\0\x02\x01\x02\x12\x03\x04\x1a\x1c\n\x0b\n\x04\x05\0\x02\x02\ \x0c\n\x05\x05\0\x02\0\x02\x12\x03\x03\x0e\x0f\n\x0b\n\x04\x05\0\x02\x01\
\x12\x03\x05\x04\x19\n\x0c\n\x05\x05\0\x02\x02\x01\x12\x03\x05\x04\x13\n\ \x12\x03\x04\x04\x1d\n\x0c\n\x05\x05\0\x02\x01\x01\x12\x03\x04\x04\x17\n\
\x0c\n\x05\x05\0\x02\x02\x02\x12\x03\x05\x16\x18\n\x0b\n\x04\x05\0\x02\ \x0c\n\x05\x05\0\x02\x01\x02\x12\x03\x04\x1a\x1c\n\x0b\n\x04\x05\0\x02\
\x03\x12\x03\x06\x04\x17\n\x0c\n\x05\x05\0\x02\x03\x01\x12\x03\x06\x04\ \x02\x12\x03\x05\x04\x1d\n\x0c\n\x05\x05\0\x02\x02\x01\x12\x03\x05\x04\
\x11\n\x0c\n\x05\x05\0\x02\x03\x02\x12\x03\x06\x14\x16\n\x0b\n\x04\x05\0\ \x17\n\x0c\n\x05\x05\0\x02\x02\x02\x12\x03\x05\x1a\x1c\n\x0b\n\x04\x05\0\
\x02\x04\x12\x03\x07\x04\x14\n\x0c\n\x05\x05\0\x02\x04\x01\x12\x03\x07\ \x02\x03\x12\x03\x06\x04\x1a\n\x0c\n\x05\x05\0\x02\x03\x01\x12\x03\x06\
\x04\x0e\n\x0c\n\x05\x05\0\x02\x04\x02\x12\x03\x07\x11\x13\n\x0b\n\x04\ \x04\x14\n\x0c\n\x05\x05\0\x02\x03\x02\x12\x03\x06\x17\x19\n\x0b\n\x04\
\x05\0\x02\x05\x12\x03\x08\x04\x18\n\x0c\n\x05\x05\0\x02\x05\x01\x12\x03\ \x05\0\x02\x04\x12\x03\x07\x04\x1c\n\x0c\n\x05\x05\0\x02\x04\x01\x12\x03\
\x08\x04\x12\n\x0c\n\x05\x05\0\x02\x05\x02\x12\x03\x08\x15\x17b\x06proto\ \x07\x04\x16\n\x0c\n\x05\x05\0\x02\x04\x02\x12\x03\x07\x19\x1b\n\x0b\n\
3\ \x04\x05\0\x02\x05\x12\x03\x08\x04\x1c\n\x0c\n\x05\x05\0\x02\x05\x01\x12\
\x03\x08\x04\x16\n\x0c\n\x05\x05\0\x02\x05\x02\x12\x03\x08\x19\x1b\n\x0b\
\n\x04\x05\0\x02\x06\x12\x03\t\x04\x14\n\x0c\n\x05\x05\0\x02\x06\x01\x12\
\x03\t\x04\x0e\n\x0c\n\x05\x05\0\x02\x06\x02\x12\x03\t\x11\x13\n\x0b\n\
\x04\x05\0\x02\x07\x12\x03\n\x04\x17\n\x0c\n\x05\x05\0\x02\x07\x01\x12\
\x03\n\x04\x11\n\x0c\n\x05\x05\0\x02\x07\x02\x12\x03\n\x14\x16\n\x0b\n\
\x04\x05\0\x02\x08\x12\x03\x0b\x04\x17\n\x0c\n\x05\x05\0\x02\x08\x01\x12\
\x03\x0b\x04\x11\n\x0c\n\x05\x05\0\x02\x08\x02\x12\x03\x0b\x14\x16\n\x0b\
\n\x04\x05\0\x02\t\x12\x03\x0c\x04\x15\n\x0c\n\x05\x05\0\x02\t\x01\x12\
\x03\x0c\x04\x0f\n\x0c\n\x05\x05\0\x02\t\x02\x12\x03\x0c\x12\x14b\x06pro\
to3\
"; ";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -388,6 +388,7 @@ pub struct View {
pub desc: ::std::string::String, pub desc: ::std::string::String,
pub view_type: ViewType, pub view_type: ViewType,
pub version: i64, pub version: i64,
pub belongings: ::protobuf::SingularPtrField<RepeatedView>,
// special fields // special fields
pub unknown_fields: ::protobuf::UnknownFields, pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize, pub cached_size: ::protobuf::CachedSize,
@ -537,10 +538,48 @@ impl View {
pub fn set_version(&mut self, v: i64) { pub fn set_version(&mut self, v: i64) {
self.version = v; self.version = v;
} }
// .RepeatedView belongings = 7;
pub fn get_belongings(&self) -> &RepeatedView {
self.belongings.as_ref().unwrap_or_else(|| <RepeatedView as ::protobuf::Message>::default_instance())
}
pub fn clear_belongings(&mut self) {
self.belongings.clear();
}
pub fn has_belongings(&self) -> bool {
self.belongings.is_some()
}
// Param is passed by value, moved
pub fn set_belongings(&mut self, v: RepeatedView) {
self.belongings = ::protobuf::SingularPtrField::some(v);
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_belongings(&mut self) -> &mut RepeatedView {
if self.belongings.is_none() {
self.belongings.set_default();
}
self.belongings.as_mut().unwrap()
}
// Take field
pub fn take_belongings(&mut self) -> RepeatedView {
self.belongings.take().unwrap_or_else(|| RepeatedView::new())
}
} }
impl ::protobuf::Message for View { impl ::protobuf::Message for View {
fn is_initialized(&self) -> bool { fn is_initialized(&self) -> bool {
for v in &self.belongings {
if !v.is_initialized() {
return false;
}
};
true true
} }
@ -570,6 +609,9 @@ impl ::protobuf::Message for View {
let tmp = is.read_int64()?; let tmp = is.read_int64()?;
self.version = tmp; self.version = tmp;
}, },
7 => {
::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.belongings)?;
},
_ => { _ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
}, },
@ -600,6 +642,10 @@ impl ::protobuf::Message for View {
if self.version != 0 { if self.version != 0 {
my_size += ::protobuf::rt::value_size(6, self.version, ::protobuf::wire_format::WireTypeVarint); my_size += ::protobuf::rt::value_size(6, self.version, ::protobuf::wire_format::WireTypeVarint);
} }
if let Some(ref v) = self.belongings.as_ref() {
let len = v.compute_size();
my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
}
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
self.cached_size.set(my_size); self.cached_size.set(my_size);
my_size my_size
@ -624,6 +670,11 @@ impl ::protobuf::Message for View {
if self.version != 0 { if self.version != 0 {
os.write_int64(6, self.version)?; os.write_int64(6, self.version)?;
} }
if let Some(ref v) = self.belongings.as_ref() {
os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?;
os.write_raw_varint32(v.get_cached_size())?;
v.write_to_with_cached_sizes(os)?;
}
os.write_unknown_fields(self.get_unknown_fields())?; os.write_unknown_fields(self.get_unknown_fields())?;
::std::result::Result::Ok(()) ::std::result::Result::Ok(())
} }
@ -692,6 +743,11 @@ impl ::protobuf::Message for View {
|m: &View| { &m.version }, |m: &View| { &m.version },
|m: &mut View| { &mut m.version }, |m: &mut View| { &mut m.version },
)); ));
fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<RepeatedView>>(
"belongings",
|m: &View| { &m.belongings },
|m: &mut View| { &mut m.belongings },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<View>( ::protobuf::reflect::MessageDescriptor::new_pb_name::<View>(
"View", "View",
fields, fields,
@ -714,6 +770,7 @@ impl ::protobuf::Clear for View {
self.desc.clear(); self.desc.clear();
self.view_type = ViewType::Blank; self.view_type = ViewType::Blank;
self.version = 0; self.version = 0;
self.belongings.clear();
self.unknown_fields.clear(); self.unknown_fields.clear();
} }
} }
@ -951,14 +1008,15 @@ static file_descriptor_proto_data: &'static [u8] = b"\
long_to_id\x18\x01\x20\x01(\tR\nbelongToId\x12\x12\n\x04name\x18\x02\x20\ long_to_id\x18\x01\x20\x01(\tR\nbelongToId\x12\x12\n\x04name\x18\x02\x20\
\x01(\tR\x04name\x12\x12\n\x04desc\x18\x03\x20\x01(\tR\x04desc\x12\x1e\n\ \x01(\tR\x04name\x12\x12\n\x04desc\x18\x03\x20\x01(\tR\x04desc\x12\x1e\n\
\tthumbnail\x18\x04\x20\x01(\tH\0R\tthumbnail\x12&\n\tview_type\x18\x05\ \tthumbnail\x18\x04\x20\x01(\tH\0R\tthumbnail\x12&\n\tview_type\x18\x05\
\x20\x01(\x0e2\t.ViewTypeR\x08viewTypeB\x12\n\x10one_of_thumbnail\"\xa2\ \x20\x01(\x0e2\t.ViewTypeR\x08viewTypeB\x12\n\x10one_of_thumbnail\"\xd1\
\x01\n\x04View\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12\x20\n\x0cbe\ \x01\n\x04View\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12\x20\n\x0cbe\
long_to_id\x18\x02\x20\x01(\tR\nbelongToId\x12\x12\n\x04name\x18\x03\x20\ long_to_id\x18\x02\x20\x01(\tR\nbelongToId\x12\x12\n\x04name\x18\x03\x20\
\x01(\tR\x04name\x12\x12\n\x04desc\x18\x04\x20\x01(\tR\x04desc\x12&\n\tv\ \x01(\tR\x04name\x12\x12\n\x04desc\x18\x04\x20\x01(\tR\x04desc\x12&\n\tv\
iew_type\x18\x05\x20\x01(\x0e2\t.ViewTypeR\x08viewType\x12\x18\n\x07vers\ iew_type\x18\x05\x20\x01(\x0e2\t.ViewTypeR\x08viewType\x12\x18\n\x07vers\
ion\x18\x06\x20\x01(\x03R\x07version\"+\n\x0cRepeatedView\x12\x1b\n\x05i\ ion\x18\x06\x20\x01(\x03R\x07version\x12-\n\nbelongings\x18\x07\x20\x01(\
tems\x18\x01\x20\x03(\x0b2\x05.ViewR\x05items*\x1e\n\x08ViewType\x12\t\n\ \x0b2\r.RepeatedViewR\nbelongings\"+\n\x0cRepeatedView\x12\x1b\n\x05item\
\x05Blank\x10\0\x12\x07\n\x03Doc\x10\x01J\x81\x07\n\x06\x12\x04\0\0\x17\ s\x18\x01\x20\x03(\x0b2\x05.ViewR\x05items*\x1e\n\x08ViewType\x12\t\n\
\x05Blank\x10\0\x12\x07\n\x03Doc\x10\x01J\xb8\x07\n\x06\x12\x04\0\0\x18\
\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x08\ \x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x08\
\x01\n\n\n\x03\x04\0\x01\x12\x03\x02\x08\x19\n\x0b\n\x04\x04\0\x02\0\x12\ \x01\n\n\n\x03\x04\0\x01\x12\x03\x02\x08\x19\n\x0b\n\x04\x04\0\x02\0\x12\
\x03\x03\x04\x1c\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x03\x04\n\n\x0c\n\ \x03\x03\x04\x1c\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x03\x04\n\n\x0c\n\
@ -975,7 +1033,7 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\x04\0\x02\x03\x03\x12\x03\x0601\n\x0b\n\x04\x04\0\x02\x04\x12\x03\x07\ \x04\0\x02\x03\x03\x12\x03\x0601\n\x0b\n\x04\x04\0\x02\x04\x12\x03\x07\
\x04\x1b\n\x0c\n\x05\x04\0\x02\x04\x06\x12\x03\x07\x04\x0c\n\x0c\n\x05\ \x04\x1b\n\x0c\n\x05\x04\0\x02\x04\x06\x12\x03\x07\x04\x0c\n\x0c\n\x05\
\x04\0\x02\x04\x01\x12\x03\x07\r\x16\n\x0c\n\x05\x04\0\x02\x04\x03\x12\ \x04\0\x02\x04\x01\x12\x03\x07\r\x16\n\x0c\n\x05\x04\0\x02\x04\x03\x12\
\x03\x07\x19\x1a\n\n\n\x02\x04\x01\x12\x04\t\0\x10\x01\n\n\n\x03\x04\x01\ \x03\x07\x19\x1a\n\n\n\x02\x04\x01\x12\x04\t\0\x11\x01\n\n\n\x03\x04\x01\
\x01\x12\x03\t\x08\x0c\n\x0b\n\x04\x04\x01\x02\0\x12\x03\n\x04\x12\n\x0c\ \x01\x12\x03\t\x08\x0c\n\x0b\n\x04\x04\x01\x02\0\x12\x03\n\x04\x12\n\x0c\
\n\x05\x04\x01\x02\0\x05\x12\x03\n\x04\n\n\x0c\n\x05\x04\x01\x02\0\x01\ \n\x05\x04\x01\x02\0\x05\x12\x03\n\x04\n\n\x0c\n\x05\x04\x01\x02\0\x01\
\x12\x03\n\x0b\r\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\n\x10\x11\n\x0b\n\ \x12\x03\n\x0b\r\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\n\x10\x11\n\x0b\n\
@ -993,16 +1051,19 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\x0e\x19\x1a\n\x0b\n\x04\x04\x01\x02\x05\x12\x03\x0f\x04\x16\n\x0c\n\x05\ \x0e\x19\x1a\n\x0b\n\x04\x04\x01\x02\x05\x12\x03\x0f\x04\x16\n\x0c\n\x05\
\x04\x01\x02\x05\x05\x12\x03\x0f\x04\t\n\x0c\n\x05\x04\x01\x02\x05\x01\ \x04\x01\x02\x05\x05\x12\x03\x0f\x04\t\n\x0c\n\x05\x04\x01\x02\x05\x01\
\x12\x03\x0f\n\x11\n\x0c\n\x05\x04\x01\x02\x05\x03\x12\x03\x0f\x14\x15\n\ \x12\x03\x0f\n\x11\n\x0c\n\x05\x04\x01\x02\x05\x03\x12\x03\x0f\x14\x15\n\
\n\n\x02\x04\x02\x12\x04\x11\0\x13\x01\n\n\n\x03\x04\x02\x01\x12\x03\x11\ \x0b\n\x04\x04\x01\x02\x06\x12\x03\x10\x04\x20\n\x0c\n\x05\x04\x01\x02\
\x08\x14\n\x0b\n\x04\x04\x02\x02\0\x12\x03\x12\x04\x1c\n\x0c\n\x05\x04\ \x06\x06\x12\x03\x10\x04\x10\n\x0c\n\x05\x04\x01\x02\x06\x01\x12\x03\x10\
\x02\x02\0\x04\x12\x03\x12\x04\x0c\n\x0c\n\x05\x04\x02\x02\0\x06\x12\x03\ \x11\x1b\n\x0c\n\x05\x04\x01\x02\x06\x03\x12\x03\x10\x1e\x1f\n\n\n\x02\
\x12\r\x11\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x12\x12\x17\n\x0c\n\x05\ \x04\x02\x12\x04\x12\0\x14\x01\n\n\n\x03\x04\x02\x01\x12\x03\x12\x08\x14\
\x04\x02\x02\0\x03\x12\x03\x12\x1a\x1b\n\n\n\x02\x05\0\x12\x04\x14\0\x17\ \n\x0b\n\x04\x04\x02\x02\0\x12\x03\x13\x04\x1c\n\x0c\n\x05\x04\x02\x02\0\
\x01\n\n\n\x03\x05\0\x01\x12\x03\x14\x05\r\n\x0b\n\x04\x05\0\x02\0\x12\ \x04\x12\x03\x13\x04\x0c\n\x0c\n\x05\x04\x02\x02\0\x06\x12\x03\x13\r\x11\
\x03\x15\x04\x0e\n\x0c\n\x05\x05\0\x02\0\x01\x12\x03\x15\x04\t\n\x0c\n\ \n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x13\x12\x17\n\x0c\n\x05\x04\x02\
\x05\x05\0\x02\0\x02\x12\x03\x15\x0c\r\n\x0b\n\x04\x05\0\x02\x01\x12\x03\ \x02\0\x03\x12\x03\x13\x1a\x1b\n\n\n\x02\x05\0\x12\x04\x15\0\x18\x01\n\n\
\x16\x04\x0c\n\x0c\n\x05\x05\0\x02\x01\x01\x12\x03\x16\x04\x07\n\x0c\n\ \n\x03\x05\0\x01\x12\x03\x15\x05\r\n\x0b\n\x04\x05\0\x02\0\x12\x03\x16\
\x05\x05\0\x02\x01\x02\x12\x03\x16\n\x0bb\x06proto3\ \x04\x0e\n\x0c\n\x05\x05\0\x02\0\x01\x12\x03\x16\x04\t\n\x0c\n\x05\x05\0\
\x02\0\x02\x12\x03\x16\x0c\r\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x17\x04\
\x0c\n\x0c\n\x05\x05\0\x02\x01\x01\x12\x03\x17\x04\x07\n\x0c\n\x05\x05\0\
\x02\x01\x02\x12\x03\x17\n\x0bb\x06proto3\
"; ";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -28,6 +28,7 @@ pub struct QueryViewRequest {
// message fields // message fields
pub view_id: ::std::string::String, pub view_id: ::std::string::String,
pub is_trash: bool, pub is_trash: bool,
pub read_belongings: bool,
// special fields // special fields
pub unknown_fields: ::protobuf::UnknownFields, pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize, pub cached_size: ::protobuf::CachedSize,
@ -84,6 +85,21 @@ impl QueryViewRequest {
pub fn set_is_trash(&mut self, v: bool) { pub fn set_is_trash(&mut self, v: bool) {
self.is_trash = v; self.is_trash = v;
} }
// bool read_belongings = 3;
pub fn get_read_belongings(&self) -> bool {
self.read_belongings
}
pub fn clear_read_belongings(&mut self) {
self.read_belongings = false;
}
// Param is passed by value, moved
pub fn set_read_belongings(&mut self, v: bool) {
self.read_belongings = v;
}
} }
impl ::protobuf::Message for QueryViewRequest { impl ::protobuf::Message for QueryViewRequest {
@ -105,6 +121,13 @@ impl ::protobuf::Message for QueryViewRequest {
let tmp = is.read_bool()?; let tmp = is.read_bool()?;
self.is_trash = tmp; self.is_trash = tmp;
}, },
3 => {
if wire_type != ::protobuf::wire_format::WireTypeVarint {
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
}
let tmp = is.read_bool()?;
self.read_belongings = tmp;
},
_ => { _ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
}, },
@ -123,6 +146,9 @@ impl ::protobuf::Message for QueryViewRequest {
if self.is_trash != false { if self.is_trash != false {
my_size += 2; my_size += 2;
} }
if self.read_belongings != false {
my_size += 2;
}
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
self.cached_size.set(my_size); self.cached_size.set(my_size);
my_size my_size
@ -135,6 +161,9 @@ impl ::protobuf::Message for QueryViewRequest {
if self.is_trash != false { if self.is_trash != false {
os.write_bool(2, self.is_trash)?; os.write_bool(2, self.is_trash)?;
} }
if self.read_belongings != false {
os.write_bool(3, self.read_belongings)?;
}
os.write_unknown_fields(self.get_unknown_fields())?; os.write_unknown_fields(self.get_unknown_fields())?;
::std::result::Result::Ok(()) ::std::result::Result::Ok(())
} }
@ -183,6 +212,11 @@ impl ::protobuf::Message for QueryViewRequest {
|m: &QueryViewRequest| { &m.is_trash }, |m: &QueryViewRequest| { &m.is_trash },
|m: &mut QueryViewRequest| { &mut m.is_trash }, |m: &mut QueryViewRequest| { &mut m.is_trash },
)); ));
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
"read_belongings",
|m: &QueryViewRequest| { &m.read_belongings },
|m: &mut QueryViewRequest| { &mut m.read_belongings },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<QueryViewRequest>( ::protobuf::reflect::MessageDescriptor::new_pb_name::<QueryViewRequest>(
"QueryViewRequest", "QueryViewRequest",
fields, fields,
@ -201,6 +235,7 @@ impl ::protobuf::Clear for QueryViewRequest {
fn clear(&mut self) { fn clear(&mut self) {
self.view_id.clear(); self.view_id.clear();
self.is_trash = false; self.is_trash = false;
self.read_belongings = false;
self.unknown_fields.clear(); self.unknown_fields.clear();
} }
} }
@ -218,16 +253,20 @@ impl ::protobuf::reflect::ProtobufValue for QueryViewRequest {
} }
static file_descriptor_proto_data: &'static [u8] = b"\ static file_descriptor_proto_data: &'static [u8] = b"\
\n\x10view_query.proto\"F\n\x10QueryViewRequest\x12\x17\n\x07view_id\x18\ \n\x10view_query.proto\"o\n\x10QueryViewRequest\x12\x17\n\x07view_id\x18\
\x01\x20\x01(\tR\x06viewId\x12\x19\n\x08is_trash\x18\x02\x20\x01(\x08R\ \x01\x20\x01(\tR\x06viewId\x12\x19\n\x08is_trash\x18\x02\x20\x01(\x08R\
\x07isTrashJ\x98\x01\n\x06\x12\x04\0\0\x05\x01\n\x08\n\x01\x0c\x12\x03\0\ \x07isTrash\x12'\n\x0fread_belongings\x18\x03\x20\x01(\x08R\x0ereadBelon\
\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x05\x01\n\n\n\x03\x04\0\x01\x12\x03\ gingsJ\xcf\x01\n\x06\x12\x04\0\0\x06\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\
\x02\x08\x18\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x17\n\x0c\n\x05\x04\ \n\n\n\x02\x04\0\x12\x04\x02\0\x06\x01\n\n\n\x03\x04\0\x01\x12\x03\x02\
\0\x02\0\x05\x12\x03\x03\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03\ \x08\x18\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x17\n\x0c\n\x05\x04\0\
\x0b\x12\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x15\x16\n\x0b\n\x04\x04\ \x02\0\x05\x12\x03\x03\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03\x0b\
\0\x02\x01\x12\x03\x04\x04\x16\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x04\ \x12\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x15\x16\n\x0b\n\x04\x04\0\
\x02\x01\x12\x03\x04\x04\x16\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x04\
\x04\x08\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x04\t\x11\n\x0c\n\x05\x04\ \x04\x08\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x04\t\x11\n\x0c\n\x05\x04\
\0\x02\x01\x03\x12\x03\x04\x14\x15b\x06proto3\ \0\x02\x01\x03\x12\x03\x04\x14\x15\n\x0b\n\x04\x04\0\x02\x02\x12\x03\x05\
\x04\x1d\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\x05\x04\x08\n\x0c\n\x05\
\x04\0\x02\x02\x01\x12\x03\x05\t\x18\n\x0c\n\x05\x04\0\x02\x02\x03\x12\
\x03\x05\x1b\x1cb\x06proto3\
"; ";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -15,7 +15,7 @@ message App {
string workspace_id = 2; string workspace_id = 2;
string name = 3; string name = 3;
string desc = 4; string desc = 4;
RepeatedView views = 5; RepeatedView belongings = 5;
int64 version = 6; int64 version = 6;
} }
message RepeatedApp { message RepeatedApp {

View File

@ -2,6 +2,6 @@ syntax = "proto3";
message QueryAppRequest { message QueryAppRequest {
string app_id = 1; string app_id = 1;
bool read_views = 2; bool read_belongings = 2;
bool is_trash = 3; bool is_trash = 3;
} }

View File

@ -2,9 +2,13 @@ syntax = "proto3";
enum WorkspaceObservable { enum WorkspaceObservable {
Unknown = 0; Unknown = 0;
WorkspaceUpdateDesc = 10; UserCreateWorkspace = 10;
WorkspaceAddApp = 11; UserDeleteWorkspace = 11;
AppUpdateDesc = 20; WorkspaceUpdated = 12;
AppAddView = 21; WorkspaceCreateApp = 13;
ViewUpdateDesc = 30; WorkspaceDeleteApp = 14;
AppUpdated = 21;
AppCreateView = 23;
AppDeleteView = 24;
ViewUpdated = 31;
} }

View File

@ -14,6 +14,7 @@ message View {
string desc = 4; string desc = 4;
ViewType view_type = 5; ViewType view_type = 5;
int64 version = 6; int64 version = 6;
RepeatedView belongings = 7;
} }
message RepeatedView { message RepeatedView {
repeated View items = 1; repeated View items = 1;

View File

@ -3,4 +3,5 @@ syntax = "proto3";
message QueryViewRequest { message QueryViewRequest {
string view_id = 1; string view_id = 1;
bool is_trash = 2; bool is_trash = 2;
bool read_belongings = 3;
} }

View File

@ -36,7 +36,8 @@ impl AppController {
let app_table = AppTable::new(params); let app_table = AppTable::new(params);
let app: App = app_table.clone().into(); let app: App = app_table.clone().into();
let _ = self.sql.create_app(app_table)?; let _ = self.sql.create_app(app_table)?;
send_observable(&app.workspace_id, WorkspaceObservable::WorkspaceAddApp);
send_observable(&app.workspace_id, WorkspaceObservable::WorkspaceCreateApp);
Ok(app) Ok(app)
} }
@ -46,7 +47,8 @@ impl AppController {
} }
pub async fn delete_app(&self, app_id: &str) -> Result<(), WorkspaceError> { pub async fn delete_app(&self, app_id: &str) -> Result<(), WorkspaceError> {
let _ = self.sql.delete_app(app_id)?; let app = self.sql.delete_app(app_id)?;
send_observable(&app.workspace_id, WorkspaceObservable::WorkspaceDeleteApp);
Ok(()) Ok(())
} }
@ -54,7 +56,7 @@ impl AppController {
let changeset = AppTableChangeset::new(params); let changeset = AppTableChangeset::new(params);
let app_id = changeset.id.clone(); let app_id = changeset.id.clone();
let _ = self.sql.update_app(changeset)?; let _ = self.sql.update_app(changeset)?;
send_observable(&app_id, WorkspaceObservable::AppUpdateDesc); send_observable(&app_id, WorkspaceObservable::AppUpdated);
Ok(()) Ok(())
} }

View File

@ -22,7 +22,7 @@ impl ViewController {
let view: View = view_table.clone().into(); let view: View = view_table.clone().into();
let _ = self.sql.create_view(view_table)?; let _ = self.sql.create_view(view_table)?;
send_observable(&view.belong_to_id, WorkspaceObservable::AppAddView); send_observable(&view.belong_to_id, WorkspaceObservable::AppCreateView);
Ok(view) Ok(view)
} }
@ -33,7 +33,8 @@ impl ViewController {
} }
pub async fn delete_view(&self, view_id: &str) -> Result<(), WorkspaceError> { pub async fn delete_view(&self, view_id: &str) -> Result<(), WorkspaceError> {
let _ = self.sql.delete_view(view_id)?; let view = self.sql.delete_view(view_id)?;
send_observable(&view.belong_to_id, WorkspaceObservable::AppDeleteView);
Ok(()) Ok(())
} }
@ -55,7 +56,7 @@ impl ViewController {
let changeset = ViewTableChangeset::new(params); let changeset = ViewTableChangeset::new(params);
let view_id = changeset.id.clone(); let view_id = changeset.id.clone();
let _ = self.sql.update_view(changeset)?; let _ = self.sql.update_view(changeset)?;
send_observable(&view_id, WorkspaceObservable::ViewUpdateDesc); send_observable(&view_id, WorkspaceObservable::ViewUpdated);
Ok(()) Ok(())
} }

View File

@ -35,9 +35,10 @@ impl WorkspaceController {
) -> Result<Workspace, WorkspaceError> { ) -> Result<Workspace, WorkspaceError> {
let user_id = self.user.user_id()?; let user_id = self.user.user_id()?;
let workspace_table = WorkspaceTable::new(params, &user_id); let workspace_table = WorkspaceTable::new(params, &user_id);
let detail: Workspace = workspace_table.clone().into(); let workspace: Workspace = workspace_table.clone().into();
let _ = self.sql.create_workspace(workspace_table)?; let _ = self.sql.create_workspace(workspace_table)?;
Ok(detail) send_observable(&user_id, WorkspaceObservable::UserCreateWorkspace);
Ok(workspace)
} }
pub fn update_workspace(&self, params: UpdateWorkspaceParams) -> Result<(), WorkspaceError> { pub fn update_workspace(&self, params: UpdateWorkspaceParams) -> Result<(), WorkspaceError> {
@ -45,12 +46,15 @@ impl WorkspaceController {
let workspace_id = changeset.id.clone(); let workspace_id = changeset.id.clone();
let _ = self.sql.update_workspace(changeset)?; let _ = self.sql.update_workspace(changeset)?;
send_observable(&workspace_id, WorkspaceObservable::WorkspaceUpdateDesc); send_observable(&workspace_id, WorkspaceObservable::WorkspaceUpdated);
Ok(()) Ok(())
} }
pub fn delete_workspace(&self, _workspace_id: &str) -> Result<(), WorkspaceError> { pub fn delete_workspace(&self, workspace_id: &str) -> Result<(), WorkspaceError> {
unimplemented!() let user_id = self.user.user_id()?;
let _ = self.sql.delete_workspace(workspace_id)?;
send_observable(&user_id, WorkspaceObservable::UserDeleteWorkspace);
Ok(())
} }
pub async fn read_cur_workspace(&self) -> Result<Workspace, WorkspaceError> { pub async fn read_cur_workspace(&self) -> Result<Workspace, WorkspaceError> {

View File

@ -44,10 +44,14 @@ impl AppTableSql {
Ok(app_table) Ok(app_table)
} }
pub(crate) fn delete_app(&self, app_id: &str) -> Result<(), WorkspaceError> { pub(crate) fn delete_app(&self, app_id: &str) -> Result<AppTable, WorkspaceError> {
let conn = self.database.db_connection()?; let conn = self.database.db_connection()?;
// TODO: group into sql transaction
let app_table = dsl::app_table
.filter(app_table::id.eq(app_id))
.first::<AppTable>(&*(self.database.db_connection()?))?;
diesel_delete_table!(app_table, app_id, conn); diesel_delete_table!(app_table, app_id, conn);
Ok(()) Ok(app_table)
} }
// pub(crate) fn read_views_belong_to_app( // pub(crate) fn read_views_belong_to_app(

View File

@ -108,7 +108,7 @@ impl std::convert::Into<App> for AppTable {
workspace_id: self.workspace_id, workspace_id: self.workspace_id,
name: self.name, name: self.name,
desc: self.desc, desc: self.desc,
views: RepeatedView::default(), belongings: RepeatedView::default(),
version: self.version, version: self.version,
} }
} }

View File

@ -52,9 +52,15 @@ impl ViewTableSql {
Ok(()) Ok(())
} }
pub fn delete_view(&self, view_id: &str) -> Result<(), WorkspaceError> { pub(crate) fn delete_view(&self, view_id: &str) -> Result<ViewTable, WorkspaceError> {
let conn = self.database.db_connection()?; let conn = self.database.db_connection()?;
// TODO: group into transaction
let view_table = dsl::view_table
.filter(view_table::id.eq(view_id))
.first::<ViewTable>(&*(self.database.db_connection()?))?;
diesel_delete_table!(view_table, view_id, conn); diesel_delete_table!(view_table, view_id, conn);
Ok(()) Ok(view_table)
} }
} }

View File

@ -1,5 +1,5 @@
use crate::{ use crate::{
entities::view::{CreateViewParams, UpdateViewParams, View, ViewType}, entities::view::{CreateViewParams, RepeatedView, UpdateViewParams, View, ViewType},
impl_sql_integer_expression, impl_sql_integer_expression,
sql_tables::app::AppTable, sql_tables::app::AppTable,
}; };
@ -54,6 +54,7 @@ impl std::convert::Into<View> for ViewTable {
name: self.name, name: self.name,
desc: self.desc, desc: self.desc,
view_type, view_type,
belongings: RepeatedView::default(),
version: self.version, version: self.version,
} }
} }

View File

@ -53,8 +53,8 @@ fn app_create_with_view_and_then_get_success() {
let query = QueryAppRequest::new(&app.id).set_read_views(true); let query = QueryAppRequest::new(&app.id).set_read_views(true);
let view_from_db = read_app(query); let view_from_db = read_app(query);
assert_eq!(view_from_db.views[0], view_a); assert_eq!(view_from_db.belongings[0], view_a);
assert_eq!(view_from_db.views[1], view_b); assert_eq!(view_from_db.belongings[1], view_b);
} }
#[test] #[test]