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

removes lock #233

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[bumpversion]
commit = False
tag = False
current_version = 1.4.2
current_version = 1.4.3
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)([-](?P<release>(rc|alpha))+(?P<build>\d+))?
serialize =
{major}.{minor}.{patch}-{release}{build}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ jobs:
- check-format
- check-sort
- check-oas
- unit-tests
steps:
-
name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Documenten API
==============

:Version: 1.4.2
:Version: 1.4.3
:Source: https://github.com/VNG-Realisatie/documenten-api
:Keywords: zaken, zaakgericht werken, GEMMA, RGBZ, DRC

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "drc",
"version": "1.4.2",
"version": "1.4.3",
"description": "drc referentie implementatie API",
"main": "src/index.js",
"directories": {
Expand Down
2 changes: 1 addition & 1 deletion src/drc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import re
from collections import namedtuple

__version__ = "1.4.2"
__version__ = "1.4.3"
__author__ = "VNG Realisatie"
__homepage__ = "https://github.com/VNG-Realisatie/documenten-api"
__docformat__ = "restructuredtext"
Expand Down
1 change: 0 additions & 1 deletion src/drc/api/serializers/bestandsdeel.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

class BestandsDeelSerializer(serializers.HyperlinkedModelSerializer):
lock = serializers.CharField(
write_only=True,
help_text="Hash string, which represents id of the lock of related informatieobject",
)

Expand Down
11 changes: 6 additions & 5 deletions src/drc/api/serializers/enkelvoudig_informatieobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,10 @@ def _create_bestandsdeel(self, full_size, canonical):
for i in range(parts):
chunk_size = min(settings.CHUNK_SIZE, full_size)
BestandsDeel.objects.create(
informatieobject=canonical, omvang=chunk_size, volgnummer=i + 1
informatieobject=canonical,
omvang=chunk_size,
volgnummer=i + 1,
lock=canonical.lock,
)
full_size -= chunk_size

Expand Down Expand Up @@ -266,10 +269,6 @@ def create(self, validated_data):
eio.ondertekening = ondertekening
eio.save()

# large file process
if not eio.inhoud and eio.bestandsomvang and eio.bestandsomvang > 0:
self._create_bestandsdeel(validated_data["bestandsomvang"], canonical)

# create empty file if size == 0
if eio.bestandsomvang == 0:
eio.inhoud.save("empty_file", ContentFile(""))
Expand Down Expand Up @@ -381,6 +380,8 @@ def create(self, validated_data):
# lock document if it is a large file upload
if not eio.inhoud and eio.bestandsomvang and eio.bestandsomvang > 0:
eio.canonical.lock = uuid.uuid4().hex
# large file process
self._create_bestandsdeel(validated_data["bestandsomvang"], eio.canonical)
eio.canonical.save()
return eio

Expand Down
2 changes: 1 addition & 1 deletion src/drc/api/tests/test_dso_api_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_api_19_documentation_version_yaml(self):
@override_settings(ROOT_URLCONF="drc.api.tests.test_urls")
def test_api_24_version_header(self):
response = self.client.get("/test-view")
self.assertEqual(response["API-version"], "1.4.2")
self.assertEqual(response["API-version"], "1.4.3")


class DSOApi50Tests(APITestCase):
Expand Down
2 changes: 1 addition & 1 deletion src/drc/conf/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from vng_api_common.conf.api import * # noqa - imports white-listed

API_VERSION = "1.4.2"
API_VERSION = "1.4.3"


REST_FRAMEWORK = BASE_REST_FRAMEWORK.copy()
Expand Down
23 changes: 23 additions & 0 deletions src/drc/datamodel/migrations/0064_bestandsdeel_lock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2.13 on 2023-10-19 12:27

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("datamodel", "0063_enkelvoudiginformatieobject_trefwoorden"),
]

operations = [
migrations.AddField(
model_name="bestandsdeel",
name="lock",
field=models.CharField(
blank=True,
help_text="Hash string, which represents id of the lock of related informatieobject",
max_length=255,
null=True,
),
),
]
6 changes: 6 additions & 0 deletions src/drc/datamodel/models/bestandsdeel.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ class BestandsDeel(models.Model):
blank=True,
help_text=_("De (binaire) bestandsinhoud van dit specifieke bestandsdeel."),
)
lock = models.CharField(
default="",
blank=True,
max_length=100,
help_text=_("Hash string, which represents id of the lock"),
)

class Meta:
verbose_name = "bestands deel"
Expand Down
17 changes: 7 additions & 10 deletions src/openapi.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.0.3
info:
title: Documenten API
version: 1.4.2
version: 1.4.3
description:
"Een API om een documentregistratiecomponent (DRC) te benaderen.\n\n\
In een documentregistratiecomponent worden INFORMATIEOBJECTen opgeslagen. Een\n\
Expand Down Expand Up @@ -74,7 +74,7 @@
description: Content type van de verzoekinhoud.
required: true
tags:
- bestandsdelen

Check warning on line 77 in src/openapi.yaml

View workflow job for this annotation

GitHub Actions / check-oas

operation-tag-defined Operation tags should be defined in global tags.
requestBody:
content:
multipart/form-data:
Expand All @@ -83,7 +83,6 @@
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/BestandsDeelRequest'
required: true
security:
- JWT-Claims:
- documenten.bijwerken
Expand Down Expand Up @@ -5451,7 +5450,13 @@
zeggen: het aantal bytes dat staat genoemd bij grootte is daadwerkelijk
ontvangen.'
title: voltooid
lock:
type: string
readOnly: true
description: Hash string, which represents id of the lock of related informatieobject
title: lock
required:
- lock
- omvang
- url
- volgnummer
Expand All @@ -5465,14 +5470,6 @@
writeOnly: true
description: De (binaire) bestandsinhoud van dit specifieke bestandsdeel.
title: inhoud
lock:
type: string
writeOnly: true
minLength: 1
description: Hash string, which represents id of the lock of related informatieobject
title: lock
required:
- lock
BestandsDeelResponse:
type: object
properties:
Expand Down
1 change: 1 addition & 0 deletions src/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Objecttype op [GEMMA Online](https://www.gemmaonline.nl/index.php/Rgbz_1.0/doc/o
| volgnummer | Een volgnummer dat de volgorde van de bestandsdelen aangeeft. | integer | ja | ~~C~~​R​~~U~~​~~D~~ |
| omvang | De grootte van dit specifieke bestandsdeel. | integer | ja | ~~C~~​R​~~U~~​~~D~~ |
| voltooid | Indicatie of dit bestandsdeel volledig is geupload. Dat wil zeggen: het aantal bytes dat staat genoemd bij grootte is daadwerkelijk ontvangen. | boolean | ja | ~~C~~​R​~~U~~​~~D~~ |
| lock | Hash string, which represents id of the lock of related informatieobject | string | ja | ~~C~~​R​~~U~~​~~D~~ |

## EnkelvoudigInformatieObject

Expand Down