• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

popstas / planfix-mcp-server / 16450048571

22 Jul 2025 04:26PM UTC coverage: 81.891%. First build
16450048571

Pull #45

github

web-flow
Merge f4f9e9d67 into 54c0a1e62
Pull Request #45: Add directory entry helpers

432 of 594 branches covered (72.73%)

Branch coverage included in aggregate %.

111 of 126 new or added lines in 5 files covered. (88.1%)

3032 of 3636 relevant lines covered (83.39%)

2.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

89.58
/src/lib/extendPostBodyWithCustomFields.ts
1
import type {
2
  ContactResponse,
3
  CustomFieldDataType,
4
  TaskResponse,
5
} from "../types.js";
6
import type { CustomField } from "./extendSchemaWithCustomFields.js";
7

8
export interface HasCustomFieldData {
9
  customFieldData?: CustomFieldDataType[];
10
}
11

12
export function extendPostBodyWithCustomFields(
1✔
13
  postBody: HasCustomFieldData,
9✔
14
  args: Record<string, unknown>,
9✔
15
  fields: CustomField[],
9✔
16
  task?: TaskResponse,
9✔
17
  contact?: ContactResponse,
9✔
18
  forceUpdate?: boolean,
9✔
19
): void {
9✔
20
  if (!fields.length) return;
9✔
21
  for (const field of fields) {
4✔
22
    const value =
4✔
23
      (args[field.argName as keyof typeof args] as unknown) || field.default;
4✔
24
    if (value === undefined || value === null || value === "") continue;
4!
25

26
    const current = task || contact;
4✔
27
    const currentField = current?.customFieldData?.find(
4✔
28
      (f) => f.field.id === Number(field.id),
4✔
29
    );
4✔
30
    let currentValue;
4✔
31
    if (field.type === "enum") {
4✔
32
      currentValue =
2✔
33
        currentField && Array.isArray(currentField.value)
2✔
34
          ? currentField?.value?.[0]
2!
NEW
35
          : "";
×
36
    }
2✔
37
    if (field.type === "handbook_record") {
4!
38
      // TODO: addDirectoryEntry
39
    }
×
40
    if (!forceUpdate && currentValue === value) continue;
4✔
41

42
    if (!postBody.customFieldData) postBody.customFieldData = [];
3✔
43
    postBody.customFieldData.push({
3✔
44
      field: { id: Number(field.id) },
3✔
45
      value: value as
3✔
46
        | string
47
        | number
48
        | string[]
49
        | { id: number }
50
        | { id: number }[],
51
    });
3✔
52
  }
3✔
53
}
4✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc