Skip to content

Commit

Permalink
Add created_at and updated_at to object schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
shri committed Aug 13, 2024
1 parent 0177194 commit 1948584
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/app/domain/companies/schemas.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from uuid import UUID # noqa: TCH003
from datetime import datetime

import msgspec

Expand All @@ -10,6 +11,7 @@

class Company(CamelizedBaseStruct):
"""A company."""

id: UUID
slug: str
name: str
Expand All @@ -23,10 +25,13 @@ class Company(CamelizedBaseStruct):
linkedin_profile_url: str | None = None
hq_location: Location | None = None
last_funding: Funding | None = None
creatd_at: datetime
updated_at: datetime


class CompanyCreate(CamelizedBaseStruct):
"""A company create schema."""

name: str
description: str | None = None
type: str | None = None
Expand All @@ -42,6 +47,7 @@ class CompanyCreate(CamelizedBaseStruct):

class CompanyUpdate(CamelizedBaseStruct, omit_defaults=True):
"""A company update schema."""

id: UUID
name: str | None | msgspec.UnsetType = msgspec.UNSET
description: str | None | msgspec.UnsetType = msgspec.UNSET
Expand Down
3 changes: 3 additions & 0 deletions src/app/domain/jobs/schemas.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from uuid import UUID # noqa: TCH003
from datetime import datetime

import msgspec

Expand All @@ -24,6 +25,8 @@ class JobPost(CamelizedBaseStruct):
total_applicants: int | None = None
external_id: str | None = None
company: Company | None = None
creatd_at: datetime
updated_at: datetime


class JobPostCreate(CamelizedBaseStruct):
Expand Down
9 changes: 9 additions & 0 deletions src/app/domain/opportunities/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from uuid import UUID # noqa: TCH003
from typing import Any
from datetime import datetime

import msgspec

Expand All @@ -14,14 +15,18 @@

class OpportunityAuditLog(CamelizedBaseStruct):
"""An opportunity audit log."""

id: UUID
operation: str
user: User
diff: dict[str, Any] | None = None
creatd_at: datetime
updated_at: datetime


class Opportunity(CamelizedBaseStruct):
"""An opportunity."""

id: UUID
slug: str
name: str
Expand All @@ -32,10 +37,13 @@ class Opportunity(CamelizedBaseStruct):
contacts: list[Person] | None = None
job_posts: list[JobPost] | None = None
logs: list[OpportunityAuditLog] | None = None
creatd_at: datetime
updated_at: datetime


class OpportunityCreate(CamelizedBaseStruct):
"""An opportunity create schema."""

name: str
stage: OpportunityStage | None = None
notes: str | None = None
Expand All @@ -47,6 +55,7 @@ class OpportunityCreate(CamelizedBaseStruct):

class OpportunityUpdate(CamelizedBaseStruct):
"""An opportunity update schema."""

id: UUID
name: str | None | msgspec.UnsetType = msgspec.UNSET
stage: OpportunityStage | None | msgspec.UnsetType = msgspec.UNSET
Expand Down
7 changes: 6 additions & 1 deletion src/app/domain/people/schemas.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from uuid import UUID # noqa: TCH003
from datetime import date
from datetime import date, datetime

import msgspec

Expand All @@ -11,6 +11,7 @@

class Person(CamelizedBaseStruct):
"""A person."""

id: UUID
slug: str
first_name: str | None = None
Expand All @@ -34,10 +35,13 @@ class Person(CamelizedBaseStruct):
languages: list[str] | None = None
work_experiences: list[WorkExperience] | None = None
social_activities: list[SocialActivity] | None = None
creatd_at: datetime
updated_at: datetime


class PersonCreate(CamelizedBaseStruct):
"""A person create schema."""

first_name: str | None = None
last_name: str | None = None
full_name: str | None = None
Expand All @@ -63,6 +67,7 @@ class PersonCreate(CamelizedBaseStruct):

class PersonUpdate(CamelizedBaseStruct, omit_defaults=True):
"""A person update schema."""

id: UUID
first_name: str | None | msgspec.UnsetType = msgspec.UNSET
last_name: str | None | msgspec.UnsetType = msgspec.UNSET
Expand Down

0 comments on commit 1948584

Please sign in to comment.