Skip to content

add [properties-be] - properties crate set entity property#749

Merged
danielkweon merged 17 commits intomainfrom
daniel/m-5426--add-tasks-quick-create-menu-hexagon-migration
Dec 28, 2025
Merged

add [properties-be] - properties crate set entity property#749
danielkweon merged 17 commits intomainfrom
daniel/m-5426--add-tasks-quick-create-menu-hexagon-migration

Conversation

@danielkweon
Copy link
Copy Markdown
Contributor

@danielkweon danielkweon commented Dec 23, 2025

add [properties-be] - set entity property hexagon migration

  • Added set_entity_property method - Service method with validation, permissions, and special property handling.
  • Organized service_impl into modules - Split into helpers, task_properties, and main implementation for maintainability.
  • Moved property logic to properties crate - Centralizes validation and business logic, removing dependency on HTTP endpoints.

depends on #752

@danielkweon danielkweon self-assigned this Dec 23, 2025
@danielkweon danielkweon requested a review from a team as a code owner December 23, 2025 17:03
@linear
Copy link
Copy Markdown

linear bot commented Dec 23, 2025

@danielkweon danielkweon force-pushed the daniel/m-5426--add-tasks-quick-create-menu-hexagon-migration branch 2 times, most recently from 87ba976 to bd1c015 Compare December 23, 2025 18:16
@danielkweon danielkweon force-pushed the daniel/m-5426--add-tasks-quick-create-menu-hexagon-migration branch from bd1c015 to 5881479 Compare December 23, 2025 20:58
@danielkweon danielkweon changed the title add [properties-be] - set entity property hexagon migration add [properties-be] - set entity property hexagon refactor Dec 23, 2025
@danielkweon danielkweon changed the title add [properties-be] - set entity property hexagon refactor add [properties-be] - properties crate set entity property Dec 23, 2025
@danielkweon danielkweon force-pushed the daniel/m-5426--add-tasks-quick-create-menu-hexagon-migration branch 3 times, most recently from 0528aa8 to 9a8b677 Compare December 23, 2025 22:26
Copy link
Copy Markdown
Contributor

@synoet synoet left a comment

Choose a reason for hiding this comment

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

Mostly fine. Please respond to some comments

Comment on lines +179 to +183
// Check edit permission first (permission service is required)
let permission_service = self
.permission_service
.as_ref()
.ok_or(PropertiesErr::PermissionDenied)?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems wrong ? WHy is permission_service an Option to start with ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not every instance of properties service needs permissions - so i made it optional. if permissions is not provided, any business logic requiring permissions fails.

if properties service is only used for stuff like getting options, display names, etc., i thought it would be a bad pattern to always require permissions. i can change this if this isnt a pattern we want.

Add upsert method to PropertiesRepo trait and implementation following
hexagonal architecture pattern. This allows inserting or updating entity
properties in a single operation, needed for quick_create_task endpoint.

- Add upsert_entity_property to PropertiesRepo trait
- Implement in PropertiesPgRepo using entity_property_queries
- Follow existing patterns for update_entity_property_value_if_exists
Add method to PropertiesRepo trait and implementation following
hexagonal architecture pattern. This allows fetching property definitions
by ID, needed for property validation in service layer.

- Add get_property_definition to PropertiesRepo trait
- Implement in PropertiesPgRepo using property_definition_queries
- Add property_definition_queries module with SQL query helper
Add method to PropertiesRepo trait and implementation following
hexagonal architecture pattern. This allows counting how many option IDs
are valid for a property definition, needed for property option validation
in service layer.

- Add count_valid_property_options to PropertiesRepo trait
- Implement in PropertiesPgRepo using entity_property_queries
- Add count_valid_property_options query helper function
- Add validate_property_options helper method in service layer
…operty_options

Match pattern used by other services in codebase - use direct anyhow::bail! without explicit warning logs
- Rename PermissionChecker trait to PermissionService
- Rename PermissionCheckerImpl to PermissionServiceImpl
- Rename permission_checker.rs to permission_service.rs
- Update all references throughout properties and properties_service crates
- Simplify import paths by replacing super::super:: with crate:: paths
- Update test mocks to use MockPermissionService
…ction

Extract repeated mock permission service initialization code into a
create_mock_permission_service() helper function. This reduces duplication
across 14 test cases and makes future changes to the mock setup easier.
@danielkweon danielkweon force-pushed the daniel/m-5426--add-tasks-quick-create-menu-hexagon-migration branch from e02b159 to 6d5b963 Compare December 28, 2025 23:01
@danielkweon danielkweon merged commit 45850f2 into main Dec 28, 2025
37 checks passed
@danielkweon danielkweon deleted the daniel/m-5426--add-tasks-quick-create-menu-hexagon-migration branch December 28, 2025 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants