Revision uid is now the hmac.

master
Tom Hacohen 5 years ago
parent 86b6a44917
commit ab86a912cd

@ -0,0 +1,23 @@
# Generated by Django 3.0.3 on 2020-03-17 15:13
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_etesync', '0031_auto_20200317_1509'),
]
operations = [
migrations.RemoveField(
model_name='collectionitemrevision',
name='hmac',
),
migrations.AlterField(
model_name='collectionitemrevision',
name='uid',
field=models.CharField(db_index=True, max_length=44, unique=True, validators=[django.core.validators.RegexValidator(message='Expected a 256bit base64url.', regex='^[a-zA-Z0-9\\-_]{43}$')]),
),
]

@ -84,11 +84,10 @@ class CollectionItemChunk(models.Model):
class CollectionItemRevision(models.Model):
uid = models.CharField(db_index=True, unique=True, blank=False, null=False,
max_length=44, validators=[UidValidator])
max_length=44, validators=[Base64Url256BitValidator])
item = models.ForeignKey(CollectionItem, related_name='revisions', on_delete=models.CASCADE)
meta = models.BinaryField(editable=True, blank=True, null=True)
chunks = models.ManyToManyField(CollectionItemChunk, related_name='items')
hmac = models.CharField(max_length=50, blank=False, null=False)
current = models.BooleanField(db_index=True, default=True, null=True)
deleted = models.BooleanField(default=False)

@ -66,7 +66,7 @@ class CollectionItemRevisionBaseSerializer(serializers.ModelSerializer):
class Meta:
model = models.CollectionItemRevision
fields = ('chunks', 'hmac', 'deleted')
fields = ('chunks', 'uid', 'deleted')
class CollectionItemRevisionSerializer(CollectionItemRevisionBaseSerializer):

Loading…
Cancel
Save