Skip to content

Commit b044f7b

Browse files
bailinheCopilot
andauthored
feat: Extension Resources Group Ownership (#276)
* feat: add owner_id to system_extension_resources and implement ownership checks - Added owner_id column to system_extension_resources table with foreign key reference to groups. - Updated Group model to include relationships for OwnerSystemExtensionResources. - Implemented methods for managing ownership of system extension resources in Group and SystemExtensionResource models. - Enhanced authorization middleware to check for resource ownership based on the new owner_id field. - Refactored createSystemExtensionResource to handle owner assignment and validation. - Updated tests to cover new ownership logic and ensure correct error handling for scope violations. Signed-off-by: Bailin He <bahe@equinix.com> * feat: add resource_version to system_extension_resources and update related logic Signed-off-by: Bailin He <bahe@equinix.com> * feat: implement extension resource management with ownership and versioning Signed-off-by: Bailin He <bahe@equinix.com> * feat: refactor extension resource management to support new routing and ownership features - Updated routes for creating and updating extension resources to remove URI parameters. - Implemented ownership checks and resource versioning in extension resource creation and update logic. - Enhanced test cases to reflect changes in API structure and validation. Signed-off-by: Bailin He <bahe@equinix.com> * feat: add create and update request schemas for extension resources and update related paths Signed-off-by: Bailin He <bahe@equinix.com> * rename functions Signed-off-by: Bailin He <bahe@equinix.com> * feat: add Create and Update methods for extension resources with error handling Signed-off-by: Bailin He <bahe@equinix.com> * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * feat: enhance request body handling in middleware for extension resource authorization Signed-off-by: Bailin He <bahe@equinix.com> * refactor: rename tracing span for create and update system extension resource functions Signed-off-by: Bailin He <bahe@equinix.com> * feat: improve request body handling in middleware for extension resource retrieval Signed-off-by: Bailin He <bahe@equinix.com> --------- Signed-off-by: Bailin He <bahe@equinix.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent ea401c3 commit b044f7b

20 files changed

Lines changed: 2135 additions & 1015 deletions
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-- +goose Up
2+
-- +goose StatementBegin
3+
4+
ALTER TABLE system_extension_resources
5+
ADD COLUMN owner_id UUID REFERENCES groups(id) ON DELETE SET NULL,
6+
ADD COLUMN resource_version BIGINT NOT NULL DEFAULT 1,
7+
ADD COLUMN messages JSONB[] NOT NULL DEFAULT ARRAY['{}'::JSONB]::JSONB[]
8+
;
9+
10+
-- +goose StatementEnd
11+
12+
-- +goose Down
13+
-- +goose StatementBegin
14+
15+
ALTER TABLE system_extension_resources DROP COLUMN IF EXISTS messages;
16+
ALTER TABLE system_extension_resources DROP COLUMN IF EXISTS resource_version;
17+
ALTER TABLE system_extension_resources DROP COLUMN IF EXISTS owner_id;
18+
19+
-- +goose StatementEnd

internal/models/psql/groups.go

Lines changed: 274 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)