Skip to content

Add TapasXq::DeletionService to wrap DELETE endpoints #53

@candyhazlett

Description

@candyhazlett

Background

The tapas-xq API exposes two DELETE endpoints that the Rails app does not yet call:

  • DELETE /tapas-xq/:project-id/:doc-id — removes a single core file's TEI, MODS, and TFE from BaseX
  • DELETE /tapas-xq/:project-id — removes all documents for a project from BaseX

Work required

Create: app/services/tapas_xq/deletion_service.rb

The service should accept project_id: and optional doc_id: keyword arguments and expose two methods:

  • #delete_core_file — calls client.delete("/#{project_id}/#{doc_id}"). Requires doc_id. Returns the 202 XML confirmation body.
  • #delete_project — calls client.delete("/#{project_id}"). Returns the 202 XML confirmation body.

Both methods should raise TapasXq::NotFoundError (via client.rb) when tapas-xq returns 404. Callers are responsible for deciding whether to swallow that error.

Accept an optional client: keyword for dependency injection (consistent with StorageService and RetrievalService).

Notes

  • This is a prerequisite for issues covering DeleteFromTapasXqJob, DeleteProjectFromTapasXqJob, and the destroy callbacks on CoreFile and Project.
  • Issue Client#post and #delete don't rescue 404 from tapas-xq #52 (404 rescue in client.rb#post and #delete) must be merged before this service can raise NotFoundError correctly from #delete.

Tests

See spec/services/tapas_xq/deletion_service_spec.rb in the testing plan doc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions