Class FacilityController
java.lang.Object
com.example.iconic_raffleevent.controller.FacilityController
FacilityController handles the business logic related to facilities.
It facilitates operations like creating, fetching, checking, and deleting facilities.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Callback interface for deleting a facility.static interface
Callback interface for checking if a facility exists for a user.static interface
Callback interface for facility creation.static interface
Callback interface for fetching a specific facility.static interface
Callback interface for retrieving a list of facilities.static interface
Callback interface for facility updates. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new FacilityController and initializes FirebaseOrganizer. -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkUserFacility
(String userId, FacilityController.FacilityCheckCallback callback) Checks if the user already has a facility linked to their profile.void
createFacility
(Facility facility, FacilityController.FacilityCreationCallback callback) Creates a new facility and links it to the creator's user profile.void
deleteFacility
(String facilityId, FacilityController.DeleteFacilityCallback callback) Deletes a facility by its ID.void
Retrieves all available facilities.void
getFacilityByUserId
(String userId, FacilityController.FacilityFetchCallback callback) Retrieves the facility details linked to the user ID.void
updateFacility
(Facility facility, FacilityController.FacilityUpdateCallback callback) Updates an existing facility in the database.
-
Field Details
-
firebaseOrganizer
-
-
Constructor Details
-
FacilityController
public FacilityController()Constructs a new FacilityController and initializes FirebaseOrganizer.
-
-
Method Details
-
createFacility
Creates a new facility and links it to the creator's user profile.- Parameters:
facility
- The facility to be created.callback
- The callback to handle the result of the facility creation.
-
updateFacility
Updates an existing facility in the database.- Parameters:
facility
- The facility object with updated details.callback
- The callback to handle the result of the update operation.
-
checkUserFacility
Checks if the user already has a facility linked to their profile.- Parameters:
userId
- The ID of the user to check.callback
- The callback to handle the result of the check.
-
getFacilityByUserId
Retrieves the facility details linked to the user ID.- Parameters:
userId
- The ID of the user whose facility needs to be fetched.callback
- The callback to handle the fetched facility or errors.
-
getAllFacilities
Retrieves all available facilities.- Parameters:
callback
- The callback to handle the list of fetched facilities.
-
deleteFacility
Deletes a facility by its ID.- Parameters:
facilityId
- The ID of the facility to be deleted.callback
- The callback to handle the result of the deletion.
-