Skip to content

Updated services#251

Open
shaply wants to merge 10 commits intomainfrom
davidgu/EmailSenderAndDomainTable
Open

Updated services#251
shaply wants to merge 10 commits intomainfrom
davidgu/EmailSenderAndDomainTable

Conversation

@shaply
Copy link
Copy Markdown
Contributor

@shaply shaply commented Apr 6, 2026

#249

Screen.Recording.2026-04-07.at.10.40.20.PM.mov

@shaply shaply requested a review from llam36 April 6, 2026 03:43
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 6, 2026

Greptile Summary

This PR adds getSenders and getDomains endpoints across the full email service stack: proto definitions, generated TypeScript types, gRPC service implementation, API gateway controller, and e2e tests at both layers. The implementation is consistent with existing patterns and is functionally correct.

Checklist areas to address (score: ~83/100):

  • Use typed interfaces instead of any for SendGrid API response items in email.service.ts (lines 349, 407)
  • Add unit tests that exercise the SendGrid response-mapping logic in getSenders and getDomains

Confidence Score: 5/5

Safe to merge; all remaining findings are P2 style/quality suggestions that do not affect correctness

The new endpoints follow established patterns exactly, proto definitions and generated types are consistent, DTO constructors map fields correctly, and e2e tests at both the gRPC and HTTP layers are present. Both open findings are P2: untyped any in service-layer mapping and shallow test coverage of the mapping logic. Neither causes incorrect runtime behavior.

packages/email-service/src/modules/email/email.service.ts (any types at lines 349, 407) and packages/email-service/test/email.e2e-spec.ts (mapping logic untested)

Important Files Changed

Filename Overview
packages/proto/definitions/email.proto Adds GetSendersRequest/Response, GetDomainsRequest/Response, VerifiedSender, and AuthenticatedDomain proto messages plus corresponding RPC methods on EmailService
packages/proto/src/gen/email.ts Auto-generated TypeScript bindings for new proto messages; consistent with proto source
packages/email-service/src/modules/email/email.controller.ts Wires getSenders and getDomains gRPC handlers to the service layer following existing patterns
packages/email-service/src/modules/email/email.service.ts Implements getSenders and getDomains via SendGrid REST API; uses any type for response item mapping at lines 349 and 407
packages/email-service/test/email.e2e-spec.ts Adds e2e tests for new gRPC methods but only validates the empty-array test stub; actual SendGrid mapping logic is untested
packages/api-gateway/src/models/email.dto.ts Adds VerifiedSenderResponse, GetSendersResponse, AuthenticatedDomainResponse, GetDomainsResponse DTOs consistent with existing patterns
packages/api-gateway/src/modules/email/email.controller.ts Adds GET /senders and GET /domains REST endpoints delegating to gRPC client, following existing controller patterns
packages/api-gateway/test/email.e2e-spec.ts Adds e2e tests for the two new API gateway endpoints with HTTP 200 assertions and auth checks
pnpm-lock.yaml Formatting-only changes to the lock file; no dependency additions or version changes

Sequence Diagram

sequenceDiagram
    participant Client as HTTP Client
    participant GW as API Gateway<br/>(email.controller.ts)
    participant ES as Email Service<br/>(email.service.ts)
    participant DB as EmailDbService<br/>(gRPC)
    participant SG as SendGrid API

    Client->>GW: GET /email/senders
    GW->>ES: getSenders(configId, env) [gRPC]
    ES->>DB: getEmailServiceConfig(id, env)
    DB-->>ES: EmailServiceConfig (sendgridKey)
    ES->>SG: GET /v3/verified_senders
    SG-->>ES: { results: [...] }
    ES-->>GW: GetSendersResponse { senders: [...] }
    GW-->>Client: 200 { senders: [...] }

    Client->>GW: GET /email/domains
    GW->>ES: getDomains(configId, env) [gRPC]
    ES->>DB: getEmailServiceConfig(id, env)
    DB-->>ES: EmailServiceConfig (sendgridKey)
    ES->>SG: GET /v3/whitelabel/domains
    SG-->>ES: [...]
    ES-->>GW: GetDomainsResponse { domains: [...] }
    GW-->>Client: 200 { domains: [...] }
Loading

Reviews (1): Last reviewed commit: "Prettier" | Re-trigger Greptile

Comment thread packages/email-service/src/modules/email/email.service.ts Outdated
Comment thread packages/email-service/src/modules/email/email.service.ts Outdated
Comment thread packages/email-service/test/email.e2e-spec.ts
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.

1 participant