Skip to content

Commit 1a0fcc3

Browse files
committed
fix(save-user-data): Fix updating favorite aggregations for Compass Web
1 parent a71b8dc commit 1a0fcc3

File tree

3 files changed

+6
-24
lines changed

3 files changed

+6
-24
lines changed

packages/compass-user-data/src/user-data.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ export class AtlasUserData<T extends z.Schema> extends IUserData<T> {
373373
data: [],
374374
errors: [],
375375
};
376-
// debugger;
377376
try {
378377
const response = await this.authenticatedFetch(
379378
this.getResourceUrl(

packages/my-queries-storage/src/compass-pipeline-storage.ts

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ export class CompassPipelineStorage implements PipelineStorage {
4848
try {
4949
const { data } = await this.userData.readAll();
5050
return data;
51-
const { data } = await this.userData.readAll();
52-
return data;
5351
} catch {
5452
return [];
5553
}
@@ -73,31 +71,17 @@ export class CompassPipelineStorage implements PipelineStorage {
7371
}
7472

7573
async create(data: Omit<SavedPipeline, 'lastModified'>): Promise<boolean> {
76-
try {
77-
await this.userData.write(data.id, {
78-
...data,
79-
lastModified: Date.now(),
80-
});
81-
return true;
82-
} catch {
83-
return false;
84-
}
74+
return await this.userData.write(data.id, {
75+
...data,
76+
lastModified: Date.now(),
77+
});
8578
}
8679

8780
async updateAttributes(
8881
id: string,
8982
attributes: Partial<SavedPipeline>
9083
): Promise<boolean> {
91-
try {
92-
await this.userData.write(id, {
93-
...(await this.userData.readOne(id)),
94-
...attributes,
95-
lastModified: Date.now(),
96-
});
97-
return true;
98-
} catch {
99-
return false;
100-
}
84+
return await this.userData.updateAttributes(id, attributes);
10185
}
10286

10387
async delete(id: string) {

packages/my-queries-storage/src/pipeline-storage-schema.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ export const PipelineSchema = z.preprocess(
6161
host: z.string().nullable().optional(),
6262
pipelineText: z.string(),
6363
lastModified: z
64-
.number()
65-
.default(0)
64+
.union([z.coerce.date(), z.number()])
6665
.transform((x) => new Date(x)),
6766
})
6867
);

0 commit comments

Comments
 (0)