Class FacilityController

java.lang.Object
com.example.iconic_raffleevent.controller.FacilityController

public class FacilityController extends Object
FacilityController handles the business logic related to facilities. It facilitates operations like creating, fetching, checking, and deleting facilities.
  • Field Details

  • Constructor Details

    • FacilityController

      public FacilityController()
      Constructs a new FacilityController and initializes FirebaseOrganizer.
  • Method Details

    • createFacility

      public void createFacility(Facility facility, FacilityController.FacilityCreationCallback callback)
      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

      public void updateFacility(Facility facility, FacilityController.FacilityUpdateCallback callback)
      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

      public void checkUserFacility(String userId, FacilityController.FacilityCheckCallback callback)
      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

      public void getFacilityByUserId(String userId, FacilityController.FacilityFetchCallback callback)
      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

      public void getAllFacilities(FacilityController.FacilityListCallback callback)
      Retrieves all available facilities.
      Parameters:
      callback - The callback to handle the list of fetched facilities.
    • deleteFacility

      public void deleteFacility(String facilityId, FacilityController.DeleteFacilityCallback callback)
      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.