Skip to content

Commit 8d5e8b0

Browse files
committed
chore: change custom domain query to singular
Relationships betweeen orgs and custom domains is already somewhat tricky to reason about. Might as well make life a little easier.
1 parent beb88f5 commit 8d5e8b0

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

server/internal/customdomains/impl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func (s *Service) GetDomain(ctx context.Context, payload *gen.GetDomainPayload)
7272
return nil, oops.C(oops.CodeUnauthorized)
7373
}
7474

75-
domain, err := s.repo.GetCustomDomainsByOrganization(ctx, authCtx.ActiveOrganizationID)
75+
domain, err := s.repo.GetCustomDomainByOrganization(ctx, authCtx.ActiveOrganizationID)
7676
if err != nil {
7777
return nil, oops.E(oops.CodeNotFound, err, "no custom domain found for organization").Log(ctx, s.logger)
7878
}

server/internal/customdomains/queries.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ INSERT INTO custom_domains (
1212
)
1313
RETURNING *;
1414

15-
-- name: GetCustomDomainsByOrganization :one
15+
-- name: GetCustomDomainByOrganization :one
1616
SELECT *
1717
FROM custom_domains
1818
WHERE organization_id = @organization_id

server/internal/customdomains/repo/queries.sql.go

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

server/internal/mcpmetadata/impl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ func (s *Service) resolveDomainIDFromContext(ctx context.Context) *uuid.UUID {
392392
return nil
393393
}
394394

395-
domainRecord, err := s.domainsRepo.GetCustomDomainsByOrganization(ctx, authCtx.ActiveOrganizationID)
395+
domainRecord, err := s.domainsRepo.GetCustomDomainByOrganization(ctx, authCtx.ActiveOrganizationID)
396396
if err != nil {
397397
s.logger.ErrorContext(ctx, "failed to get custom domains by organization ID", attr.SlogError(err))
398398
return nil

server/internal/toolsets/impl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func (s *Service) UpdateToolset(ctx context.Context, payload *gen.UpdateToolsetP
249249

250250
var activeCustomDomainID *uuid.UUID
251251
toolsetDomainID := conv.FromNullableUUID(existingToolset.CustomDomainID)
252-
if domain, err := s.domainsRepo.GetCustomDomainsByOrganization(ctx, authCtx.ActiveOrganizationID); err == nil && domain.Activated && domain.Verified {
252+
if domain, err := s.domainsRepo.GetCustomDomainByOrganization(ctx, authCtx.ActiveOrganizationID); err == nil && domain.Activated && domain.Verified {
253253
activeCustomDomainID = &domain.ID
254254
}
255255

0 commit comments

Comments
 (0)