Skip to content

!refactor(backend): restructure user endpoints#9604

Closed
matmair wants to merge 92 commits into
inventree:next-breakingfrom
matmair:refactor(backend)--restucture-user-endpoints
Closed

!refactor(backend): restructure user endpoints#9604
matmair wants to merge 92 commits into
inventree:next-breakingfrom
matmair:refactor(backend)--restucture-user-endpoints

Conversation

@matmair
Copy link
Copy Markdown
Member

@matmair matmair commented Apr 28, 2025

This realigns the user API endpoints by:

  • moving endpoints that only return results for the current user to /user/me/
  • renaming the list endpoint for tokens from 'tokens' to 'token' as that name is now free

see #11433

@matmair matmair added api Relates to the API breaking Indicates a major update or change which breaks compatibility labels Apr 28, 2025
@matmair matmair added this to the 2.0.0 milestone Apr 28, 2025
@matmair matmair self-assigned this Apr 28, 2025
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 28, 2025

Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit ca39264
🔍 Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/680ff6eb261b5500083ea9ab
😎 Deploy Preview https://deploy-preview-9604--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 95 (🔴 down 1 from production)
Accessibility: 89 (no change from production)
Best Practices: 100 (no change from production)
SEO: 78 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.35%. Comparing base (f631eeb) to head (3f51e98).

Additional details and impacted files
@@                Coverage Diff                @@
##           next-breaking    #9604      +/-   ##
=================================================
+ Coverage          87.98%   91.35%   +3.37%     
=================================================
  Files               1295      962     -333     
  Lines              58843    49189    -9654     
  Branches            1938        0    -1938     
=================================================
- Hits               51774    44939    -6835     
+ Misses              6587     4250    -2337     
+ Partials             482        0     -482     
Flag Coverage Δ
backend 89.18% <ø> (+<0.01%) ⬆️
pui ?
web ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Backend Apps 91.67% <ø> (+<0.01%) ⬆️
Backend General 93.37% <ø> (ø)
Frontend ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@matmair matmair changed the base branch from master to next-breaking February 26, 2026 20:01
@matmair matmair marked this pull request as ready for review February 27, 2026 00:18
Comment thread src/backend/InvenTree/InvenTree/api_version.py Outdated
@matmair matmair marked this pull request as draft February 27, 2026 20:15
@matmair
Copy link
Copy Markdown
Member Author

matmair commented Feb 27, 2026

moving to draft while I think about the API change that was brought up

