Skip to content

Commit e157c19

Browse files
authored
docs/update database documentation (#1824)
* chore: update event name * chore: add events and notifications documentation & remove unused code
1 parent 781f0ab commit e157c19

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+253
-411
lines changed

frontend/app_flowy/lib/plugins/board/application/board_listener.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'package:dartz/dartz.dart';
88
import 'package:appflowy_backend/protobuf/flowy-database/group.pb.dart';
99
import 'package:appflowy_backend/protobuf/flowy-database/group_changeset.pb.dart';
1010

11-
typedef GroupUpdateValue = Either<GroupViewChangesetPB, FlowyError>;
11+
typedef GroupUpdateValue = Either<GroupChangesetPB, FlowyError>;
1212
typedef GroupByNewFieldValue = Either<List<GroupPB>, FlowyError>;
1313

1414
class BoardListener {
@@ -36,17 +36,17 @@ class BoardListener {
3636
Either<Uint8List, FlowyError> result,
3737
) {
3838
switch (ty) {
39-
case DatabaseNotification.DidUpdateGroupView:
39+
case DatabaseNotification.DidUpdateGroups:
4040
result.fold(
4141
(payload) => _groupUpdateNotifier?.value =
42-
left(GroupViewChangesetPB.fromBuffer(payload)),
42+
left(GroupChangesetPB.fromBuffer(payload)),
4343
(error) => _groupUpdateNotifier?.value = right(error),
4444
);
4545
break;
46-
case DatabaseNotification.DidGroupByNewField:
46+
case DatabaseNotification.DidGroupByField:
4747
result.fold(
4848
(payload) => _groupByNewFieldNotifier?.value =
49-
left(GroupViewChangesetPB.fromBuffer(payload).initialGroups),
49+
left(GroupChangesetPB.fromBuffer(payload).initialGroups),
5050
(error) => _groupByNewFieldNotifier?.value = right(error),
5151
);
5252
break;

frontend/app_flowy/lib/plugins/board/application/group_listener.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class GroupListener {
3131
Either<Uint8List, FlowyError> result,
3232
) {
3333
switch (ty) {
34-
case DatabaseNotification.DidUpdateGroup:
34+
case DatabaseNotification.DidUpdateGroupRow:
3535
result.fold(
3636
(payload) => _groupNotifier?.value =
3737
left(GroupRowsNotificationPB.fromBuffer(payload)),

frontend/app_flowy/lib/plugins/grid/application/cell/cell_service/cell_data_persistence.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ class DateCellDataPersistence implements GridCellDataPersistence<CalendarData> {
6060
}
6161
}
6262

63-
CellPathPB _makeCellPath(GridCellIdentifier cellId) {
64-
return CellPathPB.create()
63+
CellIdPB _makeCellPath(GridCellIdentifier cellId) {
64+
return CellIdPB.create()
6565
..databaseId = cellId.databaseId
6666
..fieldId = cellId.fieldId
6767
..rowId = cellId.rowId;

frontend/app_flowy/lib/plugins/grid/application/cell/cell_service/cell_service.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class CellService {
4545
Future<Either<CellPB, FlowyError>> getCell({
4646
required GridCellIdentifier cellId,
4747
}) {
48-
final payload = CellPathPB.create()
48+
final payload = CellIdPB.create()
4949
..databaseId = cellId.databaseId
5050
..fieldId = cellId.fieldId
5151
..rowId = cellId.rowId;

frontend/app_flowy/lib/plugins/grid/application/cell/select_option_service.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class SelectOptionFFIService {
2222
(result) {
2323
return result.fold(
2424
(option) {
25-
final cellIdentifier = CellPathPB.create()
25+
final cellIdentifier = CellIdPB.create()
2626
..databaseId = databaseId
2727
..fieldId = fieldId
2828
..rowId = rowId;
@@ -61,7 +61,7 @@ class SelectOptionFFIService {
6161
}
6262

6363
Future<Either<SelectOptionCellDataPB, FlowyError>> getOptionContext() {
64-
final payload = CellPathPB.create()
64+
final payload = CellIdPB.create()
6565
..databaseId = databaseId
6666
..fieldId = fieldId
6767
..rowId = rowId;
@@ -85,8 +85,8 @@ class SelectOptionFFIService {
8585
return DatabaseEventUpdateSelectOptionCell(payload).send();
8686
}
8787

88-
CellPathPB _cellIdentifier() {
89-
return CellPathPB.create()
88+
CellIdPB _cellIdentifier() {
89+
return CellIdPB.create()
9090
..databaseId = databaseId
9191
..fieldId = fieldId
9292
..rowId = rowId;

frontend/app_flowy/lib/plugins/grid/application/field/field_service.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class FieldService {
9797
..databaseId = databaseId
9898
..fieldId = fieldId
9999
..fieldType = fieldType;
100-
return DatabaseEventGetFieldTypeOption(payload).send().then((result) {
100+
return DatabaseEventGetTypeOption(payload).send().then((result) {
101101
return result.fold(
102102
(data) => left(data),
103103
(err) => right(err),

frontend/app_flowy/lib/plugins/grid/application/field/grid_listener.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class DatabaseFieldsListener {
2727

2828
void _handler(DatabaseNotification ty, Either<Uint8List, FlowyError> result) {
2929
switch (ty) {
30-
case DatabaseNotification.DidUpdateDatabaseFields:
30+
case DatabaseNotification.DidUpdateFields:
3131
result.fold(
3232
(payload) => updateFieldsNotifier?.value =
3333
left(DatabaseFieldChangesetPB.fromBuffer(payload)),

frontend/app_flowy/lib/plugins/grid/application/field/type_option/type_option_context.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ abstract class IFieldTypeOptionLoader {
160160

161161
Future<Either<Unit, FlowyError>> switchToField(
162162
String fieldId, FieldType fieldType) {
163-
final payload = EditFieldChangesetPB.create()
163+
final payload = UpdateFieldTypePayloadPB.create()
164164
..databaseId = databaseId
165165
..fieldId = fieldId
166166
..fieldType = fieldType;
167167

168-
return DatabaseEventSwitchToField(payload).send();
168+
return DatabaseEventUpdateFieldType(payload).send();
169169
}
170170
}
171171

@@ -189,13 +189,13 @@ class NewFieldTypeOptionLoader extends IFieldTypeOptionLoader {
189189
..fieldId = fieldTypeOption!.field_2.id
190190
..fieldType = fieldTypeOption!.field_2.fieldType;
191191

192-
return DatabaseEventGetFieldTypeOption(payload).send();
192+
return DatabaseEventGetTypeOption(payload).send();
193193
} else {
194194
final payload = CreateFieldPayloadPB.create()
195195
..databaseId = databaseId
196196
..fieldType = FieldType.RichText;
197197

198-
return DatabaseEventCreateFieldTypeOption(payload).send().then((result) {
198+
return DatabaseEventCreateTypeOption(payload).send().then((result) {
199199
return result.fold(
200200
(newFieldTypeOption) {
201201
fieldTypeOption = newFieldTypeOption;
@@ -226,6 +226,6 @@ class FieldTypeOptionLoader extends IFieldTypeOptionLoader {
226226
..fieldId = field.id
227227
..fieldType = field.fieldType;
228228

229-
return DatabaseEventGetFieldTypeOption(payload).send();
229+
return DatabaseEventGetTypeOption(payload).send();
230230
}
231231
}

frontend/app_flowy/lib/plugins/grid/application/field/type_option/type_option_service.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ class TypeOptionFFIService {
2121
..databaseId = databaseId
2222
..fieldId = fieldId;
2323

24-
return DatabaseEventNewSelectOption(payload).send();
24+
return DatabaseEventCreateSelectOption(payload).send();
2525
}
2626
}

frontend/app_flowy/lib/plugins/grid/application/grid_service.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ class DatabaseFFIService {
2121
}
2222

2323
Future<Either<RowPB, FlowyError>> createRow({Option<String>? startRowId}) {
24-
var payload = CreateTableRowPayloadPB.create()..databaseId = databaseId;
24+
var payload = CreateRowPayloadPB.create()..databaseId = databaseId;
2525
startRowId?.fold(() => null, (id) => payload.startRowId = id);
26-
return DatabaseEventCreateTableRow(payload).send();
26+
return DatabaseEventCreateRow(payload).send();
2727
}
2828

2929
Future<Either<RowPB, FlowyError>> createBoardCard(

0 commit comments

Comments
 (0)