Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add building location #142

Merged
merged 1 commit into from
Feb 16, 2025
Merged

Conversation

nganntqe170236
Copy link
Collaborator

@nganntqe170236 nganntqe170236 commented Feb 16, 2025

#77

Summary by CodeRabbit

  • New Features

    • Buildings now support geolocation with precise latitude and longitude data.
    • Interactive map markers with dynamic pop-ups display building details.
  • UI Enhancements

    • Improved building forms with enhanced location input validation and error notifications.
    • Updated map controls include intuitive buttons for selecting building locations.
  • Backend Updates

    • Extended data records and schema to store comprehensive building location information.
  • Internationalization

    • Added “Next” and “Cancel” options in multiple languages for better navigation.

Copy link

coderabbitai bot commented Feb 16, 2025

Warning

Rate limit exceeded

@thongdanghoang has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 51 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 3edf02b and c6cbd91.

📒 Files selected for processing (16)
  • sep490-enterprise/src/main/java/enterprise/dtos/BuildingDTO.java (2 hunks)
  • sep490-enterprise/src/main/java/enterprise/entities/BuildingEntity.java (2 hunks)
  • sep490-enterprise/src/main/resources/db/migration/V0.0.1.7__BuildingLocations.sql (1 hunks)
  • sep490-enterprise/src/main/resources/test-data.sql (1 hunks)
  • sep490-frontend/src/app/modules/enterprise/components/building-details/building-details.component.ts (3 hunks)
  • sep490-frontend/src/app/modules/enterprise/components/building-popup-marker/building-popup-marker.component.html (1 hunks)
  • sep490-frontend/src/app/modules/enterprise/components/building-popup-marker/building-popup-marker.component.ts (1 hunks)
  • sep490-frontend/src/app/modules/enterprise/components/buildings/buildings.component.html (3 hunks)
  • sep490-frontend/src/app/modules/enterprise/components/buildings/buildings.component.ts (6 hunks)
  • sep490-frontend/src/app/modules/enterprise/enterprise.module.ts (1 hunks)
  • sep490-frontend/src/app/modules/enterprise/models/enterprise.dto.ts (1 hunks)
  • sep490-frontend/src/app/modules/enterprise/services/popup.service.ts (1 hunks)
  • sep490-frontend/src/assets/i18n/en.json (1 hunks)
  • sep490-frontend/src/assets/i18n/vi.json (1 hunks)
  • sep490-frontend/src/assets/i18n/zh.json (1 hunks)
  • sep490-infrastructure/docker-compose.yml (2 hunks)

Walkthrough

The changes add new geographical location fields (latitude, longitude) to building data structures in the backend and frontend. Validation constraints and database schema updates ensure non-negative device counts and require valid coordinates. The frontend now supports location selection through enhanced form controls, dynamic popup markers, and updated event handlers. Localization files receive new keys for navigation actions.

Changes

File(s) Change Summary
sep490-enterprise/.../dtos/BuildingDTO.java,
sep490-enterprise/.../entities/BuildingEntity.java,
sep490-enterprise/.../db/migration/V0.0.1.7__BuildingLocations.sql,
sep490-enterprise/.../test-data.sql
Added latitude and longitude fields; added validation (@Min(0)) for numberOfDevices; updated DB schema and test data for geographic coordinates.
sep490-frontend/.../building-details/building-details.component.ts,
sep490-frontend/.../building-popup-marker/building-popup-marker.component.*,
sep490-frontend/.../buildings/buildings.component.*,
sep490-frontend/.../enterprise.module.ts,
sep490-frontend/.../models/enterprise.dto.ts,
sep490-frontend/.../services/popup.service.ts
Introduced new map location handling: form controls for latitude/longitude, dynamic popup marker compilation via PopupService, updated event handlers and refactored marker management; updated DTO interfaces accordingly.
sep490-frontend/.../assets/i18n/en.json,
sep490-frontend/.../assets/i18n/vi.json,
sep490-frontend/.../assets/i18n/zh.json
Added new translation keys "next" and "cancel" for English, Vietnamese, and Chinese.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BuildingsComponent
    participant PopupService
    participant BuildingDetailsComponent

    User->>BuildingsComponent: Click "Add Building Location"
    BuildingsComponent->>BuildingsComponent: turnOnSelectBuildingLocation()
    User->>BuildingsComponent: Click on map to select location
    BuildingsComponent->>PopupService: compilePopup(BuildingPopupMarkerComponent)
    PopupService->>PopupService: Dynamically create popup marker
    BuildingsComponent->>User: Display marker with location data
    User->>BuildingsComponent: Confirm selection (click Next)
    BuildingsComponent->>BuildingDetailsComponent: Navigate with query parameters (latitude, longitude)
    BuildingDetailsComponent-->>User: Pre-fill location form controls
