* feat: Add item templates feature (#435)
Add ability to create and manage item templates for quick item creation.
Templates store default values and custom fields that can be applied
when creating new items.
Backend changes:
- New ItemTemplate and TemplateField Ent schemas
- Template CRUD API endpoints
- Create item from template endpoint
Frontend changes:
- Templates management page with create/edit/delete
- Template selector in item creation modal
- 'Use as Template' action on item detail page
- Templates link in navigation menu
* refactor: Improve template item creation with a single query
- Add `CreateFromTemplate` method to ItemsRepository that creates items with all template data (including custom fields) in a single atomic transaction, replacing the previous two-phase create-then-update pattern
- Fix `GetOne` to require group ID parameter so templates can only be accessed by users in the owning group (security fix)
- Simplify `HandleItemTemplatesCreateItem` handler using the new transactional method
* Refactor item template types and formatting
Updated type annotations in CreateModal.vue to use specific ItemTemplate types instead of 'any'. Improved code formatting for template fields and manufacturer display. Also refactored warranty field logic in item details page for better readability. This resolves the linter issues as well that the bot in github keeps nagging at.
* Add 'id' property to template fields
Introduces an 'id' property to each field object in CreateModal.vue and item details page to support unique identification of fields. This change prepares the codebase for future enhancements that may require field-level identification.
* Removed redundant SQL migrations.
Removed redundant SQL migrations per @tankerkiller125's findings.
* Updates to PR #1099.
Regarding pull #1099. Fixed an issue causing some conflict with GUIDs and old rows in the migration files.
* Add new fields and location edge to ItemTemplate
Addresses recommendations from @tonyaellie.
* Relocated add template button
* Added more default fields to the template
* Added translation of all strings (think so?)
* Make oval buttons round
* Added duplicate button to the template (this required a rewrite of the migration files, I made sure only 1 exists per DB type)
* Added a Save as template button to a item detail view (this creates a template with all the current data of that item)
* Changed all occurrences of space to gap and flex where applicable.
* Made template selection persistent after item created.
* Collapsible template info on creation view.
* Updates to translation and fix for labels/locations
I also added a test in here because I keep missing small function tests. That should prevent that from happening again.
* Linted
* Bring up to date with main, fix some lint/type check issues
* In theory fix playwright tests
* Fix defaults being unable to be nullable/empty (and thus limiting flexibility)
* Last few fixes I think
* Forgot to fix the golang tests
---------
Co-authored-by: Matthew Kilgore <matthew@kilgore.dev>
* ent re-generation
* add oidc integration
* document oidc integration
* go fmt
* address backend linter findings
* run prettier on index.vue
* State cookie domain can mismatch when Hostname override is used (breaks CSRF check). Add SameSite.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Delete state cookie with matching domain and MaxAge; add SameSite.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Fix endpoint path in comments and error to include /api/v1.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Also use request context when verifying the ID token.
* Do not return raw auth errors to clients (user-enumeration risk).
* consistently set cookie the same way across function
* remove baseURL after declaration
* only enable OIDC routes if OIDC is enabled
* swagger doc for failure
* Only block when provider=local; move the check after parsing provider
* fix extended session comment
* reduce pii logging
* futher reduce pii logging
* remove unused DiscoveryDocument
* remove unused offline_access from default oidc scopes
* remove offline access from AuthCodeURL
* support host from X-Forwarded-Host
* set sane default claim names if unset
* error strings should not be capitalized
* Revert "run prettier on index.vue"
This reverts commit aa22330a23.
* Add timeout to provider discovery
* Split scopes robustly
* refactor hostname calculation
* address frontend prettier findings
* add property oidc on type APISummary
* LoginOIDC: Normalize inputs, only create if not found
* add oidc email verification
* oidc handleCallback: clear state cookie before each return
* add support for oidc nonce parameter
* Harden first-login race: handle concurrent creates gracefully and fix log key.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* support email verified claim as bool or string
* fail fast on empty email
* PKCE verifier
* fix: add timing delay to attachment test to resolve CI race condition
The attachment test was failing intermittently in CI due to a race condition
between attachment creation and retrieval. Adding a small 100ms delay after
attachment creation ensures the file system and database operations complete
before the test attempts to verify the attachment exists.
* Revert "fix: add timing delay to attachment test to resolve CI race condition"
This reverts commit 4aa8b2a0d829753e8d2dd1ba76f4b1e04e28c45e.
* oidc error state, use ref
* rename oidc.force to oidc.authRedirect
* remove hardcoded oidc error timeout
* feat: sub/iss based identity matching and userinfo endpoint collection
---------
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Matthew Kilgore <matthew@kilgore.dev>
* feat: improved duplicate
* feat: enhance item duplication process with transaction handling and error logging for attachments and fields
* feat: add error logging during transaction rollback in item duplication process for better debugging
* feat: don't try and rollback is the commit succeeded
* feat: add customizable duplication options for items, including prefix and field copying settings in API and UI
* fix: simplify duplication checks for custom fields, attachments, and maintenance entries in ItemsRepository duplication method
* refactor: import DuplicateSettings type from composables and sort import issues
* feat: Add URL column to CSV export for items
Enhanced the CSV export functionality to include a URL field for each item. This change required updating the export logic to generate and include item URLs based on the request's referer header.
* chore: add URL configuration to V1Controller for dynamic URL handling in item export
Currently, the implementation for API v1 routes has the main drawback
that any unknown path gets the fallback `notFoundHandler`, trying to
access filesystem paths.
However, for API routes specifically, we can have a subrouter, and a
default NotFound handler that returns 404.
With this change, requests to `api/v1/<unknown>` now correctly returns
status code 404 instead of 200.
* rough implementation of WS based event system for server side notifications of mutation
* fix test construction
* fix deadlock on event bus
* disable linter error
* add item mutation events
* remove old event bus code
* refactor event system to use composables
* refresh items table when new item is added
* fix create form errors
* cleanup unnecessary calls
* fix importer erorrs + limit fn calls on import
Former-commit-id: 2cbcc8bb1d
* fix vue version issue
* new patch API endpoint
* doc-gen
* new API class method for patch operations
* add quantity patch UI support
* fix typegen errors
* fix ts errors
* move typegen code
* update taskfile to fix code-gen caches and use 'dir' attribute
* enable dumping stack traces for errors
* log request start and stop
* set zerolog stack handler
* fix routes function
* refactor context adapters to use requests directly
* change some method signatures to support GID
* start requiring validation tags
* first pass on updating handlers to use adapters
* add errs package
* code gen
* tidy
* rework API to use external server package
* introduce scaffold for new models
* wip: shoutrrr wrapper (may remove)
* update schema files
* gen: ent code
* gen: migrations
* go mod tidy
* add group_id to notifier
* db migration
* new mapper helpers
* notifier repo
* introduce experimental adapter pattern for hdlrs
* refactor adapters to fit more common use cases
* new routes for notifiers
* update errors to fix validation panic
* go tidy
* reverse checkbox label display
* wip: notifiers UI
* use badges instead of text
* improve documentation
* add scaffold schema reference
* remove notifier service
* refactor schema folder
* support group edges via scaffold
* delete test file
* include link to API docs
* audit and update documentation + improve format
* refactor schema edges
* refactor
* add custom validator
* set validate + order fields by name
* fix failing tests
* make login case insensitive
* expand query to support by Field and By AID search
* type generation
* new API callers
* rework search to support field queries
* improve unnecessary data fetches
* clear stores on logout
* change verbage
* add labels
* location tree API
* test fixes
* initial tree location elements
* locations tree page
* update meta-data
* code-gen
* store item display preferences
* introduce basic table/card view elements
* codegen
* set parent location during location creation
* add item support for tree query
* refactor tree view
* wip: location selector improvements
* type gen
* rename items -> search
* remove various log statements
* fix markdown rendering for description
* update location selectors
* fix tests
* fix currency tests
* formatting
* code gen updates
* qrcode support
* remove opacity on toast
* update item view to use tab-like pages
* adjust view for cards
* fix old API calls for ioutils
* move embed
* extract QR code
* add docs for QR codes
* add QR code
* add date format and orDefault helpers
* introduce new statistics calculations queries
* rework statistics endpoints
* code generation
* fix styles on photo card
* label and location aggregation endpoints
* code-gen
* cleanup parser and defaults
* remove debug point
* setup E2E Testing
* linters
* formatting
* fmt plus name support on time series data
* code gen
* schema changes
* db generate
* db migration
* add role based middleware
* implement attachment token access
* generate docs
* implement role based auth
* replace attachment specific tokens with gen token
* run linter
* cleanup temporary token implementation