Beispiel #1
0
class WorkerCheckRelationSerializer(BaseDBSerializer):
    class VerificationInfoSerializer(serializers.Serializer):
        source = serializers.CharField()
        is_valid = serializers.BooleanField(allow_null=True, default=None)
        dov = serializers.DateTimeField(allow_null=True, default=None)
        worker_document_ref = DocumentReferenceField(allow_null=True,
                                                     default=None)

    worker_ref = DocumentReferenceField()
    check_ref = DocumentReferenceField()
    organisation_ref = DocumentReferenceField(allow_null=True, default=None)
    check_value = serializers.CharField()
    verification_info = VerificationInfoSerializer(allow_null=True,
                                                   default=None)
    status = serializers.ChoiceField(choices=WCRStatus._member_names_)
    check_type = serializers.ChoiceField(choices=CheckType._member_names_)
    expected_completion_at = serializers.DateTimeField()

    def validate(self, attrs):
        if attrs.get("check_type", None) == CheckType.ORG_SPECIFIC.value:
            if not attrs.get("organisation_ref", None):
                raise serializers.ValidationError(
                    "organisation_ref is required when check_type is ORG_SPECIFIC"
                )
        return super().validate(attrs)
Beispiel #2
0
class ShiftPatternDBSerializer(SharedJobShiftDBSerializer,
                               ShiftBudgetSharedDBSerializer):
    start_date = serializers.DateTimeField()
    start_time = serializers.IntegerField()
    end_time = serializers.IntegerField()
    multi_day_shift = serializers.BooleanField(default=False)
    is_recurring = serializers.BooleanField(default=False)
    recurrence = RecurrenceSerializer()
    location_ref = DocumentReferenceField(default=None, allow_null=True)
    location_data = OrganisationLocationDBSerializer()
    assigned = serializers.BooleanField(default=False)
    assigned_at = serializers.DateTimeField(required=False, allow_null=True)
    geo_fence_distance = serializers.IntegerField(default=0)
    geo_fence_enabled = serializers.BooleanField(default=False)
    job_ref = DocumentReferenceField()
    role = serializers.CharField(required=False)
    shift_pattern_reference_id = serializers.CharField()
    total_shift_hours = serializers.FloatField()
    worker_ref = DocumentReferenceField(default=None, allow_null=True)
    worker_data = serializers.DictField(default=None, allow_null=True)
    shift_note_ref = DocumentReferenceField(
        required=False,
        default=None,
        allow_null=True,
    )
Beispiel #3
0
class WorkerSkillRelationSerializer(serializers.Serializer):
    worker_ref = DocumentReferenceField()
    skill_ref = DocumentReferenceField()
    skill_value = serializers.CharField()
    external_work_experience_sources = serializers.DictField(
        child=serializers.BooleanField(), default={})
    sourced_from_fielder_work_experience = serializers.BooleanField(
        default=False)
Beispiel #4
0
class OfferDBSerializer(BaseDBSerializer):
    shift_pattern_ref = DocumentReferenceField()
    worker_ref = DocumentReferenceField()
    worker_type = serializers.ChoiceField(choices=WorkerType._member_names_)
    org_profile_ref = DocumentReferenceField(allow_null=True, default=None)
    job_ref = DocumentReferenceField()
    shift_pattern_data = serializers.DictField()
    job_data = serializers.DictField()
    status = serializers.ChoiceField(choices=OfferStatus._member_names_)
    expiry_time = serializers.DateTimeField(allow_null=True, default=None)
    sent_time = serializers.DateTimeField(allow_null=True, default=None)
    budget = serializers.DictField()
    responded_at = serializers.DateTimeField(required=False)
    accepted_at = serializers.DateTimeField(required=False)
    personalised_message = serializers.CharField(required=False)
Beispiel #5
0
class FielderWorkExperienceSerializer(WorkExperienceSerializer):
    job_ref = DocumentReferenceField()
    total_hours = serializers.FloatField(default=0.0)
    total_shifts = serializers.IntegerField(default=0)

    def to_internal_value(self, data):
        if "type" not in data:
            data["type"] = "Fielder"

        data["status"] = STATUS.VERIFIED.name
        return super().to_internal_value(data)