Loading

Possibly related PRs

Suggested labels

user story, improvement

Suggested reviewers

  • GiaBaorr
  • huynhlephcvinh

Poem

I'm a rabbit hopping with glee,
Code fields of latitude and longitude now set free.
Validations in place, markers that pop,
Our building maps just got a fresh hop!
With each line of code, my ears stand tall,
Celebrating changes with a joyful call!
🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@thongdanghoang thongdanghoang force-pushed the feature/77-userstory-enterprise branch from be00a32 to a6947e9 Compare February 16, 2025 15:51
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🧹 Nitpick comments (11)
sep490-frontend/src/app/modules/enterprise/services/popup.service.ts (1)

1-9: Optional modernization for Angular 14+

These import statements are valid for dynamic component creation. If you're on Angular 14+ and wish to simplify, consider exploring the newer ViewContainerRef.createComponent approach, which can remove the need for ComponentFactoryResolver.

sep490-frontend/src/app/modules/enterprise/components/buildings/buildings.component.ts (7)

33-36: Interface MapLocation is clearly defined

If you anticipate further attributes (e.g., address, region data), consider extending or placing it in a shared model. For now, it’s concise and sufficient.


47-48: Naming convention suggestion

addBuildingLocation and buildingLocation are straightforward, but renaming to isSelectingBuildingLocation or selectedBuildingLocation might better convey intent. Non-blocking.


72-78: Single marker addition logic

This code restricts the user to only one location marker. True or false, it aligns with your design. If multiple selectable locations are needed in the future, consider a more scalable approach.


90-92: Potential duplication of fetch logic

Triggering fetchBuilding() on each view mode change may be redundant if the data is already stored locally. Consider optimizing if performance becomes an issue.


94-97: Method naming clarity

turnOnSelectBuildingLocation conveys intent. If toggling becomes common, a single toggle method or external store might reduce complexity. Non-essential for now.


115-127: Marker removal approach

Deleting layers by matching lat/lng works; however, if multiple markers share these coordinates, everything at that location is removed. Using a direct reference to the marker object is more robust if that scenario arises.


168-172: Validate zoom coordinates

Using zoomTo is straightforward. If user input can be invalid, consider sanitizing or defaulting coordinates.

sep490-frontend/src/app/modules/enterprise/models/enterprise.dto.ts (1)

9-10: Add JSDoc comments and consider using more specific types for coordinates.

Consider adding documentation and type constraints for better code maintainability:

+  /** Latitude in degrees, must be between -90 and 90 */
   latitude: number;
+  /** Longitude in degrees, must be between -180 and 180 */
   longitude: number;

You could also create a custom type for coordinates to enforce valid ranges at compile time:

type Latitude = number & { __brand: 'Latitude' };
type Longitude = number & { __brand: 'Longitude' };

Also applies to: 16-17

sep490-frontend/src/app/modules/enterprise/components/building-details/building-details.component.ts (1)

90-96: Enhance error handling for invalid location.

The error message could be more descriptive to help users understand what went wrong.

-          this.notificationService.add({
-            severity: 'error',
-            summary: 'Error',
-            detail: 'Invalid location'
-          });
+          this.notificationService.add({
+            severity: 'error',
+            summary: this.translate.instant('enterprise.buildings.details.errors.invalidLocation'),
+            detail: this.translate.instant('enterprise.buildings.details.errors.locationRequired')
+          });
sep490-frontend/src/app/modules/enterprise/components/building-popup-marker/building-popup-marker.component.html (1)

1-12: Consider enhancing the popup with additional features.

The current popup shows basic information. Consider adding:

  1. A link to navigate to building details
  2. Display coordinates for admin users
  3. A small preview image if available
 <div>
     <span class="font-bold">
         {{ "enterprise.buildings.details.labels.name" | translate }}:
     </span>
     {{ building.name }}
 </div>
 <div>
     <span class="font-bold">
         {{ "enterprise.buildings.details.labels.address" | translate }}:
     </span>
     {{ building.address }}
 </div>
+<div *ngIf="isAdmin">
+    <span class="font-bold">
+        {{ "enterprise.buildings.details.labels.coordinates" | translate }}:
+    </span>
+    {{ building.latitude }}, {{ building.longitude }}
+</div>
+<div class="mt-2">
+    <a [routerLink]="['/enterprise/buildings', building.id]">
+        {{ "enterprise.buildings.actions.viewDetails" | translate }}
+    </a>
+</div>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9cb00b4 and a6947e9.

📒 Files selected for processing (15)
  • sep490-enterprise/src/main/java/enterprise/dtos/BuildingDTO.java (2 hunks)
  • sep490-enterprise/src/main/java/enterprise/entities/BuildingEntity.java (1 hunks)
  • sep490-enterprise/src/main/resources/db/migration/V0.0.1.7__BuildingLocations.sql (1 hunks)
  • sep490-enterprise/src/main/resources/test-data.sql (1 hunks)
  • sep490-frontend/src/app/modules/enterprise/components/building-details/building-details.component.ts (3 hunks)
  • sep490-frontend/src/app/modules/enterprise/components/building-popup-marker/building-popup-marker.component.html (1 hunks)
  • sep490-frontend/src/app/modules/enterprise/components/building-popup-marker/building-popup-marker.component.ts (1 hunks)
  • sep490-frontend/src/app/modules/enterprise/components/buildings/buildings.component.html (3 hunks)
  • sep490-frontend/src/app/modules/enterprise/components/buildings/buildings.component.ts (6 hunks)
  • sep490-frontend/src/app/modules/enterprise/enterprise.module.ts (1 hunks)
  • sep490-frontend/src/app/modules/enterprise/models/enterprise.dto.ts (1 hunks)
  • sep490-frontend/src/app/modules/enterprise/services/popup.service.ts (1 hunks)
  • sep490-frontend/src/assets/i18n/en.json (1 hunks)
  • sep490-frontend/src/assets/i18n/vi.json (1 hunks)
  • sep490-frontend/src/assets/i18n/zh.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • sep490-frontend/src/assets/i18n/zh.json
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build Java Modules (sep490-enterprise)
🔇 Additional comments (19)
sep490-frontend/src/assets/i18n/en.json (1)

14-15: New Navigation Keys Added.
The "next" and "cancel" keys have been added in a consistent manner within the "common" section. Their inclusion supports UI navigation actions and aligns with similar updates in other localization files.

sep490-frontend/src/assets/i18n/vi.json (1)

14-15: Localized Navigation Keys for Vietnamese.
The additions of "next": "Tiếp theo" and "cancel": "Hủy" are correctly implemented in the "common" section. The translations are appropriate and maintain consistency with the English version as well as other language files.

sep490-frontend/src/app/modules/enterprise/components/buildings/buildings.component.html (4)

1-1: Enforce Layout Consistency with Min-Height
The addition of the style="min-height: 42px" attribute ensures that the container maintains a consistent minimum height, which can help with alignment and spacing across different screen sizes.


6-10: Refined Building Location Button Behavior
The button now conditionally displays when !addBuildingLocation and triggers the turnOnSelectBuildingLocation() method on click. Please verify that the new method name accurately reflects its behavior and that the corresponding component logic has been updated accordingly.


15-16: Updated p-selectbutton Configuration
The modifications disable the select button when addBuildingLocation is true and update the onChange event handler to call onViewModeChanged() without parameters. Confirm that this event signature meets your requirements and that no event payload is needed for proper handling.


72-76: Enhanced Zoom Button Functionality
The map button’s click event now explicitly invokes zoomTo(building.latitude, building.longitude), leveraging the newly added geographical coordinates. Verify that all building objects reliably include valid latitude and longitude values to prevent potential runtime errors.

sep490-frontend/src/app/modules/enterprise/services/popup.service.ts (2)

14-18: Constructor dependency injection looks good

Injecting ComponentFactoryResolver, ApplicationRef, and Injector is a standard approach for handling dynamic components. No issues found here.


20-43: Good memory management in dynamic component creation

The usage of attachView and detachView ensures the component’s lifecycle is properly managed, preventing potential memory leaks. This approach is aligned with best practices for dynamic component rendering.

sep490-frontend/src/app/modules/enterprise/components/buildings/buildings.component.ts (8)

1-1: Importing ComponentRef is appropriate

This import is necessary for referencing component instances during popup compilation.


10-11: New dynamic popup dependencies recognized

Importing PopupService and BuildingPopupMarkerComponent aligns with the new popup feature. No concerns spotted.


62-62: PopupService injection verified

This dependency is injected correctly and used properly in the code below.


68-68: Watch out for potential performance overhead

Refetching data on view initialization is fine for smaller datasets, but for larger data sets, consider caching/building a local store.


82-84: Getter approach for mapView is clean

This property-based approach for determinative UI states is perfectly acceptable.


