(ctx context.Context, _ *struct{})
| 176 | } |
| 177 | |
| 178 | func (s *Server) handleExportUserData(ctx context.Context, _ *struct{}) (*exportOutput, error) { |
| 179 | user, err := s.requireAccountUser(ctx) |
| 180 | if err != nil { |
| 181 | return nil, err |
| 182 | } |
| 183 | if s.deps.ExportUserData == nil { |
| 184 | return nil, NewError(http.StatusInternalServerError, "internal_error", "export unavailable") |
| 185 | } |
| 186 | dump, err := s.deps.ExportUserData(ctx, user.ID) |
| 187 | if err != nil { |
| 188 | return nil, NewError(http.StatusInternalServerError, "internal_error", "failed to export user data") |
| 189 | } |
| 190 | // A-3: top-level export collections render as [] not null when empty. |
| 191 | if dump != nil { |
| 192 | dump.Domains = orEmpty(dump.Domains) |
| 193 | dump.Agents = orEmpty(dump.Agents) |
| 194 | dump.APIKeys = orEmpty(dump.APIKeys) |
| 195 | dump.Messages = orEmpty(dump.Messages) |
| 196 | dump.UsageEvents = orEmpty(dump.UsageEvents) |
| 197 | dump.OAuthConnections = orEmpty(dump.OAuthConnections) |
| 198 | } |
| 199 | return &exportOutput{ |
| 200 | ContentDisposition: `attachment; filename="e2a-export-` + user.ID + `.json"`, |
| 201 | Body: dump, |
| 202 | }, nil |
| 203 | } |
| 204 | |
| 205 | type deleteAccountInput struct { |
| 206 | Confirm string `query:"confirm" doc:"Must be DELETE — this is irreversible."` |
nothing calls this directly
no test coverage detected