mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-23 17:11:23 +00:00

* feat: enable group condition * style: added i18n for date field group conditions * fix: flutter analyze * fix: test use i18n * fix: more localization --------- Co-authored-by: Mathias Mogensen <42929161+Xazin@users.noreply.github.com> Co-authored-by: Mathias Mogensen <mathias@appflowy.io>
64 lines
1.6 KiB
Dart
64 lines
1.6 KiB
Dart
import 'package:appflowy_backend/dispatch/dispatch.dart';
|
|
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
|
|
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
|
|
import 'package:appflowy_result/appflowy_result.dart';
|
|
|
|
class GroupBackendService {
|
|
GroupBackendService(this.viewId);
|
|
|
|
final String viewId;
|
|
|
|
Future<FlowyResult<void, FlowyError>> groupByField({
|
|
required String fieldId,
|
|
required List<int> settingContent,
|
|
}) {
|
|
final payload = GroupByFieldPayloadPB.create()
|
|
..viewId = viewId
|
|
..fieldId = fieldId
|
|
..settingContent = settingContent;
|
|
|
|
return DatabaseEventSetGroupByField(payload).send();
|
|
}
|
|
|
|
Future<FlowyResult<void, FlowyError>> updateGroup({
|
|
required String groupId,
|
|
required String fieldId,
|
|
String? name,
|
|
bool? visible,
|
|
}) {
|
|
final payload = UpdateGroupPB.create()
|
|
..fieldId = fieldId
|
|
..viewId = viewId
|
|
..groupId = groupId;
|
|
|
|
if (name != null) {
|
|
payload.name = name;
|
|
}
|
|
if (visible != null) {
|
|
payload.visible = visible;
|
|
}
|
|
return DatabaseEventUpdateGroup(payload).send();
|
|
}
|
|
|
|
Future<FlowyResult<void, FlowyError>> createGroup({
|
|
required String name,
|
|
String groupConfigId = "",
|
|
}) {
|
|
final payload = CreateGroupPayloadPB.create()
|
|
..viewId = viewId
|
|
..name = name;
|
|
|
|
return DatabaseEventCreateGroup(payload).send();
|
|
}
|
|
|
|
Future<FlowyResult<void, FlowyError>> deleteGroup({
|
|
required String groupId,
|
|
}) {
|
|
final payload = DeleteGroupPayloadPB.create()
|
|
..viewId = viewId
|
|
..groupId = groupId;
|
|
|
|
return DatabaseEventDeleteGroup(payload).send();
|
|
}
|
|
}
|