86-88: Symmetrical listView getter

Consistent style with the mapView getter. No issues identified.


100-113: Router navigation with location queryParams

This logic is straightforward. If the building location must be validated further (e.g., ensuring lat/lng bounds), contemplate a confirmation or data guard flow.


138-165: Subscription lacks error handling

Although you handle building creation of markers well, consider .subscribe({ next:..., error:... }) for better resilience. Also ensure coordinates are valid or handle out-of-range lat/lng data gracefully.

sep490-frontend/src/app/modules/enterprise/components/building-popup-marker/building-popup-marker.component.ts (2)

1-2: Imports are appropriately defined

Adding Building via a direct import ensures type safety for your input property.


10-11: @input({required: true}) usage is well-applied

Ensuring the parent provides building at compile time is a strong type-safety measure.

sep490-frontend/src/app/modules/enterprise/enterprise.module.ts (1)

15-15: LGTM!

The BuildingPopupMarkerComponent is properly imported and declared in the module.

Also applies to: 24-24

@thongdanghoang thongdanghoang force-pushed the feature/77-userstory-enterprise branch from a6947e9 to 3edf02b Compare February 16, 2025 16:02
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (4)
sep490-infrastructure/docker-compose.yml (1)

74-76: Volume Declarations and File Formatting.
The root-level volumes block, declaring postgresql and postgresql_data, correctly supports persistent storage for the database. Additionally, static analysis indicates that the file is missing a newline at the end. Please add a newline to conform with YAML linting standards.

Suggested diff to add a newline at the end of the file:

  postgresql_data:
+  
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 76-76: no new line character at the end of file

(new-line-at-end-of-file)

sep490-frontend/src/app/modules/enterprise/models/enterprise.dto.ts (1)

9-10: LGTM! Consider adding type aliases for geographical coordinates.

The addition of location fields is well-structured. Consider creating type aliases to improve type safety and reusability:

type Latitude = number;  // -90 to 90
type Longitude = number; // -180 to 180

export interface Building extends BaseDTO {
  // ...
  latitude: Latitude;
  longitude: Longitude;
}
sep490-frontend/src/app/modules/enterprise/components/buildings/buildings.component.ts (2)

70-79: Add cleanup for temporary markers.

When selecting a building location, old temporary markers should be removed before adding a new one to prevent multiple markers from accumulating.

  this.map.on('click', e => {
    const marker = L.marker([e.latlng.lat, e.latlng.lng]);
    if (this.addBuildingLocation && this.buildingLocation === null) {
+     // Remove any existing temporary markers
+     this.map.eachLayer(layer => {
+       if (layer instanceof L.Marker && !layer.getPopup()) {
+         this.map.removeLayer(layer);
+       }
+     });
      marker.addTo(this.map);
      this.buildingLocation = {
        latitude: e.latlng.lat,
        longitude: e.latlng.lng
      };
    }
  });

175-196: Consider configurable map center coordinates.

The map center coordinates are hardcoded. Consider moving these to a configuration file or environment variables for better maintainability and reusability across different deployments.

+ private readonly DEFAULT_CENTER = [10.841394, 106.810052];
+ private readonly DEFAULT_ZOOM = 16;
+ private readonly MAX_ZOOM = 16;
+ private readonly MIN_ZOOM = 1;

  private initMap(): void {
    if (document.getElementById('map')) {
      this.map = L.map('map', {
-       center: [10.841394, 106.810052],
-       zoom: 16
+       center: this.DEFAULT_CENTER,
+       zoom: this.DEFAULT_ZOOM
      });
    } else {
      throw new Error(
        'Map element not found, should set id="map" to the map element'
      );
    }

    const tiles = L.tileLayer(
      'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
      {
-       maxZoom: 16,
-       minZoom: 1
+       maxZoom: this.MAX_ZOOM,
+       minZoom: this.MIN_ZOOM
      }
    );

    tiles.addTo(this.map);
  }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a6947e9 and 3edf02b.

