talentro-commons 0.19.18__tar.gz → 0.20.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/PKG-INFO +1 -1
  2. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/pyproject.toml +1 -1
  3. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/acquisition/models.py +3 -24
  4. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/candidates/dataclasses.py +51 -1
  5. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/candidates/models.py +10 -0
  6. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/README.md +0 -0
  7. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/__init__.py +0 -0
  8. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/acquisition/__init__.py +0 -0
  9. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/acquisition/dataclasses.py +0 -0
  10. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/billing/__init__.py +0 -0
  11. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/billing/dataclasses.py +0 -0
  12. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/billing/models.py +0 -0
  13. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/candidates/__init__.py +0 -0
  14. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/constants.py +0 -0
  15. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/event.py +0 -0
  16. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/exceptions.py +0 -0
  17. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/general/__init__.py +0 -0
  18. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/general/dataclasses.py +0 -0
  19. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/general/models.py +0 -0
  20. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/iam/__init__.py +0 -0
  21. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/iam/dataclasses.py +0 -0
  22. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/iam/models.py +0 -0
  23. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/iam/types.py +0 -0
  24. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/integrations/__init__.py +0 -0
  25. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/integrations/dataclasses.py +0 -0
  26. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/integrations/models.py +0 -0
  27. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/services/__init__.py +0 -0
  28. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/services/billing.py +0 -0
  29. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/services/caching.py +0 -0
  30. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/services/clients.py +0 -0
  31. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/services/db.py +0 -0
  32. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/services/google_storage.py +0 -0
  33. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/services/rabbitmq.py +0 -0
  34. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/util/__init__.py +0 -0
  35. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/util/attributes.py +0 -0
  36. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/util/enum.py +0 -0
  37. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/util/files.py +0 -0
  38. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/util/singleton.py +0 -0
  39. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/util/string.py +0 -0
  40. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/util/vacancy.py +0 -0
  41. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/vacancies/__init__.py +0 -0
  42. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/vacancies/dataclasses.py +0 -0
  43. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/vacancies/models.py +0 -0
  44. {talentro_commons-0.19.18 → talentro_commons-0.20.0}/src/talentro/vacancies/taxanomy.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: talentro-commons
3
- Version: 0.19.18
3
+ Version: 0.20.0
4
4
  Summary: This package contains all globally used code, services, models and data structures for Talentro
5
5
  License: Proprietary
6
6
  Author: Emiel van Essen
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "talentro-commons"
3
- version = "0.19.18"
3
+ version = "0.20.0"
4
4
  description = "This package contains all globally used code, services, models and data structures for Talentro"
5
5
  authors = ["Emiel van Essen <emiel@marksmen.nl>"]
6
6
  license = "Proprietary"
@@ -22,27 +22,6 @@ class CampaignGoal(enum.Enum):
22
22
  LEADS = 'leads'
23
23
 
24
24
 
25
- class AdStatus(enum.Enum):
26
- DRAFT = 'draft'
27
- LIVE = 'live'
28
- ERROR = 'error'
29
- PAUSED = 'paused'
30
- ARCHIVED = 'archived'
31
-
32
-
33
- class CampaignStatus(enum.Enum):
34
- DRAFT = 'draft'
35
- LIVE = 'live'
36
- PUBLISHING = 'publishing'
37
- PUBLISHING_ERROR = 'publishing-error'
38
- PAUSING = 'pausing'
39
- PAUSED = 'paused'
40
- PAUSING_ERROR = 'pausing-error'
41
- ARCHIVED = 'archived'
42
- LIMITED = 'limited'
43
- ERROR = 'error'
44
-
45
-
46
25
  class CampaignsModel(BaseModel):
47
26
  pass
48
27
 
@@ -54,7 +33,7 @@ class CampaignsOrganizationModel(CampaignsModel):
54
33
  class Campaign(CampaignsOrganizationModel, table=True):
55
34
  name: str = Field(index=True)
56
35
  external_id: Optional[str] = Field(index=True)
57
- status: CampaignStatus = Field(sa_column=Column(Enum(CampaignStatus)), default=CampaignStatus.DRAFT)
36
+ status: str = Field(index=True)
58
37
  last_sync_date: Optional[datetime] = Field()
59
38
  ad_count: int = Field(default=0)
60
39
  channel_id: UUID = Field(index=True)
@@ -74,7 +53,7 @@ class Campaign(CampaignsOrganizationModel, table=True):
74
53
  class AdSet(CampaignsOrganizationModel, table=True):
75
54
  name: str = Field(index=True)
76
55
  external_id: Optional[str] = Field(index=True)
77
- status: AdStatus = Field(sa_column=Column(Enum(AdStatus)), default=AdStatus.DRAFT)
56
+ status: str = Field(index=True)
78
57
  platforms: list = Field(sa_column=Column(JSON))
79
58
  ad_types: list = Field(sa_column=Column(JSON))
80
59
  settings: dict = Field(sa_column=Column(JSON))
