Skip to content

Commit 9a85592

Browse files
authored
fix: profile picture sync (#949)
1 parent 2dbe070 commit 9a85592

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

platforms/profile-editor/api/src/services/EVaultSyncService.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,38 +89,44 @@ export class EVaultSyncService {
8989
const profile = await this.evaultService.getProfile(ename);
9090
console.log(`[sync] ${ename}: avatar=${profile.professional.avatar ?? "NONE"} banner=${profile.professional.banner ?? "NONE"}`);
9191

92-
await this.userSearchService.upsertFromWebhook({
92+
const data: any = {
9393
ename,
9494
name: profile.name,
9595
handle: profile.handle,
9696
isVerified: profile.isVerified ?? false,
9797
bio: profile.professional.bio,
9898
headline: profile.professional.headline,
9999
location: profile.professional.location,
100-
avatar: profile.professional.avatar,
101-
banner: profile.professional.banner,
102100
skills: profile.professional.skills,
103101
isPublic: profile.professional.isPublic === true,
104102
isArchived: false,
105-
});
103+
};
104+
105+
if (profile.professional.avatar) data.avatar = profile.professional.avatar;
106+
if (profile.professional.banner) data.banner = profile.professional.banner;
107+
108+
await this.userSearchService.upsertFromWebhook(data);
106109
}
107110

108111
/** Sync a single user's profile to the local search DB from the profile cache. */
109112
syncUserToSearchDb(profile: import("../types/profile").FullProfile): void {
110-
this.userSearchService.upsertFromWebhook({
113+
const data: any = {
111114
ename: profile.ename,
112115
name: profile.name,
113116
handle: profile.handle,
114117
isVerified: profile.isVerified ?? false,
115118
bio: profile.professional.bio,
116119
headline: profile.professional.headline,
117120
location: profile.professional.location,
118-
avatar: profile.professional.avatar,
119-
banner: profile.professional.banner,
120121
skills: profile.professional.skills,
121122
isPublic: profile.professional.isPublic === true,
122123
isArchived: false,
123-
}).catch((err) => {
124+
};
125+
126+
if (profile.professional.avatar) data.avatar = profile.professional.avatar;
127+
if (profile.professional.banner) data.banner = profile.professional.banner;
128+
129+
this.userSearchService.upsertFromWebhook(data).catch((err) => {
124130
console.error(`[search-db sync] ${profile.ename}:`, err.message);
125131
});
126132
}

0 commit comments

Comments
 (0)