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

Materials uses/stock endpoints #52

Open
Yakov-Varnaev opened this issue Mar 12, 2024 · 0 comments · May be fixed by #55
Open

Materials uses/stock endpoints #52

Yakov-Varnaev opened this issue Mar 12, 2024 · 0 comments · May be fixed by #55
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@Yakov-Varnaev
Copy link
Owner

Yakov-Varnaev commented Mar 12, 2024

There is a need to show a table which shows materials income and usage per day. We need the endpoints for listing and retrieving this data.

/api/v1/companies/{company_pk}/points/{point_pk}/materials?date_from=2024-01-01&date_to=2024-03-01
/api/v1/companies/{company_pk}/points/{point_pk}/materials/{id}?date_from=2024-01-01&date_to=2024-03-01

Response structure

{
  "id": 1,
  "name": "material_name",
  "brand": "material brand",
  "kind": "material kind",
  "unit": "material unit",
  "stocks": [
    {"date": "2024-01-10", "amount": 1000},  // sum of stock materials amount grouped by day
    {"date": "2024-02-10", "amount": 1000},
   ],
   "usage": [
       {"date": "2024-01-12", "amount": 100},  // sum of used materials amount grouped by day
       {"date": "2024-01-14", "amount": 50},
   ]
}

Aggregation should be done in the QuerySet.
Add test to cover as many scenarios as possible for querying the stats

@Yakov-Varnaev Yakov-Varnaev added this to the 0.0.1 milestone Mar 12, 2024
@Yakov-Varnaev Yakov-Varnaev added the enhancement New feature or request label Mar 12, 2024
@platsajacki platsajacki linked a pull request Mar 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants