feat: expand Resources entity to include all Autotask API fields
Add comprehensive field support for Resources entity including: - Name fields: middleInitial, namePrefix, nameSuffix - Contact: emailAddress2, emailAddress3, homePhone - Employment: accountingReferenceID, payrollType, internalCost - System: emailTypeCode, numberFormat, timeFormat, dateFormat - Demographics: gender - Security: licenseType, securityLevel - Location: defaultServiceDeskRoleID Changes: - Migration 015: Add new columns to resources table - Updated entity mapper to map all Autotask Resource fields - Expanded TypeScript Resource interface with all fields - Maintains backward compatibility with existing field names This ensures all data exposed by the Autotask Resources API is now captured and stored in the database.
This commit is contained in:
parent
a1e50a7161
commit
8e0ca0a63b
3 changed files with 131 additions and 19 deletions
|
|
@ -277,21 +277,57 @@ function mapProject(data: any): Record<string, any> {
|
|||
function mapResource(data: any): Record<string, any> {
|
||||
return {
|
||||
id: data.id,
|
||||
first_name: data.first_name,
|
||||
last_name: data.last_name,
|
||||
email: data.email || data.email_address,
|
||||
user_name: data.user_name || data.username,
|
||||
// Name fields
|
||||
first_name: data.firstName,
|
||||
last_name: data.lastName,
|
||||
middle_initial: data.middleInitial,
|
||||
name_prefix: data.namePrefix,
|
||||
name_suffix: data.nameSuffix,
|
||||
|
||||
// Contact information
|
||||
email: data.email || data.emailAddress,
|
||||
email_address: data.emailAddress,
|
||||
email_address2: data.emailAddress2,
|
||||
email_address3: data.emailAddress3,
|
||||
office_phone: data.officePhone,
|
||||
mobile_phone: data.mobilePhone,
|
||||
home_phone: data.homePhone,
|
||||
office_extension: data.officeExtension,
|
||||
|
||||
// System fields
|
||||
user_name: data.userName,
|
||||
title: data.title,
|
||||
office_phone: data.office_phone,
|
||||
mobile_phone: data.mobile_phone,
|
||||
office_extension: data.office_extension,
|
||||
is_active: data.is_active !== undefined ? data.is_active : true,
|
||||
location_id: data.location_id,
|
||||
resource_type: data.resource_type,
|
||||
pay_roll_identifier: data.pay_roll_identifier,
|
||||
hire_date: data.hire_date,
|
||||
travel_availability_pct: data.travel_availability_pct,
|
||||
survey_resource_rating: data.survey_resource_rating,
|
||||
is_active: data.isActive !== undefined ? data.isActive : true,
|
||||
|
||||
// Employment details
|
||||
resource_type: data.resourceType,
|
||||
payroll_identifier: data.payrollIdentifier,
|
||||
pay_roll_identifier: data.payrollIdentifier, // Keep for backward compatibility
|
||||
payroll_type: data.payrollType,
|
||||
accounting_reference_id: data.accountingReferenceID,
|
||||
internal_cost: data.internalCost,
|
||||
hire_date: data.hireDate,
|
||||
|
||||
// Location and availability
|
||||
location_id: data.locationID,
|
||||
travel_availability_pct: data.travelAvailabilityPct,
|
||||
default_service_desk_role_id: data.defaultServiceDeskRoleID,
|
||||
|
||||
// System preferences
|
||||
email_type_code: data.emailTypeCode,
|
||||
number_format: data.numberFormat,
|
||||
time_format: data.timeFormat,
|
||||
date_format: data.dateFormat,
|
||||
|
||||
// Demographics and security
|
||||
gender: data.gender,
|
||||
license_type: data.licenseType,
|
||||
security_level: data.securityLevel,
|
||||
|
||||
// Ratings
|
||||
survey_resource_rating: data.surveyResourceRating,
|
||||
|
||||
// Audit fields
|
||||
synced_at: data.synced_at,
|
||||
is_deleted: data.is_deleted || false,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue