talentro-commons 0.19.19__py3-none-any.whl → 0.20.0__py3-none-any.whl

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.
@@ -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,8 +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
9
- from talentro.general.dataclasses import FileData
8
+ Candidate as CandidateModel, Source as SourceModel, ExternalLink as ExternalLinkModel
9
+ from talentro.integrations.dataclasses import LinkInfo
10
10
  from talentro.services.caching import CacheService
11
11
  from talentro.services.clients import MSClient
12
12
  from talentro.vacancies.dataclasses import VacancyInfo
@@ -142,6 +142,7 @@ class ApplicationInfo(BaseModel):
142
142
  candidate: Optional[CandidateInfo]
143
143
 
144
144
  documents: list[DocumentInfo]
145
+ external_links: list["ExternalLinkInfo"]
145
146
 
146
147
  @staticmethod
147
148
  async def resolve_object(object_id: UUID, organization_id: UUID) -> "ApplicationInfo | None":
@@ -190,4 +191,36 @@ class ApplicationInfo(BaseModel):
190
191
  candidate=candidate,
191
192
 
192
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,
193
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):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: talentro-commons
3
- Version: 0.19.19
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,13 +1,13 @@
1
1
  talentro/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  talentro/acquisition/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  talentro/acquisition/dataclasses.py,sha256=5NoDPCyRLDmj16Mz8O11osjAWVVp3BeUZnzwg51lZ6g,5010
4
- talentro/acquisition/models.py,sha256=gBkxPFfrlOkx4KNCoKXDQggNAVaYHo6pJ07RCfUeeJ0,4148
4
+ talentro/acquisition/models.py,sha256=LxD_UPKFoeylRzr4X4h6AhwIJREw4Ie8Gk9slrbFsw0,3545
5
5
  talentro/billing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  talentro/billing/dataclasses.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  talentro/billing/models.py,sha256=rbmcJh-FcU5I3oFRhnD413YqIade1nxvqvksvEtCvMs,825
8
8
  talentro/candidates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- talentro/candidates/dataclasses.py,sha256=I8fCbVLPvL5KXBFw2lSl9tzEQRjAos3BDkAMQ-8pHtA,5599
10
- talentro/candidates/models.py,sha256=8HDywWUf0X0ckgl8t6vtkglVEIMEe5RJoKOr0-yn0C0,2396
9
+ talentro/candidates/dataclasses.py,sha256=YHN7qRx1TXgH-zcwkQDB5Ai8saeNSQlNrLvLSKajHoU,6619
10
+ talentro/candidates/models.py,sha256=K4MH42ADd_L8i4jBAC35HZFZaHSvIFXS9N8k79CQ7h8,2885
11
11
  talentro/constants.py,sha256=08CuJ1qVbgi4IDZThw7CQt_D65jGwekGrkMEg8eDGZo,861
12
12
  talentro/event.py,sha256=Xie-nosLwEpg35Hir9yCKtJBXM-_R4O1fyknOtG_6IY,4595
13
13
  talentro/exceptions.py,sha256=-0i7G0-IF3PeWKBMMQ6eq2Hb-Q3OHt-cCqVgxPiWiiQ,1226
@@ -39,6 +39,6 @@ talentro/vacancies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
39
39
  talentro/vacancies/dataclasses.py,sha256=E6H5fsZH4IwtBFSLDolzF6u39tEIrANtWiNVoB65P0c,15074
40
40
  talentro/vacancies/models.py,sha256=GoXr71CNzU6csf8gdmv84etb3Rm-Cdfigp1yqPI_jjQ,4822
41
41
  talentro/vacancies/taxanomy.py,sha256=B6DMq9Wbs0aXFwD9aZveSlLwAC9eq1iCO_KM-FmrV7M,6384
42
- talentro_commons-0.19.19.dist-info/METADATA,sha256=8BqF3Zjtiom_hUyeejv7eexlPWGUJJehUry1sQxCANM,1508
43
- talentro_commons-0.19.19.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
44
- talentro_commons-0.19.19.dist-info/RECORD,,
42
+ talentro_commons-0.20.0.dist-info/METADATA,sha256=tlN4XghcKTKAgPvgrzxWOYg2rbj0hOOhvE2WZDfD1TM,1507
43
+ talentro_commons-0.20.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
44
+ talentro_commons-0.20.0.dist-info/RECORD,,