You've already forked RekomenciBackend
add resume
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
from datetime import UTC, datetime
|
||||
from decimal import Decimal
|
||||
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
|
||||
from template_project.application.user.entity import UserId
|
||||
|
||||
ResumeId = NewType("ResumeId", UUID)
|
||||
ResumeEmbeddingId = NewType("ResumeEmbeddingId", UUID)
|
||||
ResumePredictionId = NewType("ResumePredictionId", UUID)
|
||||
|
||||
|
||||
@to_entity
|
||||
class Resume(Entity[ResumeId]):
|
||||
user_id: UserId
|
||||
position: str
|
||||
# location: str
|
||||
about_me: str
|
||||
key_skills: list[str]
|
||||
experience_type: ExperienceType
|
||||
down_resume_id: ResumeId | None = None
|
||||
|
||||
@classmethod
|
||||
def factory(
|
||||
cls,
|
||||
user_id: UserId,
|
||||
position: str,
|
||||
about_me: str,
|
||||
key_skills: list[str],
|
||||
experience_type: ExperienceType,
|
||||
down_resume_id: ResumeId | None = None,
|
||||
) -> Self:
|
||||
return cls(
|
||||
id=ResumeId(uuid7()),
|
||||
created_at=datetime.now(tz=UTC),
|
||||
user_id=user_id,
|
||||
position=position,
|
||||
about_me=about_me,
|
||||
key_skills=key_skills,
|
||||
experience_type=experience_type,
|
||||
down_resume_id=down_resume_id,
|
||||
)
|
||||
|
||||
|
||||
@to_entity
|
||||
class ResumeEmbedding(Entity[ResumeEmbeddingId]):
|
||||
resume_id: ResumeId
|
||||
vector: list[float]
|
||||
|
||||
@classmethod
|
||||
def factory(
|
||||
cls,
|
||||
resume_id: ResumeId,
|
||||
vector: list[float],
|
||||
) -> Self:
|
||||
return cls(
|
||||
id=ResumeEmbeddingId(uuid7()),
|
||||
created_at=datetime.now(tz=UTC),
|
||||
resume_id=resume_id,
|
||||
vector=vector,
|
||||
)
|
||||
|
||||
|
||||
@to_entity
|
||||
class ResumePrediction(Entity[ResumePredictionId]):
|
||||
resume_id: ResumeId
|
||||
from_salary: Decimal
|
||||
to_salary: Decimal
|
||||
recommended_skills: list[str]
|
||||
# common_recommended: str # TODO
|
||||
Reference in New Issue
Block a user