EnAccess / EnAccess/micropowermanager

[Feature Request]: Remove Polymorphic behaviour of `Address` model and apply one-to-many relationship to `Person`

Open
#1,262 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
PHP
Stars
27
Forks
19
Avg merge
1d 18h
Merged PRs (30d)
27

Description

### Preflight Checklist

- [x] I have read the [Contributing Guidelines](https://github.com/EnAccess/micropowermanager/blob/main/CONTRIBUTING.md) for this project, if it exists.
- [x] I agree to follow the [Code of Conduct](https://github.com/EnAccess/micropowermanager/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [x] I have searched the [issue tracker](https://github.com/EnAccess/micropowermanager/issues) for a feature request that matches the one I want to file, without success.

### Problem Description

> After these changes Address are 1:n with users, right? If so, we could probably remove the polymorphic relation in favour of the much easier hasMany with User.

Context: #1253

Following the removal of indirection between `Device`<>`Address` the address model becomes solely used to reference Customers (`Person`). With this in mind we would like to remove the current polymorphic nature of the Address and enforce a One-to-Many relationship with `Person` model.

### Proposed Solution

Remove polymorphic nature of `Address` model i.e morphTo `owner` property and database fields, in favour a simpler `hasMany` relationship with `Person`

### Alternatives Considered

N/A

### Additional Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.