@@ -27,22 +27,56 @@ class Meta:
27
27
fields = ["id" , "message_id" , "status" , "message" ]
28
28
29
29
30
+ class ParticipantSimpleSerializer (serializers .ModelSerializer ):
31
+ authority = AuthoritySerializer (read_only = True )
32
+
33
+ class Meta :
34
+ model = models .Participant
35
+ fields = ["id" , "authority" ]
36
+
37
+
38
+ class ParticipantKeySerializer (serializers .ModelSerializer ):
39
+ participant = ParticipantSimpleSerializer (read_only = True )
40
+
41
+ class Meta :
42
+ model = models .ParticipantKey
43
+ fields = ["id" , "participant" , "public_key" ]
44
+
45
+
46
+ class CipherDataSerializer (serializers .ModelSerializer ):
47
+ participant_key = ParticipantKeySerializer (read_only = True )
48
+
49
+ class Meta :
50
+ model = models .CipherData
51
+ fields = ["id" , "cipher_data" , "participant_key" ]
52
+
53
+
30
54
class DataSerializer (serializers .ModelSerializer ):
55
+ cipher_data = CipherDataSerializer (
56
+ read_only = True ,
57
+ source = "cipherdata_set" ,
58
+ many = True ,
59
+ )
60
+
31
61
class Meta :
32
62
model = models .Data
33
- fields = [
34
- "id" , "number" , "extension"
35
- ]
63
+ fields = ["id" , "number" , "extension" , "cipher_data" ]
36
64
37
65
38
66
class MessageSerializer (serializers .ModelSerializer ):
39
67
participants = AuthoritySerializer (read_only = True , many = True )
40
- data = DataSerializer (read_only = True , source = "data_set" , many = True , )
68
+ data = DataSerializer (
69
+ read_only = True ,
70
+ source = "data_set" ,
71
+ many = True ,
72
+ )
41
73
42
74
class Meta :
43
75
model = models .Message
44
76
fields = [
45
77
"id" ,
46
78
"participants" ,
47
79
"data" ,
80
+ "protocol" ,
81
+ "protocol_year" ,
48
82
]
0 commit comments