Skip to content

Commit f46b2e6

Browse files
committed
fix: rename type to threadId for clarity
1 parent f5f9977 commit f46b2e6

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

package/src/store/apis/addPendingTask.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ import { SqliteClient } from '../SqliteClient';
1414
*/
1515
export const addPendingTask = async (task: PendingTask) => {
1616
const storable = mapTaskToStorable(task);
17-
const { channelId, channelType, parentId, payload, type } = storable;
17+
const { channelId, channelType, threadId, payload, type } = storable;
1818
const queries = [];
1919
if (type === 'create-draft' || type === 'delete-draft') {
2020
// Only one draft pending task is allowed per entity (i.e thread, channel etc).
2121
// If multiple arrive, we'll simply take the last one (since deleteDraft does not
2222
// fail as an API if a draft doesn't exist).
23-
queries.push(createDeleteQuery('pendingTasks', { channelId, channelType, parentId }));
23+
queries.push(createDeleteQuery('pendingTasks', { channelId, channelType, threadId }));
2424
}
2525
queries.push(createUpsertQuery('pendingTasks', storable));
2626
SqliteClient.logger?.('info', 'addPendingTask', {

package/src/store/mappers/mapStorableToTask.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import { PendingTask } from 'stream-chat';
33
import type { TableRowJoinedUser } from '../types';
44

55
export const mapStorableToTask = (row: TableRowJoinedUser<'pendingTasks'>): PendingTask => {
6-
const { channelId, channelType, parentId, id, messageId, type } = row;
6+
const { channelId, channelType, threadId, id, messageId, type } = row;
77
return {
88
channelId,
99
channelType,
1010
id,
1111
messageId,
12-
parentId,
1312
payload: JSON.parse(row.payload),
13+
threadId,
1414
type,
1515
};
1616
};

package/src/store/schema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ export const tables: Tables = {
175175
createdAt: 'TEXT',
176176
id: 'INTEGER PRIMARY KEY AUTOINCREMENT',
177177
messageId: 'TEXT',
178-
parentId: 'TEXT',
179178
payload: 'TEXT',
179+
threadId: 'TEXT',
180180
type: 'TEXT',
181181
},
182182
},
@@ -368,7 +368,7 @@ export type Schema = {
368368
createdAt: string;
369369
id: number;
370370
messageId: string;
371-
parentId: string;
371+
threadId: string;
372372
payload: string;
373373
type: ValueOf<PendingTaskTypes>;
374374
};

0 commit comments

Comments
 (0)