Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow creation and deletion of generic files #5990

Merged

Conversation

oliverjwroberts
Copy link
Contributor

@oliverjwroberts oliverjwroberts commented Mar 5, 2025

Description of change

Following on from #5989, this PR adds functionality to create and delete generic documents, along with their underlying specific-type document.

Test Instructions

  1. Create generic documents via POST request to v4/document/ with the following payload:
{
    "document_type": "documents.sharepointdocument",
    "document_data": {
        "title": "Project Proposal",
        "url": "https://sharepoint.example.com/sites/project/proposal.docx"
    },
    "related_object_type": "company.company",
    "related_object_id": "<uuid of company>"
}

This example is specifically for a company sharepoint document, which is currently the only supported type.

  1. Soft-delete (i.e. archive) generic documents with a DELETE request to v4/document/<uuid:pk>.

Checklist

  • Has this branch been rebased on top of the current main branch?

    Explanation

    The branch should not be stale or have conflicts at the time reviews are requested.

  • Is the CircleCI build passing?

General points

Other things to check

  • Make sure fixtures/test_data.yaml is maintained when updating models
  • Consider the admin site when making changes to models
  • Use select-/prefetch-related field lists in views and search apps, and update them when fields are added
  • Make sure the README is updated e.g. when adding new environment variables

See docs/CONTRIBUTING.md for more guidelines.

@oliverjwroberts oliverjwroberts self-assigned this Mar 5, 2025
Copy link

codecov bot commented Mar 5, 2025

Codecov Report

Attention: Patch coverage is 98.43750% with 1 line in your changes missing coverage. Please review.

Project coverage is 96.66%. Comparing base (68c27c0) to head (d4fc667).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
datahub/documents/views.py 97.05% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5990      +/-   ##
==========================================
- Coverage   96.67%   96.66%   -0.01%     
==========================================
  Files        1092     1092              
  Lines       25702    25759      +57     
  Branches     1694     1697       +3     
==========================================
+ Hits        24847    24900      +53     
- Misses        698      700       +2     
- Partials      157      159       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@oliverjwroberts oliverjwroberts force-pushed the feature/CLS2-1333-allow-creation-and-deletion-of-files branch from 1643c1f to 82d6ee6 Compare March 6, 2025 12:44
@oliverjwroberts oliverjwroberts marked this pull request as ready for review March 6, 2025 12:45
@oliverjwroberts oliverjwroberts requested a review from a team as a code owner March 6, 2025 12:45
Copy link
Contributor

@code-review-doctor code-review-doctor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some food for thought. View full project report here.

@oliverjwroberts oliverjwroberts force-pushed the feature/CLS2-1333-allow-creation-and-deletion-of-files branch from 82d6ee6 to 7c4a404 Compare March 6, 2025 12:48
@oliverjwroberts oliverjwroberts force-pushed the feature/CLS2-1333-allow-creation-and-deletion-of-files branch from 7c4a404 to d4fc667 Compare March 6, 2025 13:50
@oliverjwroberts oliverjwroberts merged commit 1cfc0f3 into main Mar 10, 2025
7 checks passed
@oliverjwroberts oliverjwroberts deleted the feature/CLS2-1333-allow-creation-and-deletion-of-files branch March 10, 2025 09:45
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.

3 participants