Beispiel #6
0
class ShiftBudgetDBSerializer(ShiftBudgetSharedDBSerializer):
    payment = PaymentDBSerializer()
    volunteer = serializers.BooleanField(default=False)
    pay_calculation = serializers.ChoiceField(
        (
            "Actual hours",
            "Shift hours",
        ),
        default="Actual hours",
    )
    overtime_rate = serializers.IntegerField(default=0)
    overtime_threshold = serializers.ChoiceField((0, 15, 30, 60), default=15)
    budget_ref = DocumentReferenceField(allow_null=True, default=None)
    budget_name = serializers.CharField(allow_null=True, default=None)
Beispiel #7
0
class OrganisationLocationDBSerializer(LocationDBSerializer):
    archived = serializers.BooleanField(default=False)
    created_at = serializers.DateTimeField(default=timezone.now)
    is_live = serializers.BooleanField(default=True)
    short_name = serializers.CharField(allow_null=True, allow_blank=True, default=None)
    icon_url = serializers.URLField(allow_null=True, default=None)
    organisation_ref = DocumentReferenceField()

    def to_internal_value(self, data):
        # call super to generate schema before accessing the fields
        data = super().to_internal_value(data)

        # generate short_name if empty
        if data["short_name"] is None:
            data["short_name"] = data["name"]

        return super().to_internal_value(data)
Beispiel #8
0
class MiniCardSerializer(serializers.Serializer):
    title = serializers.CharField()
    subTitle = serializers.CharField()
    worker_ref = DocumentReferenceField()
    read = serializers.BooleanField(default=False)
    read_at = serializers.DateTimeField(allow_null=True, default=None)
    created_at = serializers.DateTimeField(default=datetime.now())
    expires_at = serializers.DateTimeField(default=datetime.now() + timedelta(days=365))
    dismissed = serializers.BooleanField(default=False)
    non_dismissible = serializers.BooleanField(default=False)
    icon = serializers.CharField(allow_null=True, default=None)
    buttons = serializers.ListField(
        child=ButtonSerializer(), allow_empty=True, default=[]
    )
    message_id = serializers.CharField()
    type = serializers.ChoiceField(
        choices=["medium_card", "mini_card"], default="mini_card"
    )
Beispiel #9
0
class BaseExperienceSerializer(serializers.Serializer):
    start_date = serializers.DateTimeField(allow_null=True,
                                           default=None,
                                           input_formats=["%Y-%m-%d"])
    end_date = serializers.DateTimeField(allow_null=True,
                                         default=None,
                                         input_formats=["%Y-%m-%d"])
    summary = serializers.CharField(allow_null=True,
                                    default=None,
                                    allow_blank=True)
    worker_ref = DocumentReferenceField()
    type = serializers.ChoiceField((
        ("External"),
        ("Fielder"),
        ("Education"),
        ("Gap"),
    ), )
    status = serializers.ChoiceField(choices=STATUS._member_names_,
                                     default=STATUS.UNCHECKED.name,
                                     required=False)
Beispiel #10
0
 class SkillSerializer(ReferenceSerializer):
     skill_ref = DocumentReferenceField()
Beispiel #11
0
 class OccupationSerializer(ReferenceSerializer):
     occupation_ref = DocumentReferenceField()
Beispiel #12
0
 class SICCodeSerializer(ReferenceSerializer):
     sic_code_ref = DocumentReferenceField()
Beispiel #13
0
 class KnowledgeAreaSerializer(ValueSerializer):
     knowledge_area_ref = DocumentReferenceField()
Beispiel #14
0
 class GradeSerializer(ValueSerializer):
     grade_ref = DocumentReferenceField()
Beispiel #15
0
 class LevelSerializer(ReferenceSerializer):
     level_ref = DocumentReferenceField()
     level_number = serializers.IntegerField()
Beispiel #16
0
 class GradeSerializer(ReferenceSerializer):
     grade_ref = DocumentReferenceField()
     grade_number = serializers.IntegerField()
Beispiel #17
0
 class VerificationInfoSerializer(serializers.Serializer):
     source = serializers.CharField()
     is_valid = serializers.BooleanField(allow_null=True, default=None)
     dov = serializers.DateTimeField(allow_null=True, default=None)
     worker_document_ref = DocumentReferenceField(allow_null=True,
                                                  default=None)
Beispiel #18
0
class RegisteredAddressDBSerializer(LocationDBSerializer):
    dov = serializers.DateTimeField(allow_null=True, default=None)
    is_valid = serializers.BooleanField(default=False)
    worker_document_ref = DocumentReferenceField(allow_null=True, default=None)
    source = serializers.CharField(allow_null=True, default=None)
    value = LocationDBSerializer(allow_null=True, default=None)
Beispiel #19
0
class WorkerDocumentDBSerializer(serializers.Serializer):
    class SumsubAddressSerializer(serializers.Serializer):
        building_number = serializers.CharField(required=False,
                                                allow_null=True,
                                                allow_blank=True)
        building_name = serializers.CharField(required=False,
                                              allow_null=True,
                                              allow_blank=True)
        flat_number = serializers.CharField(required=False,
                                            allow_null=True,
                                            allow_blank=True)
        street = serializers.CharField(required=False,
                                       allow_null=True,
                                       allow_blank=True)
        sub_street = serializers.CharField(required=False,
                                           allow_null=True,
                                           allow_blank=True)
        town = serializers.CharField(required=False,
                                     allow_null=True,
                                     allow_blank=True)
        state = serializers.CharField(required=False,
                                      allow_null=True,
                                      allow_blank=True)
        post_code = serializers.CharField(required=False,
                                          allow_null=True,
                                          allow_blank=True)
        country = serializers.CharField(required=False,
                                        allow_null=True,
                                        allow_blank=True)

    id_doc_type = serializers.CharField(required=False,
                                        allow_null=True,
                                        allow_blank=True)
    country = serializers.CharField(required=False,
                                    allow_null=True,
                                    allow_blank=True)
    first_name = serializers.CharField(required=False,
                                       allow_null=True,
                                       allow_blank=True)
    first_name_en = serializers.CharField(required=False,
                                          allow_null=True,
                                          allow_blank=True)
    last_name = serializers.CharField(required=False,
                                      allow_null=True,
                                      allow_blank=True)
    last_name_en = serializers.CharField(required=False,
                                         allow_null=True,
                                         allow_blank=True)
    valid_until = serializers.CharField(required=False,
                                        allow_null=True,
                                        allow_blank=True)
    number = serializers.CharField(required=False,
                                   allow_null=True,
                                   allow_blank=True)
    address = SumsubAddressSerializer(required=False, allow_null=True)
    dob = serializers.CharField(required=False,
                                allow_null=True,
                                allow_blank=True)
    is_valid = serializers.BooleanField()
    source = serializers.ChoiceField(
        choices=WorkerDocumentSource._member_names_,
        allow_null=True,
        default=None)
    document_paths = serializers.ListField(child=serializers.CharField(),
                                           allow_empty=True,
                                           default=[])
    worker_ref = DocumentReferenceField()
Beispiel #20
0
class VerifiedBaseSerializer(serializers.Serializer):
    dov = serializers.DateTimeField(allow_null=True)
    is_valid = serializers.BooleanField(default=False)
    source = serializers.ChoiceField(
        choices=[_.name for _ in VerificationPath], allow_null=True)
    worker_document_ref = DocumentReferenceField(allow_null=True)
Beispiel #21
0
class SharedJobShiftDBSerializer(BaseJobSerializer, BaseDBSerializer):
    end_date = serializers.DateTimeField(default=None, allow_null=True)
    job_reference_id = serializers.CharField()
    manager_ref = DocumentReferenceField(default=None, allow_null=True)
    supervisor_ref = DocumentReferenceField(default=None, allow_null=True)
    total_shift_count = serializers.IntegerField()
Beispiel #22
0
 class EducationInstitutionSerializer(ValueSerializer):
     education_institution_ref = DocumentReferenceField()
Beispiel #23
0
 class CourseSerializer(ValueSerializer):
     course_ref = DocumentReferenceField()
Beispiel #24
0
 class LevelSerializer(ValueSerializer):
     level_ref = DocumentReferenceField()
Beispiel #25
0
class ShiftBudgetAPISerializer(ShiftBudgetBaseSerializer):
    budget_ref = DocumentReferenceField(allow_null=True, default=None)
Beispiel #26
0
 class InstitutionSerializer(ReferenceSerializer):
     institution_ref = DocumentReferenceField()