✌️
This commit is contained in:
		
							parent
							
								
									b5acf15877
								
							
						
					
					
						commit
						e7dd74a443
					
				
					 1 changed files with 6 additions and 2 deletions
				
			
		| 
						 | 
					@ -201,7 +201,10 @@ const addFile = async (
 | 
				
			||||||
			// Calculate drive usage
 | 
								// Calculate drive usage
 | 
				
			||||||
			const usage = await DriveFile
 | 
								const usage = await DriveFile
 | 
				
			||||||
				.aggregate([{
 | 
									.aggregate([{
 | 
				
			||||||
					$match: { 'metadata.userId': user._id }
 | 
										$match: {
 | 
				
			||||||
 | 
											'metadata.userId': user._id,
 | 
				
			||||||
 | 
											'metadata.deletedAt': { $exists: false }
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
				}, {
 | 
									}, {
 | 
				
			||||||
					$project: {
 | 
										$project: {
 | 
				
			||||||
						length: true
 | 
											length: true
 | 
				
			||||||
| 
						 | 
					@ -245,7 +248,8 @@ const addFile = async (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
						DriveFile.update({ _id: oldFile._id }, {
 | 
											DriveFile.update({ _id: oldFile._id }, {
 | 
				
			||||||
							$set: {
 | 
												$set: {
 | 
				
			||||||
								'metadata.deletedAt': new Date()
 | 
													'metadata.deletedAt': new Date(),
 | 
				
			||||||
 | 
													'metadata.isExpired': true
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
						});
 | 
											});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue