feat: add missing Tickets entity fields from Autotask API
Added 10 critical missing fields to Tickets entity: Database Migration (016): - billing_code_id: Billing code assignment - configuration_item_id: Primary asset/CI - creator_resource_id: Ticket creator - creator_type: Creator type (resource/contact) - problem_ticket_id: Link to problem ticket - rma_status: RMA status tracking - rma_type: RMA type classification - service_level_agreement_paused_next_event_hours: SLA pause tracking - is_assigned_to_comanaged: Co-managed assignment flag - is_visible_to_comanaged: Co-managed visibility flag Entity Mapper Updates: - Added all new fields with correct camelCase mapping - Ensures all Autotask Tickets API fields are captured This completes the Tickets entity to match the full Autotask API specification and should resolve issues with missing ticket data.
This commit is contained in:
parent
cc16d9b32d
commit
8405c813a3
2 changed files with 38 additions and 0 deletions
|
|
@ -153,6 +153,10 @@ function mapTicket(data: any): Record<string, any> {
|
||||||
completed_date: data.completedDate,
|
completed_date: data.completedDate,
|
||||||
create_date: data.createDate,
|
create_date: data.createDate,
|
||||||
created_by_contact_id: data.createdByContactID,
|
created_by_contact_id: data.createdByContactID,
|
||||||
|
creator_resource_id: data.creatorResourceID,
|
||||||
|
creator_type: data.creatorType,
|
||||||
|
billing_code_id: data.billingCodeID,
|
||||||
|
configuration_item_id: data.configurationItemID,
|
||||||
last_activity_date: data.lastActivityDate,
|
last_activity_date: data.lastActivityDate,
|
||||||
last_customer_notification_date_time: data.lastCustomerNotificationDateTime,
|
last_customer_notification_date_time: data.lastCustomerNotificationDateTime,
|
||||||
last_customer_visible_activity_date_time: data.lastCustomerVisibleActivityDateTime,
|
last_customer_visible_activity_date_time: data.lastCustomerVisibleActivityDateTime,
|
||||||
|
|
@ -186,6 +190,12 @@ function mapTicket(data: any): Record<string, any> {
|
||||||
previous_service_thermometer_rating: data.previousServiceThermometerRating,
|
previous_service_thermometer_rating: data.previousServiceThermometerRating,
|
||||||
service_thermometer_temperature: data.serviceThermometerTemperature,
|
service_thermometer_temperature: data.serviceThermometerTemperature,
|
||||||
api_vendor_id: data.apiVendorID,
|
api_vendor_id: data.apiVendorID,
|
||||||
|
problem_ticket_id: data.problemTicketId,
|
||||||
|
rma_status: data.rmaStatus,
|
||||||
|
rma_type: data.rmaType,
|
||||||
|
service_level_agreement_paused_next_event_hours: data.serviceLevelAgreementPausedNextEventHours,
|
||||||
|
is_assigned_to_comanaged: data.isAssignedToComanaged || false,
|
||||||
|
is_visible_to_comanaged: data.isVisibleToComanaged || false,
|
||||||
synced_at: data.synced_at,
|
synced_at: data.synced_at,
|
||||||
is_deleted: data.is_deleted || false,
|
is_deleted: data.is_deleted || false,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
28
migrations/016_add_missing_tickets_fields.sql
Normal file
28
migrations/016_add_missing_tickets_fields.sql
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
-- Add missing fields to tickets table based on Autotask Tickets API
|
||||||
|
-- Reference: https://autotask.net/help/developerhelp/Content/APIs/REST/Entities/TicketsEntity.htm
|
||||||
|
|
||||||
|
ALTER TABLE tickets
|
||||||
|
-- Billing and configuration
|
||||||
|
ADD COLUMN IF NOT EXISTS billing_code_id BIGINT,
|
||||||
|
ADD COLUMN IF NOT EXISTS configuration_item_id BIGINT,
|
||||||
|
|
||||||
|
-- Creator information
|
||||||
|
ADD COLUMN IF NOT EXISTS creator_resource_id BIGINT,
|
||||||
|
ADD COLUMN IF NOT EXISTS creator_type INTEGER,
|
||||||
|
|
||||||
|
-- Problem/incident tracking
|
||||||
|
ADD COLUMN IF NOT EXISTS problem_ticket_id BIGINT,
|
||||||
|
|
||||||
|
-- RMA fields
|
||||||
|
ADD COLUMN IF NOT EXISTS rma_status INTEGER,
|
||||||
|
ADD COLUMN IF NOT EXISTS rma_type INTEGER,
|
||||||
|
|
||||||
|
-- SLA tracking
|
||||||
|
ADD COLUMN IF NOT EXISTS service_level_agreement_paused_next_event_hours DECIMAL(10,2),
|
||||||
|
|
||||||
|
-- Co-managed fields
|
||||||
|
ADD COLUMN IF NOT EXISTS is_assigned_to_comanaged BOOLEAN DEFAULT false,
|
||||||
|
ADD COLUMN IF NOT EXISTS is_visible_to_comanaged BOOLEAN DEFAULT false;
|
||||||
|
|
||||||
|
-- Add comment to track migration
|
||||||
|
COMMENT ON TABLE tickets IS 'Added missing Autotask API fields - Migration 016';
|
||||||
Loading…
Add table
Add a link
Reference in a new issue