1
0
mirror of https://github.com/etesync/server synced 2024-11-25 18:28:46 +00:00

Revision uid is now the hmac.

This commit is contained in:
Tom Hacohen 2020-03-17 17:13:47 +02:00
parent 86b6a44917
commit ab86a912cd
3 changed files with 25 additions and 3 deletions

View File

@ -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}$')]),
),
]

View File

@ -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)

View File

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