diff --git a/django_etesync/migrations/0032_auto_20200317_1513.py b/django_etesync/migrations/0032_auto_20200317_1513.py new file mode 100644 index 0000000..0546711 --- /dev/null +++ b/django_etesync/migrations/0032_auto_20200317_1513.py @@ -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}$')]), + ), + ] diff --git a/django_etesync/models.py b/django_etesync/models.py index 8df5d44..586c105 100644 --- a/django_etesync/models.py +++ b/django_etesync/models.py @@ -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) diff --git a/django_etesync/serializers.py b/django_etesync/serializers.py index 7a2d3fd..33a09ac 100644 --- a/django_etesync/serializers.py +++ b/django_etesync/serializers.py @@ -66,7 +66,7 @@ class CollectionItemRevisionBaseSerializer(serializers.ModelSerializer): class Meta: model = models.CollectionItemRevision - fields = ('chunks', 'hmac', 'deleted') + fields = ('chunks', 'uid', 'deleted') class CollectionItemRevisionSerializer(CollectionItemRevisionBaseSerializer):