dependabot Bot and others added 9 commits February 28, 2026 09:06
…updates (inventree#11438)

* chore(deps): bump the dependencies group across 2 directories with 8 updates

Bumps the dependencies group with 1 update in the /docs directory: [mkdocs-material](https://github.com/squidfunk/mkdocs-material).
Bumps the dependencies group with 7 updates in the /src/backend directory:

| Package | From | To |
| --- | --- | --- |
| [tinycss2](https://github.com/Kozea/tinycss2) | `1.4.0` | `1.5.1` |
| [wrapt](https://github.com/GrahamDumpleton/wrapt) | `1.17.3` | `2.1.1` |
| [filelock](https://github.com/tox-dev/py-filelock) | `3.21.2` | `3.24.3` |
| [isort](https://github.com/PyCQA/isort) | `7.0.0` | `8.0.0` |
| [pytest-django](https://github.com/pytest-dev/pytest-django) | `4.11.1` | `4.12.0` |
| [rich](https://github.com/Textualize/rich) | `14.3.2` | `14.3.3` |
| [virtualenv](https://github.com/pypa/virtualenv) | `20.36.1` | `20.38.0` |



Updates `mkdocs-material` from 9.7.1 to 9.7.2
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](squidfunk/mkdocs-material@9.7.1...9.7.2)

Updates `tinycss2` from 1.4.0 to 1.5.1
- [Release notes](https://github.com/Kozea/tinycss2/releases)
- [Changelog](https://github.com/Kozea/tinycss2/blob/main/docs/changelog.rst)
- [Commits](Kozea/tinycss2@v1.4.0...v1.5.1)

Updates `wrapt` from 1.17.3 to 2.1.1
- [Release notes](https://github.com/GrahamDumpleton/wrapt/releases)
- [Changelog](https://github.com/GrahamDumpleton/wrapt/blob/develop/docs/changes.rst)
- [Commits](GrahamDumpleton/wrapt@1.17.3...2.1.1)

Updates `filelock` from 3.21.2 to 3.24.3
- [Release notes](https://github.com/tox-dev/py-filelock/releases)
- [Changelog](https://github.com/tox-dev/filelock/blob/main/docs/changelog.rst)
- [Commits](tox-dev/filelock@3.21.2...3.24.3)

Updates `isort` from 7.0.0 to 8.0.0
- [Release notes](https://github.com/PyCQA/isort/releases)
- [Changelog](https://github.com/PyCQA/isort/blob/main/CHANGELOG.md)
- [Commits](PyCQA/isort@7.0.0...8.0.0)

Updates `pytest-django` from 4.11.1 to 4.12.0
- [Release notes](https://github.com/pytest-dev/pytest-django/releases)
- [Changelog](https://github.com/pytest-dev/pytest-django/blob/main/docs/changelog.rst)
- [Commits](pytest-dev/pytest-django@v4.11.1...v4.12.0)

Updates `rich` from 14.3.2 to 14.3.3
- [Release notes](https://github.com/Textualize/rich/releases)
- [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md)
- [Commits](Textualize/rich@v14.3.2...v14.3.3)

Updates `virtualenv` from 20.36.1 to 20.38.0
- [Release notes](https://github.com/pypa/virtualenv/releases)
- [Changelog](https://github.com/pypa/virtualenv/blob/main/docs/changelog.rst)
- [Commits](pypa/virtualenv@20.36.1...20.38.0)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-version: 9.7.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: tinycss2
  dependency-version: 1.5.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: wrapt
  dependency-version: 2.1.1
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: dependencies
- dependency-name: filelock
  dependency-version: 3.24.3
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: isort
  dependency-version: 8.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dependencies
- dependency-name: pytest-django
  dependency-version: 4.12.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: rich
  dependency-version: 14.3.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: virtualenv
  dependency-version: 20.38.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix style

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matthias Mair <code@mjmair.com>
…e#11436)

* chore(deps): bump pypdf from 6.7.2 to 6.7.3 in /src/backend

Bumps [pypdf](https://github.com/py-pdf/pypdf) from 6.7.2 to 6.7.3.
- [Release notes](https://github.com/py-pdf/pypdf/releases)
- [Changelog](https://github.com/py-pdf/pypdf/blob/main/CHANGELOG.md)
- [Commits](py-pdf/pypdf@6.7.2...6.7.3)

---
updated-dependencies:
- dependency-name: pypdf
  dependency-version: 6.7.3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix style

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matthias Mair <code@mjmair.com>
* add "updated_at" field to PurchaseOrder model

* change to use abstract po instead

* add api filters

* add show, order and filter by po updated_at date to frontend

* add tests and increment api_version

* change updated_at to null by default

* never trust github conflict resolution

* bump docker image to python 3.14 (inventree#11414)

* chore(deps): bump the dependencies group across 1 directory with 4 updates (inventree#11416)

Bumps the dependencies group with 4 updates in the / directory: [depot/setup-action](https://github.com/depot/setup-action), [depot/build-push-action](https://github.com/depot/build-push-action), [anchore/sbom-action](https://github.com/anchore/sbom-action) and [actions/stale](https://github.com/actions/stale).


Updates `depot/setup-action` from 1.6.0 to 1.7.1
- [Release notes](https://github.com/depot/setup-action/releases)
- [Commits](depot/setup-action@b0b1ea4...15c09a5)

Updates `depot/build-push-action` from 1.16.2 to 1.17.0
- [Release notes](https://github.com/depot/build-push-action/releases)
- [Commits](depot/build-push-action@9785b13...5f3b3c2)

Updates `anchore/sbom-action` from 0.21.1 to 0.22.2
- [Release notes](https://github.com/anchore/sbom-action/releases)
- [Changelog](https://github.com/anchore/sbom-action/blob/main/RELEASE.md)
- [Commits](anchore/sbom-action@0b82b0b...28d7154)

Updates `actions/stale` from 10.1.1 to 10.2.0
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](actions/stale@9971854...b5d41d4)

---
updated-dependencies:
- dependency-name: depot/setup-action
  dependency-version: 1.7.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: depot/build-push-action
  dependency-version: 1.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: anchore/sbom-action
  dependency-version: 0.22.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: actions/stale
  dependency-version: 10.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [UI] Copy cells expansion (inventree#11410)

* Prevent copy button if copy value is null

* Add "link" columns to order tables

* Support copy for default column types

* Tweak padding to avoid flickering issues

* Refactor IPNColumn

* Adjust visual styling

* Copy for SKU and MPN columns

* Add more copy columns

* More tweaks

* Tweak playwright testing

* Further cleanup

* More copy cols

* Fix auto pricing overwriting manual purchase price inventree#10846 (inventree#11411)

* Fix auto pricing overwriting manual purchase price inventree#10846

* Added entry to api_version.py

---------

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>

* [UI] Default locale (inventree#11412)

* [UI] Support default server language

* Handle faulty theme

* Add option for default language

* Improve language selection

* Brief docs entry

* Fix typo

* Fix yarn build

* Remove debug msg

* Fix calendar locale

* feat(backend): ensure restore of backups only works in correct enviroments (inventree#11372)

* [FR] ensure restore of backups only works in correct enviroments
Fixes inventree#11214

* update PR nbr

* fix wrong ty detection

* fix link

* ensure tracing does not enagage while running backup ops

* fix import

* remove debugging string

* add error codes

* add tests for backup and restore

* complete test for restore

* we do not need e2e on every matrix entry
there is no realy db dep here

* fix changelog format

* add flag to allow bypass

* update CHANGELOG.md

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
Co-authored-by: Matthias Mair <code@mjmair.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: JustusRijke <53965859+JustusRijke@users.noreply.github.com>
…e#11443)

Bumps [pypdf](https://github.com/py-pdf/pypdf) from 6.7.3 to 6.7.4.
- [Release notes](https://github.com/py-pdf/pypdf/releases)
- [Changelog](https://github.com/py-pdf/pypdf/blob/main/CHANGELOG.md)
- [Commits](py-pdf/pypdf@6.7.3...6.7.4)

---
updated-dependencies:
- dependency-name: pypdf
  dependency-version: 6.7.4
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add unit test to detect unreliable pagination

* Enforce PK field ordering

- Append 'pk' ordering to InvenTreeOrderingFilter

* Use our ordering filter everywhere

* Simplify ordering options

* Enforce list

* Use last term for ordering checks

* Individual delete to fix mysql issue
* allow zero qty bom item with setting

* add allow zero bom qty setting to docs

---------

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
- Check session completion when deleting rows
SchrodingersGat and others added 23 commits March 20, 2026 15:41
* Fix parent field for StockItemSerializer

- Closes inventree#11507

* Bump API version
* Record user info when creating stock item

* Add unit test

* Add playwright test
* Add helper to check the existence of a static file

* Log error if plugin static file does not exist

* Support cache busting for plugin files

* Use Pathlib instead

* Improve generic URL resolution

* Add unit test
* DataOutput API fix

- Prevent non-staff users from accessing unrelated DataOutput instances

* Add unit tests
* Improvements for get_bulk_queryset

- Limit scope to base view queryset
- Remove ability to provide arbitrary filters
- Remove feedback if zero items are found

* Adjust unit test

* Remove filter test

* Update CHANGELOG.md
* Refactoring for media file report helper functions

* Updated unit tests

* Improved error handling

* Generic path return for asset

* Fix return type annotations

* Fix existing test

* Tweaked unit test

* Collect static files in CI

* Run static step for all DB tests

* Update action.yaml

* Fix for action.yaml

* Updated unit tests
… version (inventree#10862)

* Fixed issue where importing data from older versions of InvenTree+Postgres would fail

* Update tasks.py

Changed .startswith to exact matching for users.userprofile.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update tasks.py

Added validation checks to user primary key pairing dict.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Reverted tasks.py, disabled signals in user model when importing data

---------

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* [API] Bug fix for PartStar and PartCategoryStar

- Logic refactor and fixes

* Add playwright tests

* Remove debug statements

* Revert API string changes
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Support image upload from clipboard

* Suffix the image upload dialog message with the clipboard paste capability
* full bump

* bump base image

* update comment

* fix ty errors

* lower allauth
* Restrict queryset for DataImportSession

- Only allow non-staff users to see their own sessions

* Add unit test

* raise PermissionDenied if no user info available
)

Bumps the dependencies group with 4 updates: [dorny/paths-filter](https://github.com/dorny/paths-filter), [actions/download-artifact](https://github.com/actions/download-artifact), [svenstaro/upload-release-action](https://github.com/svenstaro/upload-release-action) and [crowdin/github-action](https://github.com/crowdin/github-action).


Updates `dorny/paths-filter` from 3.0.2 to 4.0.1
- [Release notes](https://github.com/dorny/paths-filter/releases)
- [Changelog](https://github.com/dorny/paths-filter/blob/master/CHANGELOG.md)
- [Commits](dorny/paths-filter@de90cc6...fbd0ab8)

Updates `actions/download-artifact` from 8.0.0 to 8.0.1
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@70fc10c...3e5f45b)

Updates `svenstaro/upload-release-action` from 2.11.4 to 2.11.5
- [Release notes](https://github.com/svenstaro/upload-release-action/releases)
- [Changelog](https://github.com/svenstaro/upload-release-action/blob/master/CHANGELOG.md)
- [Commits](svenstaro/upload-release-action@b98a3b1...29e53e9)

Updates `crowdin/github-action` from 2.15.0 to 2.15.2
- [Release notes](https://github.com/crowdin/github-action/releases)
- [Commits](crowdin/github-action@8818ff6...ce33ce7)

---
updated-dependencies:
- dependency-name: dorny/paths-filter
  dependency-version: 4.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: dependencies
- dependency-name: actions/download-artifact
  dependency-version: 8.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: svenstaro/upload-release-action
  dependency-version: 2.11.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: crowdin/github-action
  dependency-version: 2.15.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Update DataExport functionality

- Chunk queryset into memory

* Allow larger number of queries for chunked database fetching

* Handle possible exception in unit testing
- Ignore sqlflush command
…ree#11607)

Bumps [yaml](https://github.com/eemeli/yaml) from 1.10.2 to 1.10.3.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](eemeli/yaml@v1.10.2...v1.10.3)

---
updated-dependencies:
- dependency-name: yaml
  dependency-version: 1.10.3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…cture-user-endpoints"

This reverts commit 6233fe4, reversing
changes made to 22ae0d0.
@matmair
Copy link
Copy Markdown
Member Author

matmair commented Mar 30, 2026

@SchrodingersGat ready for review

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 22, 2026

Merging this PR will improve performance by 6.34%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚡ 1 improved benchmark
✅ 1 untouched benchmark
⏩ 42 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime test_api_stock_list 442 ms 415.6 ms +6.34%

Comparing matmair:refactor(backend)--restucture-user-endpoints (3f51e98) with next-breaking (f631eeb)

Open in CodSpeed

Footnotes

  1. 42 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@matmair
Copy link
Copy Markdown
Member Author

matmair commented May 21, 2026

replaced by #11963

@matmair matmair closed this May 21, 2026
@matmair matmair deleted the refactor(backend)--restucture-user-endpoints branch May 21, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Relates to the API breaking Indicates a major update or change which breaks compatibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants