Skip to content

Commit c25132c

Browse files
author
Nevo David
committed
feat: save post
1 parent 3bfac7a commit c25132c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

libraries/nestjs-libraries/src/integrations/social/bluesky.provider.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
116116

117117
let loadCid = '';
118118
let loadUri = '';
119+
const cidUrl = [] as { cid: string; url: string, rev: string }[];
119120
for (const post of postDetails) {
120121
const images = await Promise.all(
121122
post.media?.map(async (p) => {
@@ -129,7 +130,8 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
129130
}) || []
130131
);
131132

132-
const { cid, uri } = await agent.post({
133+
// @ts-ignore
134+
const { cid, uri, commit } = await agent.post({
133135
text: post.message,
134136
createdAt: new Date().toISOString(),
135137
...(images.length
@@ -162,8 +164,15 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
162164

163165
loadCid = loadCid || cid;
164166
loadUri = loadUri || uri;
167+
168+
cidUrl.push({ cid, url: uri, rev: commit.rev });
165169
}
166170

167-
return [];
171+
return postDetails.map((p, index) => ({
172+
id: p.id,
173+
postId: cidUrl[index].cid,
174+
status: 'completed',
175+
releaseURL: `https://bsky.app/profile/${id}/post/${cidUrl[index].url.split('/').pop()}`,
176+
}));
168177
}
169178
}

0 commit comments

Comments
 (0)