Skip to main content

Employee Organization Storage

Summary

Employee Service persists Department and Designation as tenant-scoped aggregates. Employee assignment, department hierarchy, department head, and designation-to-department relationships are logical GUID references without configured database foreign keys.

Audience

  • Backend developers and QA engineers
  • Solution architects and organization-domain reviewers

Relationship model

These edges represent stored identifiers and application behavior, not database-enforced foreign keys.

Department storage

  • GUID primary identifier and integer tenant identifier.
  • Required name and normalized code; optional parent department, head employee, and location.
  • Tenant-scoped unique database constraint on department code.
  • Active/inactive state and lifecycle timestamps.
  • Update rejects self-parenting in the domain. No deeper cycle detection or hierarchy-depth constraint was found.
  • Deletion service deactivates the department and rejects deactivation while active employees are assigned.

Designation storage

  • GUID primary identifier and integer tenant identifier.
  • Required name and normalized code; optional department scope and grade; integer level.
  • Tenant-scoped unique database constraint on designation code.
  • Active/inactive state and lifecycle timestamps.
  • Deletion service deactivates the designation. No assignment-based delete restriction was found.

Assignment integrity

Employee command validators confirm referenced departments/designations/managers exist and are active where those commands use the references. Create validation also checks that a department-specific designation matches the selected department. Because the database model does not declare these cross-aggregate foreign keys, direct persistence paths must not bypass application validation.

Platform boundary

Company and tenant control-plane data are Platform-owned. Employee Service does not persist a Company object or copy Platform company details into its organization aggregates.

Source References

  • microservices/src/employee-service/Domain/Organization/Organization.cs
  • microservices/src/employee-service/Domain/Employees/Employee.cs
  • microservices/src/employee-service/Infrastructure/EmployeeDbContext.cs
  • microservices/src/employee-service/Application/Organization/Organization.cs
  • microservices/src/employee-service/Application/Validators/EmployeeCommandValidators.cs
  • microservices/src/platform-service/Domain/Entities/Company.cs

See Also

Keywords

  • Department persistence
  • Designation persistence
  • Logical references

Revision Information

  • Status: Draft
  • Last reviewed: 2026-07-15
  • Review cycle: Quarterly