File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -113,8 +113,34 @@ export class ArchiverService {
113113 await this . processItems ( items , archivedStatus ) ;
114114 }
115115
116+ async getFeedsWithTakedownStatus ( ) : Promise < Feed [ ] > {
117+ return this . feedRepositoryRead . find ( {
118+ where : {
119+ feed_flag_status : {
120+ id : FeedFlagStatusStatusEnum . Takedown ,
121+ } ,
122+ } ,
123+ relations : [ 'channel' , 'channel.items' , 'feed_flag_status' ] ,
124+ } ) ;
125+ }
126+
127+ async removeAllItemsForTakedownFeeds ( ) : Promise < void > {
128+ const feeds = await this . getFeedsWithTakedownStatus ( ) ;
129+ for ( const feed of feeds ) {
130+ const channel = feed . channel ;
131+ if ( ! channel || ! channel . items || channel . items . length === 0 ) {
132+ continue ;
133+ }
134+ const itemIds = channel . items . map ( item => item . id ) ;
135+ if ( itemIds . length > 0 ) {
136+ await this . itemRepositoryReadWrite . delete ( itemIds ) ;
137+ }
138+ }
139+ }
140+
116141 async archiveAll ( ) : Promise < void > {
117142 await this . processPendingArchiveFeeds ( ) ;
118143 await this . processPendingArchiveItems ( ) ;
144+ await this . removeAllItemsForTakedownFeeds ( ) ;
119145 }
120146}
You can’t perform that action at this time.
0 commit comments