Skip to content

feat(gdpr): DeleteUser RPC and UserDeleted event emission #6

@MarkCesium

Description

@MarkCesium

Summary

No way to delete a user. Required for GDPR and for the cascading cleanup that places, devices, and collector will hook into. Contracts#13 lands the event; this issue produces it.

Changes

  • contracts/proto/auth.proto — add rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty).
  • backend/auth/src/handlers/auth.py — new handler requiring a fresh access token (iat within last 5 min).
  • New service method that, in a single transaction, removes the User row, all its RefreshToken rows, and all OtpRequest rows.
  • After commit, publish UserDeleted to auth.user.deleted. Direct publish for now; auth has a single producer path and we accept best-effort delivery until operational pain justifies an outbox.
  • backend/gateway/src/api/users/DELETE /api/users/me.

Blocked by

Blocks

Verification

  • DELETE /api/users/me with fresh token returns 204.
  • SELECT * FROM users WHERE id = ? in auth_db returns empty; refresh tokens and OTP requests for the user are gone.
  • A Kafka consumer on auth.user.deleted receives the message with user_id, email, deleted_at.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions