Jelajahi Sumber

fix: create kanban board row

appflowy 2 tahun lalu
induk
melakukan
34cb2b2a09

+ 13 - 4
frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_bd_svc.ts

@@ -39,10 +39,19 @@ export class DatabaseBackendService {
     return FolderEventCloseView(payload);
   };
 
-  createRow = async (rowId?: string, groupId?: string) => {
-    const payload = CreateRowPayloadPB.fromObject({ view_id: this.viewId, start_row_id: rowId ?? undefined });
-    if (groupId !== undefined) {
-      payload.group_id = groupId;
+  /// Create a row in database
+  /// 1.The row will be the last row in database if the params is undefined
+  /// 2.The row will be placed after the passed-in rowId
+  /// 3.The row will be moved to the group with groupId. Currently, grouping is
+  /// only support in kanban board.
+  createRow = async (params?: { rowId?: string; groupId?: string }) => {
+    const payload = CreateRowPayloadPB.fromObject({ view_id: this.viewId });
+    if (params?.rowId !== undefined) {
+      payload.start_row_id = params.rowId;
+    }
+
+    if (params?.groupId !== undefined) {
+      payload.group_id = params.groupId;
     }
     return DatabaseEventCreateRow(payload);
   };

+ 1 - 1
frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/group/group_controller.ts

@@ -94,7 +94,7 @@ export class DatabaseGroupController {
   };
 
   createRow = async () => {
-    return this.databaseBackendSvc.createRow(this.group.group_id);
+    return this.databaseBackendSvc.createRow({ groupId: this.group.group_id });
   };
 
   subscribe = (callbacks: GroupDataCallbacks) => {