[ADD] FACEDETECTION: Employee price allocate view

This commit is contained in:
Horilla
2025-09-26 11:23:26 +05:30
parent 90683a438d
commit f8c2f4c846
2 changed files with 14 additions and 2 deletions

View File

@@ -5,6 +5,9 @@ from django.db import models
from django.db.models.signals import post_delete
from django.dispatch import receiver
from employee.models import Employee
from horilla.models import HorillaModel, upload_path
# Create your models here.
@@ -44,9 +47,13 @@ class FaceDetection(models.Model):
class EmployeeFaceDetection(models.Model):
employee_id = models.OneToOneField(
"employee.Employee", related_name="face_detection", on_delete=models.CASCADE
Employee, related_name="face_detection", on_delete=models.CASCADE
)
image = models.ImageField(
null=True,
blank=True,
upload_to=upload_path,
)
image = models.ImageField()
@receiver(post_delete, sender=EmployeeFaceDetection)

View File

@@ -101,6 +101,11 @@ class EmployeeFaceDetectionGetPostAPIView(APIView):
except Exception as e:
raise serializers.ValidationError(e)
def get(self, request):
facedetection = self.get_facedetection(request)
serializer = EmployeeFaceDetectionSerializer(facedetection)
return Response(serializer.data, status=status.HTTP_200_OK)
def post(self, request):
if self.get_facedetection(request).start:
employee_id = request.user.employee_get.id