feat: add mechnic-auto-model
This commit is contained in:
@@ -69,6 +69,66 @@ class AutoevaluationhistoryModel(models.Model):
|
||||
]
|
||||
|
||||
|
||||
class MechanicAutoevaluationhistoryModel(models.Model):
|
||||
"""MechanicAutoEvaluation bo'yicha barcha harakatlar logi — faqat o'qiladi, signallar tomonidan yoziladi."""
|
||||
|
||||
mechanic_auto_evaluation = models.ForeignKey(
|
||||
"evaluation.MechanicAutoEvaluationModel",
|
||||
on_delete=models.CASCADE,
|
||||
related_name="history",
|
||||
verbose_name=_("mechanic auto evaluation"),
|
||||
)
|
||||
event_type = models.CharField(
|
||||
verbose_name=_("event type"),
|
||||
max_length=50,
|
||||
choices=EvaluationEventType.choices,
|
||||
)
|
||||
|
||||
actor_id = models.BigIntegerField(
|
||||
verbose_name=_("actor id"),
|
||||
null=True,
|
||||
blank=True,
|
||||
)
|
||||
actor_full_name = models.CharField(
|
||||
verbose_name=_("actor full name"),
|
||||
max_length=255,
|
||||
default="Tizim",
|
||||
)
|
||||
actor_role = models.CharField(
|
||||
verbose_name=_("actor role"),
|
||||
max_length=50,
|
||||
default="system",
|
||||
)
|
||||
|
||||
meta = models.JSONField(
|
||||
verbose_name=_("meta"),
|
||||
default=dict,
|
||||
blank=True,
|
||||
)
|
||||
|
||||
created_at = models.DateTimeField(
|
||||
verbose_name=_("created at"),
|
||||
auto_now_add=True,
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.get_event_type_display()} — MechanicAutoEval #{self.mechanic_auto_evaluation_id}"
|
||||
|
||||
@classmethod
|
||||
def _baker(cls):
|
||||
return baker.make(cls)
|
||||
|
||||
class Meta:
|
||||
db_table = "MechanicAutoEvaluationHistory"
|
||||
verbose_name = _("Mechanic Auto Evaluation History")
|
||||
verbose_name_plural = _("Mechanic Auto Evaluation Histories")
|
||||
ordering = ["created_at"]
|
||||
indexes = [
|
||||
models.Index(fields=["mechanic_auto_evaluation_id", "created_at"], name="mech_auto_hist_eval_date_idx"),
|
||||
models.Index(fields=["event_type"], name="mech_auto_hist_event_type_idx"),
|
||||
]
|
||||
|
||||
|
||||
class QuickevaluationhistoryModel(models.Model):
|
||||
"""QuickEvaluation bo'yicha barcha harakatlar logi — faqat o'qiladi, signallar tomonidan yoziladi."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user