fleencorp / fleen-feen

Fleen Feen connects you with the world
GNU General Public License v3.0
0 stars 1 forks source link

Refactor Stream and Event Services, Add Stream Speaker and Review Management, and Improve Join Status Handling #65

Closed aalamu closed 1 month ago

aalamu commented 1 month ago

Summary:

This pull request introduces significant improvements to the stream and event services, focusing on streamlining functionality and enhancing the user experience. The changes include refactoring core services, adding DTOs for managing stream speakers, improving attendee join status handling, and adding support for stream reviews.

Key Changes:

  1. Stream Speaker Management:

    • Added StreamSpeakerDto, AddStreamSpeakerDto, UpdateStreamSpeakerDto to manage stream speaker-related actions.
    • Added response classes: GetStreamSpeakersResponse, StreamSpeakerResponse, AddStreamSpeakerResponse, and UpdateStreamSpeakerResponse.
    • Added StreamSpeakerMapper to map StreamSpeaker domain entities to response objects.
    • Updated StreamSpeakerService and StreamSpeakerServiceImpl to handle stream speaker operations and interactions with StreamSpeakerRepository.
  2. Join Status Handling:

    • Introduced JoinStatus to manage the UI label for user events or attendance.
    • Added StreamAttendeeSelect projection for retrieving event or stream IDs with join status.
    • Updated StreamService to include methods like determineUserJoinStatusForEventOrStream() and determineScheduleStatus() to verify attendee join statuses.
  3. Stream Reviews:

    • Added StreamReviewService for adding and managing reviews for events or streams.
    • Added response classes for review actions: AddStreamReviewResponse and DeleteStreamReviewResponse.
    • Created StreamReviewController for handling review-related actions (adding, finding, deleting reviews).
    • Added mappers for StreamReview.
  4. Refactorings:

    • Refactored EventService, EventServiceImpl, and LiveBroadcastServiceImpl to delegate tasks to StreamService.
    • Refactored DeleteStreamSpeakerDto to handle speaker objects.
    • Moved several classes including DataForCreateStreamResponse to the broadcast package.
    • Refactored FleenFeenResponse, GoogleCalendarEventService, and LiveBroadcastServiceImpl for better maintainability and cleaner code.
  5. User Timezone Support:

    • Set the user’s timezone in FleenUser after successful authentication.
    • Added a timezone claim to FleenUser's access token.
  6. Country Timezone Integration:

    • Added a new timezone column to the Country entity.
    • Updated the Liquibase init-data schema to include timezone details for all countries.
    • Updated CountryMapper to add timezone information to CountryResponse.
    • Added a CountryService.getCountryFromCache() method for retrieving country data with timezone information.
  7. Service Refactoring:

    • Refactored CountryServiceImpl, EventServiceImpl, and LiveBroadcastServiceImpl to include AuthenticatedPrincipal and use EventMapper.
    • Refactored LiveBroadcastController.findLiveBroadcasts to improve the mapping process and reduce complexity.
  8. Scheduling and Timezone Logic:

    • Enhanced DateTimeUtil to:
      • Convert timezone identifiers (e.g., Africa/Lagos to WAT).
      • Retrieve the GMT offset for a given timezone.
      • Convert times between timezones and create schedule details for streams or events.
    • Refactored FleenStreamResponse:
      • Removed the timezone, scheduledStartDate, and scheduledEndDate fields.
      • Added a new Schedule object to encapsulate schedule details for streams.
    • Updated StreamService to generate scheduling details based on the user’s timezone.
  9. Liquibase Migration:

    • Updated the Liquibase migration script to make the code and timezone fields non-null in relevant tables for better data integrity.
  10. Validation and Token Claims:

    • Refactored TimezoneValidValidator to support the new timezone logic for validation purposes.
    • Updated TokenClaimField to include the timezone field.
  11. Other Improvements:

    • Replaced FleenStream.getFleenStreamId() with getStreamId() for consistency.
    • Added @JsonProperty for the email address field in StreamSpeakerDto.
    • Refactored EventController to add JoinEventOrStreamDto for joining events or streams.
    • Updated message source files and documentation for better i18n support.

Additional Updates:


This pull request refines the overall structure of the services related to streams and events, enhancing functionality and improving maintainability.