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 interfaceCallback interface for deleting a facility.static interfaceCallback interface for checking if a facility exists for a user.static interfaceCallback interface for facility creation.static interfaceCallback interface for fetching a specific facility.static interfaceCallback interface for retrieving a list of facilities.static interfaceCallback interface for facility updates. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new FacilityController and initializes FirebaseOrganizer. -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckUserFacility(String userId, FacilityController.FacilityCheckCallback callback) Checks if the user already has a facility linked to their profile.voidcreateFacility(Facility facility, FacilityController.FacilityCreationCallback callback) Creates a new facility and links it to the creator's user profile.voiddeleteFacility(String facilityId, FacilityController.DeleteFacilityCallback callback) Deletes a facility by its ID.voidRetrieves all available facilities.voidgetFacilityByUserId(String userId, FacilityController.FacilityFetchCallback callback) Retrieves the facility details linked to the user ID.voidupdateFacility(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.
-