JobSpy/api/core/jobs/__init__.py

61 lines
1.1 KiB
Python
Raw Normal View History

2023-07-11 06:24:59 -07:00
from typing import Union
2023-07-06 16:44:38 -07:00
from datetime import datetime
from enum import Enum
2023-07-11 06:24:59 -07:00
from pydantic import BaseModel
2023-07-06 16:44:38 -07:00
class JobType(Enum):
2023-07-11 06:24:59 -07:00
FULL_TIME = "fulltime"
PART_TIME = "parttime"
CONTRACT = "contract"
2023-07-07 19:00:59 -07:00
TEMPORARY = "temporary"
2023-07-11 06:24:59 -07:00
INTERNSHIP = "internship"
PER_DIEM = "perdiem"
2023-07-08 04:57:36 -07:00
NIGHTS = "nights"
OTHER = "other"
2023-07-06 16:44:38 -07:00
class Location(BaseModel):
country: str
city: str = None
state: str = None
2023-07-06 16:44:38 -07:00
postal_code: str = None
address: str = None
2023-07-08 04:57:36 -07:00
class CompensationInterval(Enum):
YEARLY = "yearly"
MONTHLY = "monthly"
WEEKLY = "weekly"
DAILY = "daily"
HOURLY = "hourly"
2023-07-06 16:44:38 -07:00
class Compensation(BaseModel):
interval: CompensationInterval
2023-07-08 04:57:36 -07:00
min_amount: float
max_amount: float
currency: str = "US"
2023-07-06 16:44:38 -07:00
class JobPost(BaseModel):
title: str
company_name: str
2023-07-11 03:42:20 -07:00
job_url: str
2023-07-06 16:44:38 -07:00
location: Location
2023-07-11 03:42:20 -07:00
description: str = None
2023-07-08 04:57:36 -07:00
job_type: JobType = None
2023-07-07 19:00:59 -07:00
compensation: Compensation = None
date_posted: datetime = None
2023-07-06 17:12:01 -07:00
class JobResponse(BaseModel):
success: bool
error: str = None
job_count: int = None
jobs: list[JobPost] = []