You've already forked RekomenciBackend
Merge branch 'main' of gitlab.prodcontest.com:team-39/backend
This commit is contained in:
@@ -1,12 +1,19 @@
|
||||
from datetime import UTC, datetime
|
||||
from decimal import Decimal
|
||||
from typing import Any
|
||||
from typing import NewType, Self
|
||||
from uuid import UUID
|
||||
|
||||
from uuid_utils.compat import uuid7
|
||||
|
||||
from template_project.application.common.entity import Entity, to_entity
|
||||
from template_project.application.common.enums import ExperienceType
|
||||
|
||||
VacancyId = NewType("VacancyId", UUID)
|
||||
VacancyEmbeddingId = NewType("VacancyEmbeddingId", UUID)
|
||||
|
||||
|
||||
@to_entity
|
||||
class Vacancy(Entity[Any]):
|
||||
class Vacancy(Entity[VacancyId]):
|
||||
position: str
|
||||
from_salary: Decimal
|
||||
to_salary: Decimal
|
||||
@@ -14,8 +21,42 @@ class Vacancy(Entity[Any]):
|
||||
description: str
|
||||
key_skills: list[str]
|
||||
|
||||
@classmethod
|
||||
def factory(
|
||||
cls,
|
||||
position: str,
|
||||
from_salary: Decimal,
|
||||
to_salary: Decimal,
|
||||
experience_type: ExperienceType,
|
||||
description: str,
|
||||
key_skills: list[str],
|
||||
) -> Self:
|
||||
return cls(
|
||||
id=VacancyId(uuid7()),
|
||||
created_at=datetime.now(tz=UTC),
|
||||
position=position,
|
||||
from_salary=from_salary,
|
||||
to_salary=to_salary,
|
||||
experience_type=experience_type,
|
||||
description=description,
|
||||
key_skills=key_skills,
|
||||
)
|
||||
|
||||
|
||||
@to_entity
|
||||
class VacancyEmbedding(Entity[Any]):
|
||||
vacancy_id: Any
|
||||
class VacancyEmbedding(Entity[VacancyEmbeddingId]):
|
||||
vacancy_id: VacancyId
|
||||
vector: list[float]
|
||||
|
||||
@classmethod
|
||||
def factory(
|
||||
cls,
|
||||
vacancy_id: VacancyId,
|
||||
vector: list[float],
|
||||
) -> Self:
|
||||
return cls(
|
||||
id=VacancyEmbeddingId(uuid7()),
|
||||
created_at=datetime.now(tz=UTC),
|
||||
vacancy_id=vacancy_id,
|
||||
vector=vector,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user