@@ -96,34 +96,34 @@ export async function GET() {
9696
9797 return yield * Effect . all (
9898 notificationsWithAuthors . map ( ( { notification, author } ) =>
99- Effect . fn ( function * ( ) {
100- try {
101- // all notifications currently require an author
102- if ( ! author ) return null ;
99+ Effect . gen ( function * ( ) {
100+ // all notifications currently require an author
101+ if ( ! author ) return null ;
103102
104- const resolvedAvatar = author . avatar
105- ? yield * imageUploads . resolveImageUrl ( author . avatar )
106- : null ;
103+ const resolvedAvatar = author . avatar
104+ ? yield * imageUploads . resolveImageUrl ( author . avatar )
105+ : null ;
107106
108- return APINotification . parse ( {
109- id : notification . id ,
110- type : notification . type ,
111- readAt : notification . readAt ,
112- videoId : notification . data . videoId ,
113- createdAt : notification . createdAt ,
114- data : notification . data ,
115- comment : notification . data . comment ,
116- author : {
117- id : author . id ,
118- name : author . name ?? "Unknown" ,
119- avatar : resolvedAvatar ,
120- } ,
121- } ) ;
122- } catch ( error ) {
107+ return APINotification . parse ( {
108+ id : notification . id ,
109+ type : notification . type ,
110+ readAt : notification . readAt ,
111+ videoId : notification . data . videoId ,
112+ createdAt : notification . createdAt ,
113+ data : notification . data ,
114+ comment : notification . data . comment ,
115+ author : {
116+ id : author . id ,
117+ name : author . name ?? "Unknown" ,
118+ avatar : resolvedAvatar ,
119+ } ,
120+ } ) ;
121+ } ) . pipe (
122+ Effect . catchAll ( ( error ) => {
123123 console . error ( "Invalid notification data:" , error ) ;
124- return null ;
125- }
126- } ) ( ) ,
124+ return Effect . succeed ( null ) ;
125+ } ) ,
126+ ) ,
127127 ) ,
128128 ) ;
129129 } )
0 commit comments