@@ -195,6 +195,23 @@ const formatPost = async (
195
195
authors . push ( author ) ;
196
196
}
197
197
}
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
+ }
198
215
post = {
199
216
...post ,
200
217
_id : q ?. id ? q . id : null ,
@@ -208,21 +225,12 @@ const formatPost = async (
208
225
: `${ q ?. properties ?. title ?. title
209
226
. map ( ( t : any ) => t . plain_text )
210
227
. 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
+ } ,
226
234
coverVideo : q ?. properties ?. youtube ?. url
227
235
? { url : q . properties . youtube . url }
228
236
: null ,
@@ -284,7 +292,6 @@ const formatPost = async (
284
292
285
293
// Get sections and lessons for course
286
294
if ( _type == PostType . course && ! list ) {
287
- console . log ( 'got list' ) ;
288
295
const sectionsRaw = await querySectionsByCourseId ( q . id , preview ) ;
289
296
let sections : any = [ ] ;
290
297
for ( const s of sectionsRaw . results as any ) {
@@ -880,7 +887,6 @@ export const getPurrfectStreamPageBlocks = async ({
880
887
formatBlock ( { type : 'heading_2' , content : 'Purrfect Picks' } ) ,
881
888
] ;
882
889
picks . map ( ( p ) => {
883
- console . log ( 'p' , p ) ;
884
890
pickBlocks = [
885
891
...pickBlocks ,
886
892
formatBlock ( { type : 'heading_3' , content : p ?. name || 'Guest' } ) ,
0 commit comments