| 
									
										
										
										
											2023-03-24 09:13:35 +01:00
										 |  |  | module.exports = () => { | 
					
						
							|  |  |  |     const beccaLoader = require("../../src/becca/becca_loader"); | 
					
						
							|  |  |  |     const becca = require("../../src/becca/becca"); | 
					
						
							|  |  |  |     const cls = require("../../src/services/cls"); | 
					
						
							|  |  |  |     const log = require("../../src/services/log"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     cls.init(() => { | 
					
						
							|  |  |  |         beccaLoader.load(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         for (const note of Object.values(becca.notes)) { | 
					
						
							|  |  |  |             try { | 
					
						
							|  |  |  |                 const attachment = note.convertToParentAttachment({force: false}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-30 23:48:26 +02:00
										 |  |  |                 if (attachment) { | 
					
						
							|  |  |  |                     log.info(`Auto-converted note '${note.noteId}' into attachment '${attachment.attachmentId}'.`); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-03-24 09:13:35 +01:00
										 |  |  |             } | 
					
						
							|  |  |  |             catch (e) { | 
					
						
							|  |  |  |                 log.error(`Cannot convert note '${note.noteId}' to attachment: ${e.message} ${e.stack}`); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2023-03-30 23:48:26 +02:00
										 |  |  | }; |