@@ -103,7 +82,7 @@ class TargetAudience(CampaignsOrganizationModel, table=True):
103
82
  class Ad(CampaignsOrganizationModel, table=True):
104
83
  name: str = Field(index=True)
105
84
  external_id: Optional[str] = Field(index=True)
106
- status: AdStatus = Field(sa_column=Column(Enum(AdStatus)), default=AdStatus.DRAFT)
85
+ status: str = Field(index=True)
107
86
  vacancy_id: Optional[UUID] = Field()
108
87
  lead_form: Optional[UUID] = Field(foreign_key="leadform.id")
109
88
  primary_text: str = Field()
@@ -5,7 +5,8 @@ from uuid import UUID
5
5
  from pydantic import BaseModel
6
6
  from talentro.acquisition.dataclasses import CampaignInfo, AdInfo
7
7
  from talentro.candidates.models import Application as ApplicationModel, Document as DocumentModel, \
8
- Candidate as CandidateModel, Source as SourceModel
8
+ Candidate as CandidateModel, Source as SourceModel, ExternalLink as ExternalLinkModel
9
+ from talentro.integrations.dataclasses import LinkInfo
9
10
  from talentro.services.caching import CacheService
10
11
  from talentro.services.clients import MSClient
11
12
  from talentro.vacancies.dataclasses import VacancyInfo
@@ -141,6 +142,23 @@ class ApplicationInfo(BaseModel):
141
142
  candidate: Optional[CandidateInfo]
142
143
 
143
144
  documents: list[DocumentInfo]
145
+ external_links: list["ExternalLinkInfo"]
146
+
147
+ @staticmethod
148
+ async def resolve_object(object_id: UUID, organization_id: UUID) -> "ApplicationInfo | None":
149
+ cache = CacheService()
150
+
151
+ cache_key = f"resolver:org:{organization_id}:application_id:{object_id}"
152
+
153
+ if value := await cache.get(cache_key):
154
+ return value
155
+
156
+ result = await MSClient.candidates().get(f"applications/{object_id}", headers={"X-Organization-ID": str(organization_id)})
157
+
158
+ if result.status_code != 200:
159
+ return None
160
+
161
+ return ApplicationInfo(**result.json())
144
162
 
145
163
  @classmethod
146
164
  async def from_model(cls: "ApplicationInfo", model: ApplicationModel) -> 'ApplicationInfo':
@@ -173,4 +191,36 @@ class ApplicationInfo(BaseModel):
173
191
  candidate=candidate,
174
192
 
175
193
  documents=[await DocumentInfo.from_model(document) for document in model.documents],
194
+ external_links=[await ExternalLinkInfo.from_model(link) for link in model.external_links],
195
+ )
196
+
197
+
198
+ class ExternalLinkInfo(BaseModel):
199
+ id: UUID
200
+ created_at: datetime
201
+ updated_at: Optional[datetime]
202
+ organization: UUID
203
+
204
+ link: Optional[LinkInfo]
205
+ external_id: Optional[str]
206
+ status: str
207
+ application_id: UUID
208
+
209
+ @classmethod
210
+ async def from_model(cls: "ExternalLinkInfo", model: ExternalLinkModel) -> 'ExternalLinkInfo':
211
+ if model.link_id:
212
+ link = await LinkInfo.resolve_object(model.link_id, model.organization)
213
+ else:
214
+ link = None
215
+
216
+ return cls(
217
+ id=model.id,
218
+ created_at=model.created_at,
219
+ updated_at=model.updated_at,
220
+ organization=model.organization,
221
+
222
+ link=link,
223
+ status=model.status,
224
+ external_id=model.external_id,
225
+ application_id=model.application_id,
176
226
  )
@@ -39,6 +39,15 @@ class Candidate(CandidatesOrganizationModel, table=True):
39
39
  applications: list["Application"] = Relationship(back_populates="candidate")
40
40
 
41
41
 
42
+ class ExternalLink(CandidatesOrganizationModel, table=True):
43
+ link_id: Optional[UUID] = Field(index=True, nullable=True)
44
+ external_id: Optional[str] = Field(index=True, nullable=True)
45
+ status: str = Field(index=True)
46
+
47
+ application_id: UUID = Field(foreign_key="application.id", ondelete="CASCADE", index=True)
48
+ application: "Application" = Relationship(back_populates="external_links")
49
+
50
+
42
51
  class Application(CandidatesOrganizationModel, table=True):
43
52
  vacancy_id: UUID = Field(index=True, nullable=True)
44
53
  vacancy_title: str = Field(index=True)
@@ -53,6 +62,7 @@ class Application(CandidatesOrganizationModel, table=True):
53
62
  candidate: Candidate = Relationship(back_populates="applications")
54
63
 
55
64
  documents: list["Document"] = Relationship(back_populates="application")
65
+ external_links: list["ExternalLink"] = Relationship(back_populates="application")
56
66
 
57
67
 
58
68
  class Source(CandidatesOrganizationModel, table=True):