feat: add mechnic-auto-model

This commit is contained in:
xoliqberdiyev
2026-05-05 16:53:49 +05:00
parent 9dcce296a6
commit 928561be51
16 changed files with 1390 additions and 2 deletions

View File

@@ -0,0 +1,39 @@
from rest_framework import serializers
from core.apps.evaluation.models import MechanicAutoevaluationhistoryModel
class BaseMechanicAutoevaluationhistorySerializer(serializers.ModelSerializer):
event_type_display = serializers.CharField(source="get_event_type_display", read_only=True)
actor = serializers.SerializerMethodField()
def get_actor(self, obj):
return {
"id": obj.actor_id,
"full_name": obj.actor_full_name,
"role": obj.actor_role,
}
class Meta:
model = MechanicAutoevaluationhistoryModel
fields = [
"id",
"event_type",
"event_type_display",
"actor",
"meta",
"created_at",
]
class ListMechanicAutoevaluationhistorySerializer(BaseMechanicAutoevaluationhistorySerializer):
class Meta(BaseMechanicAutoevaluationhistorySerializer.Meta): ...
class RetrieveMechanicAutoevaluationhistorySerializer(BaseMechanicAutoevaluationhistorySerializer):
class Meta(BaseMechanicAutoevaluationhistorySerializer.Meta):
fields = BaseMechanicAutoevaluationhistorySerializer.Meta.fields + ["mechanic_auto_evaluation"]
class CreateMechanicAutoevaluationhistorySerializer(BaseMechanicAutoevaluationhistorySerializer):
class Meta(BaseMechanicAutoevaluationhistorySerializer.Meta): ...

View File

@@ -1,2 +1,3 @@
from .AutoEvaluationHistory import * # noqa
from .MechanicAutoEvaluationHistory import * # noqa
from .QuickEvaluationHistory import * # noqa