-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
91 lines (74 loc) · 2.65 KB
/
models.py
File metadata and controls
91 lines (74 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
"""
The models used for the production transporter.
"""
__author__ = "Rosetta Reatherford"
__license__ = "AGPL v3"
__maintainer__ = "The Public Library of Science (PLOS)"
import uuid
from django.db import models
from plugins.editorial_manager_transfer_service.enums.report_state import ReportState
from plugins.editorial_manager_transfer_service.enums.transfer_log_message_type import TransferLogMessageType
class TransferReport(models.Model):
"""
A model which allows us to track issues with ingest by bundling error logs by occurrence.
"""
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
report_state = models.CharField(
max_length=3,
choices=ReportState.choices,
default=ReportState.IN_FLIGHT,
)
journal = models.ForeignKey(
"journal.Journal",
on_delete=models.CASCADE,
null=True, blank=True
)
article = models.ForeignKey(
"submission.Article",
on_delete=models.CASCADE,
null=True, blank=True
)
message_date_time_start = models.DateTimeField(auto_now_add=True)
message_date_time_stop = models.DateTimeField(
null=True, blank=True
)
resolved = models.BooleanField(default=False)
class TransferLogs(models.Model):
"""
The model used for transfer logs.
"""
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
message_type = models.CharField(
max_length=2,
choices=TransferLogMessageType.choices,
default=TransferLogMessageType.EXPORT,
)
report = models.ForeignKey(
"editorial_manager_transfer_service.TransferReport",
on_delete=models.CASCADE,
null=True, blank=False
)
journal = models.ForeignKey(
"journal.Journal",
on_delete=models.CASCADE,
null=True, blank=True
)
article = models.ForeignKey(
"submission.Article",
on_delete=models.CASCADE,
null=True, blank=True
)
message = models.TextField()
message_date_time = models.DateTimeField(auto_now_add=True)
success = models.BooleanField(default=False)
class EditorialManagerSection(models.Model):
"""
The model used for the editorial manager section to save the variable IDs.
"""
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
section = models.ForeignKey(
"submission.Section",
on_delete=models.CASCADE,
null=False, blank=False
)
editorial_manager_section_id = models.CharField(max_length=64, null=False, blank=False)