Skip to content

IMatchService

Eric Singleton Jr edited this page Aug 9, 2018 · 13 revisions

This service matches a lawyer with a veteran. It uses dependency injection to look for established matches and display them on the lawyer and veteran Razor Pages.

        bool IsInQueue();
        bool IsMatched();
        bool HasCompletedForm();
        bool IsVerified();
        VeteranQueue GetQueueItem();
        Task<VeteranLawyerMatch> GetMatchAsync();
        List<LawyerAvailability> GetLawyerAvailability(string lawyerId);
        Task<List<VeteranLawyerMatch>> GetMatchesAsync();
        void AddtoQueue(string userId);
        void FindVeteran();
        void AcceptTimeSlot(int timeId);
        VeteranIntakeForm GetForm(int matchId);

IsInQueue()

This method determines whether a veteran is in the queue to be matched with a lawyer. It grabs the logged in veteran's user info and searches VeteranQueue table to see if the veteran is in it. If found, the method returns true. Otherwise, it returns false.

IsMatched()

This method determines whether a logged in lawyer or veteran is matched. It detects whether the user is a lawyer or veteran and then searches for their ID in the VeteranLawyerMatches table. A match returns true, and no match returns false.

AddToQueue()

This method adds a veteran to the VeteranQueue table if they have not already been placed in the queue or matched. There is no return value. It is unknown whether this method is actually be used because it contains a obsolete VeteranQueue class.

FindVeteran()

This method finds a veteran from the VeteranQueue table. It then creates a VeteranLawyerMatch object and adds it to the database. The veteran is then removed from the VeteranQueue table. Like AddToQueue(), this method is using an obsolete VeteranQueue class, so it's possible it isn't being used.

GetMatchesAsync()

This method returns a list of veterans who are matched with a currently logged in lawyer. The veteran information is grabbed from the VeteranLawyerMatch table and added to a list which is then returned. The intake form of each veteran is also added to each match for the lawyer to view.

GetMatchAsync()

This method returns a lawyer that has matched with the veteran who is currently logged in. Lawyer information is retrieved from the VeteranLawyerMatch table.

GetLawyerAvailability()

This method returns a list of a lawyer's available days and times for a veteran to view. It is unknown whether this method is actually being used because it involves the LawyerAvailability class, which is considered obsolete.

AcceptTimeSlot()

This method allows a veteran to accept a given time slot for a lawyer. Once the time slot is approved, it is removed from the LawyerAvailability table. Because this method is also using the obsolete LawyerAvailability class, it might not be used.

HasCompletedForm()

This method determines whether a veteran has completed a form. It searches for the VeteranIntakeForms table for any forms that belong to the currently logged in veteran. If the method finds a match, it returns true. Otherwise, false is returned.

GetQueueItem()

This method returns a VeteranQueue object associated with the currently logged in veteran. It is unknown whether this is method is being used because it utilizes the obsolete VeteranQueue class.

GetForm()

This method grabs a VeteranIntakeForm object based on the matchId entered into the method. It first finds a veteran ID associated with the matchId. A userId is also queried, but it does not appear to be used (consider deleting). The intake form is then searched for with the veteran ID and then returned.

IsVerified()

This method determines whether a lawyer has been verified. It first grabs the currently logged in lawyer's ID and then checks the lawyer's IsVerified property. If that property is true, the method returns true. Otherwise, the method returns false.