Skip to content

Commit bb882f7

Browse files
committed
remove console logs
1 parent e9ee9ec commit bb882f7

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

frontend/main/src/services/notion.server.ts

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,23 @@ const formatPost = async (
195195
authors.push(author);
196196
}
197197
}
198+
const coverSegments = q?.cover?.external?.url.split('/');
199+
let coverPublicId = '';
200+
201+
for (let i = coverSegments?.length; i--; i === 0) {
202+
const segment = coverSegments.at(i);
203+
if (
204+
[
205+
'main-codingcatdev-photo',
206+
'ccd-cloudinary',
207+
'dev-codingcatdev-photo',
208+
].includes(segment)
209+
) {
210+
coverPublicId = `/${segment}/${coverPublicId}`;
211+
break;
212+
}
213+
coverPublicId = `${segment}${coverPublicId ? '/' : ''}${coverPublicId}`;
214+
}
198215
post = {
199216
...post,
200217
_id: q?.id ? q.id : null,
@@ -208,21 +225,12 @@ const formatPost = async (
208225
: `${q?.properties?.title?.title
209226
.map((t: any) => t.plain_text)
210227
.join('')}`,
211-
coverPhoto:
212-
_type == PostType.podcast
213-
? {
214-
secure_url: q?.cover?.external?.url || null,
215-
public_id: q?.cover?.external?.url
216-
? q?.cover?.external?.url.split('upload/').at(1)
217-
: null,
218-
}
219-
: {
220-
secure_url: q?.properties?.cover?.url || null,
221-
public_id: q?.properties?.cover?.url
222-
? q?.properties?.cover.url.split('upload/')?.at(1) ||
223-
q?.properties?.cover?.url
224-
: null,
225-
},
228+
coverPhoto: {
229+
secure_url: coverPublicId
230+
? `https://media.codingcat.dev/image/upload${coverPublicId}`
231+
: null,
232+
public_id: coverPublicId ? `${coverPublicId}` : null,
233+
},
226234
coverVideo: q?.properties?.youtube?.url
227235
? { url: q.properties.youtube.url }
228236
: null,
@@ -284,7 +292,6 @@ const formatPost = async (
284292

285293
// Get sections and lessons for course
286294
if (_type == PostType.course && !list) {
287-
console.log('got list');
288295
const sectionsRaw = await querySectionsByCourseId(q.id, preview);
289296
let sections: any = [];
290297
for (const s of sectionsRaw.results as any) {
@@ -880,7 +887,6 @@ export const getPurrfectStreamPageBlocks = async ({
880887
formatBlock({ type: 'heading_2', content: 'Purrfect Picks' }),
881888
];
882889
picks.map((p) => {
883-
console.log('p', p);
884890
pickBlocks = [
885891
...pickBlocks,
886892
formatBlock({ type: 'heading_3', content: p?.name || 'Guest' }),

0 commit comments

Comments
 (0)