Merge remote-tracking branch 'origin/main' into mk/merge-entities

# Conflicts:
#	backend/app/api/static/docs/docs.go
#	backend/app/api/static/docs/openapi-3.json
#	backend/app/api/static/docs/openapi-3.yaml
#	backend/app/api/static/docs/swagger.json
#	backend/app/api/static/docs/swagger.yaml
#	backend/go.mod
#	backend/go.sum
#	backend/internal/data/ent/attachment.go
#	backend/internal/data/ent/attachment_create.go
#	backend/internal/data/ent/attachment_query.go
#	backend/internal/data/ent/attachment_update.go
#	backend/internal/data/ent/client.go
#	backend/internal/data/ent/ent.go
#	backend/internal/data/ent/entityfield.go
#	backend/internal/data/ent/group.go
#	backend/internal/data/ent/group/group.go
#	backend/internal/data/ent/group/where.go
#	backend/internal/data/ent/group_create.go
#	backend/internal/data/ent/group_query.go
#	backend/internal/data/ent/group_update.go
#	backend/internal/data/ent/has_id.go
#	backend/internal/data/ent/hook/hook.go
#	backend/internal/data/ent/item.go
#	backend/internal/data/ent/item_create.go
#	backend/internal/data/ent/item_delete.go
#	backend/internal/data/ent/item_query.go
#	backend/internal/data/ent/item_update.go
#	backend/internal/data/ent/itemfield_create.go
#	backend/internal/data/ent/itemfield_delete.go
#	backend/internal/data/ent/itemfield_query.go
#	backend/internal/data/ent/itemfield_update.go
#	backend/internal/data/ent/label.go
#	backend/internal/data/ent/label_create.go
#	backend/internal/data/ent/label_query.go
#	backend/internal/data/ent/label_update.go
#	backend/internal/data/ent/location.go
#	backend/internal/data/ent/location_create.go
#	backend/internal/data/ent/location_delete.go
#	backend/internal/data/ent/location_query.go
#	backend/internal/data/ent/location_update.go
#	backend/internal/data/ent/maintenanceentry.go
#	backend/internal/data/ent/maintenanceentry_create.go
#	backend/internal/data/ent/maintenanceentry_query.go
#	backend/internal/data/ent/maintenanceentry_update.go
#	backend/internal/data/ent/migrate/schema.go
#	backend/internal/data/ent/mutation.go
#	backend/internal/data/ent/predicate/predicate.go
#	backend/internal/data/ent/runtime.go
#	backend/internal/data/ent/schema/group.go
#	backend/internal/data/ent/tx.go
#	backend/internal/data/ent/user.go
#	backend/internal/data/ent/user_create.go
#	backend/internal/data/ent/user_update.go
#	backend/internal/data/repo/repo_entity_attachments.go
#	backend/internal/data/repo/repo_items.go
#	backend/internal/data/repo/repo_items_search_test.go
#	backend/internal/data/repo/repos_all.go
#	docs/en/api/openapi-3.0.json
#	docs/en/api/openapi-3.0.yaml
#	docs/en/api/swagger-2.0.json
#	docs/en/api/swagger-2.0.yaml
#	frontend/lib/api/types/data-contracts.ts
This commit is contained in:
Matthew Kilgore
2025-12-13 21:19:43 -05:00
166 changed files with 68011 additions and 18589 deletions

View File

@@ -13,13 +13,9 @@ WHERE path LIKE '%/documents/%'
-- Update Windows-style paths that contain "\documents\" by extracting the part starting from the UUID
-- Convert backslashes to forward slashes in the process for consistency
UPDATE attachments
SET path = REPLACE(SUBSTRING(path FROM POSITION('\documents\' IN path) - 36), '\', '/')
WHERE path LIKE '%\documents\%'
AND POSITION('\documents\' IN path) > 36;
SET path = REPLACE(SUBSTRING(path FROM POSITION(E'\\documents\\' IN path) - 36), E'\\', '/')
WHERE path LIKE E'%\\documents\\%'
AND POSITION(E'\\documents\\' IN path) > 36;
-- For paths that already look like relative paths (start with UUID), leave them unchanged
-- This handles cases where the migration might be run multiple times
-- +goose Down
-- Note: This down migration cannot be safely implemented because we don't know
-- what the original prefix paths were. This is a one-way migration.
-- This handles cases where the migration might be run multiple times

View File

@@ -0,0 +1,8 @@
-- +goose Up
-- Add OIDC identity mapping columns and unique composite index (issuer + subject)
ALTER TABLE public.users ADD COLUMN oidc_issuer VARCHAR;
ALTER TABLE public.users ADD COLUMN oidc_subject VARCHAR;
-- Partial unique index so multiple NULL pairs are allowed, enforcing uniqueness only when both present.
CREATE UNIQUE INDEX users_oidc_issuer_subject_key ON public.users(oidc_issuer, oidc_subject)
WHERE oidc_issuer IS NOT NULL AND oidc_subject IS NOT NULL;

View File

@@ -0,0 +1,29 @@
-- +goose Up
-- Create "item_templates" table
CREATE TABLE IF NOT EXISTS "item_templates" (
"id" uuid NOT NULL,
"created_at" timestamptz NOT NULL,
"updated_at" timestamptz NOT NULL,
"name" character varying NOT NULL,
"description" character varying NULL,
"notes" character varying NULL,
"default_quantity" bigint NOT NULL DEFAULT 1,
"default_insured" boolean NOT NULL DEFAULT false,
"default_name" character varying NULL,
"default_description" character varying NULL,
"default_manufacturer" character varying NULL,
"default_model_number" character varying NULL,
"default_lifetime_warranty" boolean NOT NULL DEFAULT false,
"default_warranty_details" character varying NULL,
"include_warranty_fields" boolean NOT NULL DEFAULT false,
"include_purchase_fields" boolean NOT NULL DEFAULT false,
"include_sold_fields" boolean NOT NULL DEFAULT false,
"default_label_ids" jsonb NULL,
"item_template_location" uuid NULL,
"group_item_templates" uuid NOT NULL,
PRIMARY KEY ("id"),
CONSTRAINT "item_templates_groups_item_templates" FOREIGN KEY ("group_item_templates") REFERENCES "groups" ("id") ON UPDATE NO ACTION ON DELETE CASCADE,
CONSTRAINT "item_templates_locations_location" FOREIGN KEY ("item_template_location") REFERENCES "locations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL
);
-- Create "template_fields" table
CREATE TABLE IF NOT EXISTS "template_fields" ("id" uuid NOT NULL, "created_at" timestamptz NOT NULL, "updated_at" timestamptz NOT NULL, "name" character varying NOT NULL, "description" character varying NULL, "type" character varying NOT NULL, "text_value" character varying NULL, "item_template_fields" uuid NULL, PRIMARY KEY ("id"), CONSTRAINT "template_fields_item_templates_fields" FOREIGN KEY ("item_template_fields") REFERENCES "item_templates" ("id") ON UPDATE NO ACTION ON DELETE CASCADE);

View File

@@ -0,0 +1,2 @@
-- +goose Up
ALTER TABLE users ALTER COLUMN password DROP NOT NULL;