Skip to content

Commit 31a03ee

Browse files
committed
updates
1 parent 45f442a commit 31a03ee

File tree

3 files changed

+19
-36
lines changed

3 files changed

+19
-36
lines changed

components/asters/sources/common/base.mjs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export default {
2424
generateMeta() {
2525
throw new ConfigurationError("generateMeta must be implemented");
2626
},
27-
processResource() {
28-
throw new ConfigurationError("processResource must be implemented");
27+
processResources() {
28+
throw new ConfigurationError("processResources must be implemented");
2929
},
3030
},
3131
async run() {
@@ -34,8 +34,6 @@ export default {
3434
args: this.getArgs(),
3535
});
3636

37-
for (const resource of resources) {
38-
await this.processResource(resource);
39-
}
37+
await this.processResources(resources);
4038
},
4139
};

components/asters/sources/new-label-added/new-label-added.mjs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,18 @@ export default {
4545
},
4646
};
4747
},
48-
async processResource(post) {
49-
const { labels = [] } = post;
50-
for (const label of labels) {
51-
const meta = this.generateMeta(post, label);
52-
this.$emit(post, meta);
48+
async processResources(posts) {
49+
const { data: allLabels } = await this.asters.listLabels({
50+
workspaceId: this.workspaceId,
51+
});
52+
53+
for (const post of posts) {
54+
const { labels = [] } = post;
55+
for (const label of labels) {
56+
const postLabel = allLabels.find((l) => l._id === label._id);
57+
const meta = this.generateMeta(post, label);
58+
this.$emit(postLabel, meta);
59+
}
5360
}
5461
},
5562
generateMeta(post, label) {
Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
11
export default {
2-
"_id": "67f1426b5d81d91673b9b2db",
3-
"variantId": "faej60xwwyw",
4-
"text": "Not just a dog — a heartbeat at our feet, a soul at peace 🐶✨",
5-
"status": "published",
6-
"medias": [
7-
{
8-
"_id": "67dc38ae012dabdb705d4d53",
9-
"type": "file",
10-
"mimetype": "video/mp4",
11-
"name": "67dc2d88012dabdb705c51c9_Snapinst.app_video_AQPuuFqL4SkuU-iT7VBhx7VJvkRGUc6ozCJduveEHszAI4J_FzTG55DCxnF3M1kjzXRey-bN5f6n5CyUUvnW-4yQJh_cwiBhZDCOXs4.mp4",
12-
"url": "https://asters.s3.eu-central-1.amazonaws.com/67dc2d88012dabdb705c51c9_Snapinst.app_video_AQPuuFqL4SkuU-iT7VBhx7VJvkRGUc6ozCJduveEHszAI4J_FzTG55DCxnF3M1kjzXRey-bN5f6n5CyUUvnW-4yQJh_cwiBhZDCOXs4.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIA5OA4V6PRA7YCYIRG%2F20250430%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20250430T103322Z&X-Amz-Expires=86400&X-Amz-Signature=20c24be9d5ea45b5fda3d13463e7c9ea91b2813b3541126ebfbdc97b4d97eaa7&X-Amz-SignedHeaders=host&response-cache-control=No-cache&response-content-disposition=attachment%3B%20filename%3D%2267dc2d88012dabdb705c51c9_Snapinst.app_video_AQPuuFqL4SkuU-iT7VBhx7VJvkRGUc6ozCJduveEHszAI4J_FzTG55DCxnF3M1kjzXRey-bN5f6n5CyUUvnW-4yQJh_cwiBhZDCOXs4.mp4%22",
13-
},
14-
],
15-
"urls": [],
16-
"labels": [
17-
{
18-
"_id": "6811f76c3aa4bf3deb1e940b",
19-
},
20-
],
21-
"socialIdentifier": "18032713838636836",
22-
"socialLink": "https://www.instagram.com/reel/DIEZuNpi46I/",
23-
"publishDate": "2025-04-05T14:47:07.015Z",
24-
"isAutopilot": false,
25-
"user": "67dc2d88012dabdb705c51c9",
26-
"workspace": "67dc2eda012dabdb705c7970",
27-
};
2+
"_id": "68656e18071c9698f12dcdeb",
3+
"label": "label1",
4+
"color": "blue"
5+
}

0 commit comments

Comments
 (0)