📒 Files selected for processing (16)
  • sep490-enterprise/src/main/java/enterprise/dtos/BuildingDTO.java (2 hunks)
  • sep490-enterprise/src/main/java/enterprise/entities/BuildingEntity.java (2 hunks)
  • sep490-enterprise/src/main/resources/db/migration/V0.0.1.7__BuildingLocations.sql (1 hunks)
  • sep490-enterprise/src/main/resources/test-data.sql (1 hunks)
  • sep490-frontend/src/app/modules/enterprise/components/building-details/building-details.component.ts (3 hunks)
  • sep490-frontend/src/app/modules/enterprise/components/building-popup-marker/building-popup-marker.component.html (1 hunks)
  • sep490-frontend/src/app/modules/enterprise/components/building-popup-marker/building-popup-marker.component.ts (1 hunks)
  • sep490-frontend/src/app/modules/enterprise/components/buildings/buildings.component.html (3 hunks)
  • sep490-frontend/src/app/modules/enterprise/components/buildings/buildings.component.ts (6 hunks)
  • sep490-frontend/src/app/modules/enterprise/enterprise.module.ts (1 hunks)
  • sep490-frontend/src/app/modules/enterprise/models/enterprise.dto.ts (1 hunks)
  • sep490-frontend/src/app/modules/enterprise/services/popup.service.ts (1 hunks)
  • sep490-frontend/src/assets/i18n/en.json (1 hunks)
  • sep490-frontend/src/assets/i18n/vi.json (1 hunks)
  • sep490-frontend/src/assets/i18n/zh.json (1 hunks)
  • sep490-infrastructure/docker-compose.yml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
  • sep490-frontend/src/assets/i18n/en.json
  • sep490-frontend/src/app/modules/enterprise/enterprise.module.ts
  • sep490-frontend/src/assets/i18n/zh.json
  • sep490-frontend/src/app/modules/enterprise/components/building-popup-marker/building-popup-marker.component.html
  • sep490-frontend/src/assets/i18n/vi.json
  • sep490-enterprise/src/main/resources/db/migration/V0.0.1.7__BuildingLocations.sql
  • sep490-frontend/src/app/modules/enterprise/components/building-popup-marker/building-popup-marker.component.ts
  • sep490-enterprise/src/main/resources/test-data.sql
  • sep490-enterprise/src/main/java/enterprise/dtos/BuildingDTO.java
  • sep490-frontend/src/app/modules/enterprise/components/buildings/buildings.component.html
🧰 Additional context used
🪛 YAMLlint (1.35.1)
sep490-infrastructure/docker-compose.yml

[error] 76-76: no new line character at the end of file

(new-line-at-end-of-file)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build Java Modules (sep490-enterprise)
🔇 Additional comments (8)
sep490-infrastructure/docker-compose.yml (2)

17-18: Confirm Volume Mounts for PostgreSQL Persistence.
The addition of the volumes postgresql and postgresql_data for the sep490_databases service looks correct. Please verify that the paths /var/lib/postgresql and /var/lib/postgresql/data are consistent with the container's expectations and that the host system permissions allow for proper data persistence.


72-73: Verify Kafka Partition Configuration.
A new environment variable KAFKA_NUM_PARTITIONS: 3 has been introduced in the Kafka service. Please ensure this setting aligns with your Kafka deployment strategy and that it has been documented accordingly.

sep490-enterprise/src/main/java/enterprise/entities/BuildingEntity.java (1)

37-45: Make location columns non-nullable and add validation constraints.

The validation constraints for coordinate ranges are correct, but the columns should be non-nullable to ensure data integrity.

sep490-frontend/src/app/modules/enterprise/services/popup.service.ts (1)

27-43: LGTM! Well-implemented dynamic component creation.

The implementation is clean, type-safe, and follows Angular best practices. Proper cleanup of component views prevents memory leaks.

sep490-frontend/src/app/modules/enterprise/components/building-details/building-details.component.ts (2)

92-92: Improve type safety for query params handling.

The current type casting to MapLocation is unsafe.


36-45: LGTM! Well-structured form controls with proper validation.

The form controls for latitude and longitude are well-implemented with appropriate validation ranges for geographical coordinates.

sep490-frontend/src/app/modules/enterprise/components/buildings/buildings.component.ts (2)

33-36: LGTM! Well-defined interface for location data.

The MapLocation interface clearly defines the required geographical coordinates.


94-97: LGTM! Well-implemented map interaction methods.

The methods handle state changes and cleanup appropriately:

  • turnOnSelectBuildingLocation: Ensures map view is active for location selection
  • cancelAddBuilding: Properly cleans up temporary markers and resets state
  • zoomTo: Includes proper null checks and view mode handling

Also applies to: 115-127, 168-173

@thongdanghoang thongdanghoang force-pushed the feature/77-userstory-enterprise branch from 3edf02b to c6cbd91 Compare February 16, 2025 16:10
@thongdanghoang thongdanghoang merged commit fcfcfad into main Feb 16, 2025
5 checks passed
@thongdanghoang thongdanghoang deleted the feature/77-userstory-enterprise branch February 16, 2025 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants