feat(working-patterns): add Working Patterns and Allocations CRUD#104
Open
sgerrand wants to merge 3 commits into
Open
feat(working-patterns): add Working Patterns and Allocations CRUD#104sgerrand wants to merge 3 commits into
sgerrand wants to merge 3 commits into
Conversation
Adds Humaans.WorkingPatterns covering /api/working-patterns. Working patterns are company-scoped schedule definitions referenced from working pattern allocations.
Adds Humaans.WorkingPatternAllocations covering /api/working-pattern-allocations. Allocations link a person to a working pattern within a date window.
Coverage Report for CI Build 25327820523Coverage decreased (-1.0%) to 98.98%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
There was a problem hiding this comment.
Pull request overview
Adds first-class support for the Humaans “Working Patterns” API family by introducing new resource modules + structs, wiring them into the top-level Humaans module, and adding ExUnit coverage and README documentation so consumers can CRUD working patterns and their per-person allocations.
Changes:
- Add
Humaans.WorkingPatternsandHumaans.WorkingPatternAllocationsCRUD modules viause Humaans.Resource. - Add
Humaans.Resources.WorkingPatternandHumaans.Resources.WorkingPatternAllocationstructs with date/datetime parsing. - Add new tests for both resources and list them in the README + module access helpers in
Humaans.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/humaans/working_patterns_test.exs | Adds CRUD tests for Working Patterns. |
| test/humaans/working_pattern_allocations_test.exs | Adds CRUD tests for Working Pattern Allocations (incl. date parsing). |
| README.md | Documents the new resource modules in the “Available resources” list. |
| lib/humaans/working_patterns.ex | Introduces Working Patterns resource module using the shared CRUD macro. |
| lib/humaans/working_pattern_allocations.ex | Introduces Working Pattern Allocations resource module using the shared CRUD macro. |
| lib/humaans/resources/working_pattern.ex | Adds Working Pattern struct + timestamp parsing. |
| lib/humaans/resources/working_pattern_allocation.ex | Adds Working Pattern Allocation struct + date/datetime parsing. |
| lib/humaans.ex | Exposes module-access helpers for the two new resource modules. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+17
to
+21
| expect(Humaans.MockHTTPClient, :request, fn client_param, opts -> | ||
| assert client_param == client | ||
| assert Keyword.fetch!(opts, :method) == :get | ||
| assert Keyword.fetch!(opts, :url) == "https://app.humaans.io/api/working-patterns" | ||
|
|
Comment on lines
+43
to
+44
| assert response.id == "wp_abc" | ||
| assert response.name == "Mon-Fri 9-5" |
Comment on lines
+17
to
+23
| expect(Humaans.MockHTTPClient, :request, fn client_param, opts -> | ||
| assert client_param == client | ||
| assert Keyword.fetch!(opts, :method) == :get | ||
|
|
||
| assert Keyword.fetch!(opts, :url) == | ||
| "https://app.humaans.io/api/working-pattern-allocations" | ||
|
|
| assert response.working_pattern_id == "wp_abc" | ||
| assert response.start_date == ~D[2025-01-01] | ||
| assert response.end_date == ~D[2025-12-31] | ||
| assert response.created_at == ~U[2025-01-01 08:44:42.000Z] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💁 These changes add CRUD coverage for Working Patterns and Working Pattern Allocations.
Summary
Both ship as struct + module + tests using `Humaans.Resource`. Helpers and README updated.
The Working Pattern struct only declares the documented top-level fields (`id`, `companyId`, `name`, timestamps); deeper schedule-shape fields (e.g. day-of-week breakdowns) are not exposed in the public API reference excerpt and can be added additively if required.
Addresses Group D1 (Working Patterns family) of the API coverage review.
Test plan