mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 14:53:59 +01:00 
			
		
		
		
	implement a method to delete Place entity from database
This commit is contained in:
		
							parent
							
								
									46f60e5643
								
							
						
					
					
						commit
						5985e9ad9c
					
				
					 3 changed files with 20 additions and 0 deletions
				
			
		|  | @ -1,6 +1,7 @@ | ||||||
| package fr.free.nrw.commons.nearby; | package fr.free.nrw.commons.nearby; | ||||||
| 
 | 
 | ||||||
| import androidx.room.Dao; | import androidx.room.Dao; | ||||||
|  | import androidx.room.Delete; | ||||||
| import androidx.room.Insert; | import androidx.room.Insert; | ||||||
| import androidx.room.OnConflictStrategy; | import androidx.room.OnConflictStrategy; | ||||||
| import androidx.room.Query; | import androidx.room.Query; | ||||||
|  | @ -24,6 +25,12 @@ public abstract class PlaceDao { | ||||||
|     @Insert(onConflict = OnConflictStrategy.REPLACE) |     @Insert(onConflict = OnConflictStrategy.REPLACE) | ||||||
|     public abstract void saveSynchronous(Place place); |     public abstract void saveSynchronous(Place place); | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Deletes a Place object from the database | ||||||
|  |      * based on the provided entity. | ||||||
|  |      */ | ||||||
|  |     @Delete | ||||||
|  |     public abstract void deletePlace(Place place); | ||||||
|     /** |     /** | ||||||
|      * Retrieves a Place object from the database based on the provided entity ID. |      * Retrieves a Place object from the database based on the provided entity ID. | ||||||
|      * |      * | ||||||
|  |  | ||||||
|  | @ -36,4 +36,11 @@ public class PlacesLocalDataSource { | ||||||
|     public Completable savePlace(Place place) { |     public Completable savePlace(Place place) { | ||||||
|         return placeDao.save(place); |         return placeDao.save(place); | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Deletes a Place object from the database | ||||||
|  |      * based on the provided entity. | ||||||
|  |      */ | ||||||
|  |     public void  deletePlace(final Place place) {placeDao.deletePlace(place);} | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -38,4 +38,10 @@ public class PlacesRepository { | ||||||
|         return localDataSource.fetchPlace(entityID); |         return localDataSource.fetchPlace(entityID); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Deletes a Place object from the database | ||||||
|  |      * based on the provided entity. | ||||||
|  |      */ | ||||||
|  |     public void deletePlace(final Place place){ localDataSource.deletePlace(place);} | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Christo Joby Antony
						Christo Joby Antony