diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..0727432 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,45 @@ +name: Pull Request Checks + +on: + pull_request: + branches: [ main ] + +jobs: + build-app: + name: Build Application + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.23' + + - name: Build application + run: make build + + - name: Run tests + run: go test -v ./... + + build-docs: + name: Build Documentation + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./docs + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Install dependencies + run: bun install + + - name: Build documentation + run: bun run build diff --git a/docs/docs/tools/analysis.md b/docs/docs/tools/analysis.md index b5974b3..6a44d81 100644 --- a/docs/docs/tools/analysis.md +++ b/docs/docs/tools/analysis.md @@ -159,4 +159,4 @@ TEKMETRIC_ANALYSIS_TIMEOUT_SECONDS=120 - [Repair Orders Tool](repair-orders.md) - For quick repair order lookups - [Vehicles Tool](vehicles.md) - For finding vehicle IDs -- [Configuration](../configuration/environment-variables.md) - Analysis tool settings +- [Configuration](../configuration/index.md) - Analysis tool settings diff --git a/internal/mcp/tools/repair_orders.go b/internal/mcp/tools/repair_orders.go index caa46bf..b060b17 100644 --- a/internal/mcp/tools/repair_orders.go +++ b/internal/mcp/tools/repair_orders.go @@ -122,6 +122,9 @@ func (r *Registry) handleRepairOrders(arguments map[string]interface{}) (*mcp.Ca params.RepairOrderStatusIds = append(params.RepairOrderStatusIds, statusID) } } + } else { + // Default: exclude status 7 (Deleted) + params.RepairOrderStatusIds = []int{1, 2, 3, 4, 5, 6} } if customerID, ok := parseFloatArg(arguments, "customer_id"); ok { params.CustomerID = customerID diff --git a/pkg/tekmetric/appointments.go b/pkg/tekmetric/appointments.go index 4928ae8..2c66ab1 100644 --- a/pkg/tekmetric/appointments.go +++ b/pkg/tekmetric/appointments.go @@ -17,17 +17,18 @@ type AppointmentQueryParams struct { End string `url:"end,omitempty"` // End date filter UpdatedDateStart string `url:"updatedDateStart,omitempty"` // Filter by updated date UpdatedDateEnd string `url:"updatedDateEnd,omitempty"` // Filter by updated date - IncludeDeleted *bool `url:"includeDeleted,omitempty"` // Include deleted appointments (default: true) + IncludeDeleted *bool `url:"includeDeleted,omitempty"` // Include deleted appointments (default: false) Sort string `url:"sort,omitempty"` // Sort field (API docs don't specify allowed values) SortDirection string `url:"sortDirection,omitempty"` // ASC, DESC } -// GetAppointments returns a paginated list of appointments +// GetAppointments returns a paginated list of appointments (excludes deleted by default) func (c *Client) GetAppointments(ctx context.Context, shopID int, page int, size int) (*PaginatedResponse[Appointment], error) { if err := c.isAuthorizedShop(shopID); err != nil { return nil, err } - path := fmt.Sprintf("/api/v1/appointments?shop=%d&page=%d&size=%d", shopID, page, size) + includeDeleted := false + path := fmt.Sprintf("/api/v1/appointments?shop=%d&page=%d&size=%d&includeDeleted=%t", shopID, page, size, includeDeleted) var resp PaginatedResponse[Appointment] if err := c.doRequest(ctx, "GET", path, nil, &resp); err != nil { return nil, err @@ -81,8 +82,11 @@ func (c *Client) GetAppointmentsWithParams(ctx context.Context, params Appointme if params.UpdatedDateEnd != "" { query.Add("updatedDateEnd", params.UpdatedDateEnd) } + // Default to excluding deleted appointments if params.IncludeDeleted != nil { query.Add("includeDeleted", fmt.Sprintf("%t", *params.IncludeDeleted)) + } else { + query.Add("includeDeleted", "false") } if params.Sort != "" { query.Add("sort", params.Sort) diff --git a/pkg/tekmetric/customers.go b/pkg/tekmetric/customers.go index 4a66cfa..c6561f5 100644 --- a/pkg/tekmetric/customers.go +++ b/pkg/tekmetric/customers.go @@ -7,6 +7,7 @@ import ( ) // CustomerQueryParams holds query parameters for customer searches +// Note: By default, deleted records are excluded unless DeletedDateStart/DeletedDateEnd are explicitly set type CustomerQueryParams struct { Shop int `url:"shop,omitempty"` Page int `url:"page,omitempty"` @@ -16,8 +17,6 @@ type CustomerQueryParams struct { OkForMarketing *bool `url:"okForMarketing,omitempty"` // Filter by marketing permission UpdatedDateStart string `url:"updatedDateStart,omitempty"` // Filter by updated date UpdatedDateEnd string `url:"updatedDateEnd,omitempty"` // Filter by updated date - DeletedDateStart string `url:"deletedDateStart,omitempty"` // Filter by deleted date - DeletedDateEnd string `url:"deletedDateEnd,omitempty"` // Filter by deleted date CustomerTypeID int `url:"customerTypeId,omitempty"` // 1=Customer, 2=Business Sort string `url:"sort,omitempty"` // lastName, firstName, email (can be comma-separated) SortDirection string `url:"sortDirection,omitempty"` // ASC, DESC @@ -94,12 +93,7 @@ func (c *Client) GetCustomersWithParams(ctx context.Context, params CustomerQuer if params.UpdatedDateEnd != "" { query.Add("updatedDateEnd", params.UpdatedDateEnd) } - if params.DeletedDateStart != "" { - query.Add("deletedDateStart", params.DeletedDateStart) - } - if params.DeletedDateEnd != "" { - query.Add("deletedDateEnd", params.DeletedDateEnd) - } + // Deleted date filters removed - we never query for deleted records if params.CustomerTypeID > 0 { query.Add("customerTypeId", fmt.Sprintf("%d", params.CustomerTypeID)) } diff --git a/pkg/tekmetric/repair_orders.go b/pkg/tekmetric/repair_orders.go index bbaf9d7..bbc1c0a 100644 --- a/pkg/tekmetric/repair_orders.go +++ b/pkg/tekmetric/repair_orders.go @@ -17,8 +17,6 @@ type RepairOrderQueryParams struct { PostedDateEnd string `url:"postedDateEnd,omitempty"` // Date format: YYYY-MM-DD UpdatedDateStart string `url:"updatedDateStart,omitempty"` // Date format: YYYY-MM-DD UpdatedDateEnd string `url:"updatedDateEnd,omitempty"` // Date format: YYYY-MM-DD - DeletedDateStart string `url:"deletedDateStart,omitempty"` // Date format: YYYY-MM-DD - DeletedDateEnd string `url:"deletedDateEnd,omitempty"` // Date format: YYYY-MM-DD RepairOrderNumber int `url:"repairOrderNumber,omitempty"` RepairOrderStatusIds []int `url:"repairOrderStatusId,omitempty"` // 1-Estimate, 2-WIP, 3-Complete, 4-Saved, 5-Posted, 6-AR, 7-Deleted CustomerID int `url:"customerId,omitempty"` @@ -28,12 +26,13 @@ type RepairOrderQueryParams struct { SortDirection string `url:"sortDirection,omitempty"` // ASC, DESC } -// GetRepairOrders returns a paginated list of repair orders +// GetRepairOrders returns a paginated list of repair orders (excludes deleted status 7 by default) func (c *Client) GetRepairOrders(ctx context.Context, shopID int, page int, size int) (*PaginatedResponse[RepairOrder], error) { params := RepairOrderQueryParams{ - Shop: shopID, - Page: page, - Size: size, + Shop: shopID, + Page: page, + Size: size, + RepairOrderStatusIds: []int{1, 2, 3, 4, 5, 6}, // Exclude status 7 (Deleted) } return c.GetRepairOrdersWithParams(ctx, params) } @@ -75,12 +74,6 @@ func (c *Client) GetRepairOrdersWithParams(ctx context.Context, params RepairOrd if params.UpdatedDateEnd != "" { query.Add("updatedDateEnd", params.UpdatedDateEnd) } - if params.DeletedDateStart != "" { - query.Add("deletedDateStart", params.DeletedDateStart) - } - if params.DeletedDateEnd != "" { - query.Add("deletedDateEnd", params.DeletedDateEnd) - } if params.RepairOrderNumber > 0 { query.Add("repairOrderNumber", fmt.Sprintf("%d", params.RepairOrderNumber)) } diff --git a/pkg/tekmetric/vehicles.go b/pkg/tekmetric/vehicles.go index 560c1a2..17f49d0 100644 --- a/pkg/tekmetric/vehicles.go +++ b/pkg/tekmetric/vehicles.go @@ -15,8 +15,6 @@ type VehicleQueryParams struct { Search string `url:"search,omitempty"` // Search by year, make, model UpdatedDateStart string `url:"updatedDateStart,omitempty"` // Filter by updated date UpdatedDateEnd string `url:"updatedDateEnd,omitempty"` // Filter by updated date - DeletedDateStart string `url:"deletedDateStart,omitempty"` // Filter by deleted date - DeletedDateEnd string `url:"deletedDateEnd,omitempty"` // Filter by deleted date Sort string `url:"sort,omitempty"` // Sort field (API docs don't specify allowed values) SortDirection string `url:"sortDirection,omitempty"` // ASC, DESC } @@ -89,12 +87,6 @@ func (c *Client) GetVehiclesWithParams(ctx context.Context, params VehicleQueryP if params.UpdatedDateEnd != "" { query.Add("updatedDateEnd", params.UpdatedDateEnd) } - if params.DeletedDateStart != "" { - query.Add("deletedDateStart", params.DeletedDateStart) - } - if params.DeletedDateEnd != "" { - query.Add("deletedDateEnd", params.DeletedDateEnd) - } if params.Sort != "" { query.Add("sort", params.Sort) }