HR-ATS-Portal/backend/job/cost/serializers.py

15 lines
660 B
Python

def serialize_hiring_cost(row) -> dict:
return {
"id": str(row.id),
"job_post_id": str(row.job_post_id) if row.job_post_id else None,
"source_channel_id": row.source_channel_id,
"cost_type": row.cost_type,
"amount": row.amount,
"currency": row.currency,
"incurred_at": row.incurred_at.isoformat() if row.incurred_at else None,
"description": row.description,
"created_by": str(row.created_by) if row.created_by else None,
"created_at": row.created_at.isoformat() if row.created_at else None,
"updated_at": row.updated_at.isoformat() if row.updated_at else None,
}