Skip to content

Migrate organization endpoints from Node.js to Go nexus service#82

Merged
jeroenrinzema merged 10 commits intomainfrom
copilot/migrate-organizations-endpoints
Dec 1, 2025
Merged

Migrate organization endpoints from Node.js to Go nexus service#82
jeroenrinzema merged 10 commits intomainfrom
copilot/migrate-organizations-endpoints

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 30, 2025

Migrates organization management endpoints from the legacy Node.js platform service to the Go-based nexus service following the established migration pattern.

Changes

Database Schema

  • Added deleted_at column to organizations table via migration for soft delete support

API Endpoints

  • GET /api/admin/organizations - retrieve current organization
  • GET /api/admin/organizations/integrations - list provider integrations across all projects
  • PATCH /api/admin/organizations - update organization (tracking_deeplink_mirror_url field)
  • DELETE /api/admin/organizations - soft delete organization

Store Layer

// UpdateOrganization uses COALESCE to preserve existing values for optional fields
SET tracking_deeplink_mirror_url = COALESCE($2, tracking_deeplink_mirror_url)

// GetOrganizationIntegrations filters soft-deleted records on both sides of join
FROM providers p
INNER JOIN projects pr ON pr.id = p.project_id
WHERE pr.organization_id = $1
AND p.deleted_at IS NULL
AND pr.deleted_at IS NULL

Code Improvements

  • Created Providers type with OAPI() method for cleaner slice conversion
  • Added CreateProvider method to ProvidersStore following repository pattern
  • No role-based access control checks (RBAC to be implemented later)
  • Database triggers handle updated_at timestamp automatically

Testing

Integration tests use testcontainers covering all endpoints and soft delete behavior.

Original prompt

This section details on the original issue you should resolve

<issue_title>Migrate organizations endpoints to nexus service</issue_title>
<issue_description>The project organization endpoints in /services/platform/src/organizations/OrganizationController.ts have to be migrated to the nexus service. Please follow the style and architecture of the nexus project and include unit tests using test containers for the newly created controller and store if needed.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Migrate organizations endpoints to nexus service Migrate organization endpoints from Node.js to Go nexus service Nov 30, 2025
Copilot AI requested a review from jeroenrinzema November 30, 2025 20:55
@jeroenrinzema jeroenrinzema requested review from Copilot and removed request for jeroenrinzema November 30, 2025 20:56
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates organization management endpoints from the legacy Node.js platform service to the Go-based nexus service, following established patterns for API development, database operations, and authorization.

Key Changes:

  • Added organization management API endpoints (GET, PATCH, DELETE) and integrations listing endpoint
  • Implemented database schema updates with migration for username, domain, and deleted_at columns
  • Added comprehensive integration tests using testcontainers covering all endpoints and authorization scenarios

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
services/nexus/oapi/resources.yml Defines OpenAPI schema for organization endpoints and request/response models
services/nexus/oapi/resources_gen.go Generated code from OpenAPI specification including client methods and server interfaces
services/nexus/internal/store/organizations.go Implements database operations for organizations with soft delete support
services/nexus/internal/store/migrations/1764534650_add_organization_fields.up.sql Adds username, domain, and deleted_at columns to organizations table
services/nexus/internal/store/migrations/1764534650_add_organization_fields.down.sql Rollback migration removing added organization columns
services/nexus/internal/http/controllers/v1/organizations.go HTTP handlers implementing organization CRUD operations with role-based authorization
services/nexus/internal/http/controllers/v1/organizations_test.go Integration tests for all organization endpoints using testcontainers
services/nexus/internal/http/controllers/v1/controller.go Registers organizations controller with main controller struct

Comment thread services/nexus/internal/store/organizations.go Outdated
Comment thread services/nexus/internal/http/controllers/v1/organizations_test.go Outdated
@jeroenrinzema
Copy link
Copy Markdown
Contributor

@copilot apply changes based on the comments in this thread

Comment thread services/nexus/internal/http/controllers/v1/organizations.go Outdated
Comment thread services/nexus/internal/http/controllers/v1/organizations.go Outdated
Comment thread services/nexus/internal/http/controllers/v1/organizations.go Outdated
Comment thread services/nexus/internal/store/organizations.go Outdated
Comment thread services/nexus/internal/store/organizations.go Outdated
Comment thread services/nexus/internal/store/organizations.go Outdated
@jeroenrinzema
Copy link
Copy Markdown
Contributor

@copilot apply changes based on the review comments.

@jeroenrinzema
Copy link
Copy Markdown
Contributor

@copilot Please checkout the review comments in the PR

jeroenrinzema and others added 4 commits December 1, 2025 11:43
Co-authored-by: jeroenrinzema <3440116+jeroenrinzema@users.noreply.github.com>
…ng newlines

Co-authored-by: jeroenrinzema <3440116+jeroenrinzema@users.noreply.github.com>
Copilot AI and others added 6 commits December 1, 2025 11:44
Co-authored-by: jeroenrinzema <3440116+jeroenrinzema@users.noreply.github.com>
Co-authored-by: jeroenrinzema <3440116+jeroenrinzema@users.noreply.github.com>
…providers

Co-authored-by: jeroenrinzema <3440116+jeroenrinzema@users.noreply.github.com>
…and auth column

Co-authored-by: jeroenrinzema <3440116+jeroenrinzema@users.noreply.github.com>
@jeroenrinzema jeroenrinzema force-pushed the copilot/migrate-organizations-endpoints branch from 596c344 to cd9d69b Compare December 1, 2025 10:45
@jeroenrinzema jeroenrinzema merged commit d4cb8a4 into main Dec 1, 2025
3 checks passed
@jeroenrinzema jeroenrinzema deleted the copilot/migrate-organizations-endpoints branch December 1, 2025 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate organizations endpoints to nexus service

3 participants