Skip to content

Commit 9a4b35e

Browse files
authored
[People] Fix Person Syncing (#33)
1 parent c1560ea commit 9a4b35e

File tree

2 files changed

+39
-37
lines changed

2 files changed

+39
-37
lines changed

src/Objects/People/Attributes/PersonAttributes.php

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,35 @@
1111
class PersonAttributes
1212
{
1313
public string $personId;
14-
public ?string $givenName;
15-
public ?string $firstName;
16-
public ?string $nickname;
17-
public ?string $middleName;
18-
public ?string $lastName;
19-
public ?Carbon $birthdate;
20-
public ?Carbon $anniversary;
21-
public ?string $gender;
22-
public ?int $grade;
23-
public ?bool $child;
24-
public ?int $graduationYear;
25-
public ?bool $siteAdministrator;
26-
public ?bool $accountingAdministrator;
27-
public ?string $peoplePermissions;
28-
public ?string $membership;
29-
public ?Carbon $inactivatedAt;
30-
public ?string $medicalNotes;
31-
public ?bool $mfaConfigured;
32-
public ?Carbon $createdAt;
33-
public ?Carbon $updatedAt;
34-
public ?string $avatar;
35-
public ?string $name;
36-
public ?string $demographicAvatarUrl;
37-
public ?string $directoryStatus;
38-
public ?bool $passedBackgroundCheck;
39-
public ?bool $canCreateForms;
40-
public ?bool $canEmailLists;
41-
public ?string $schoolType;
42-
public ?string $status;
43-
public ?int $primaryCampusId;
44-
public ?int $remoteId;
14+
public ?string $givenName = null;
15+
public ?string $firstName = null;
16+
public ?string $nickname = null;
17+
public ?string $middleName = null;
18+
public ?string $lastName = null;
19+
public ?Carbon $birthdate = null;
20+
public ?Carbon $anniversary = null;
21+
public ?string $gender = null;
22+
public ?int $grade = null;
23+
public ?bool $child = null;
24+
public ?int $graduationYear = null;
25+
public ?bool $siteAdministrator = null;
26+
public ?bool $accountingAdministrator = null;
27+
public ?string $peoplePermissions = null;
28+
public ?string $membership = null;
29+
public ?Carbon $inactivatedAt = null;
30+
public ?string $medicalNotes = null;
31+
public ?bool $mfaConfigured = null;
32+
public ?Carbon $createdAt = null;
33+
public ?Carbon $updatedAt = null;
34+
public ?string $avatar = null;
35+
public ?string $name = null;
36+
public ?string $demographicAvatarUrl = null;
37+
public ?string $directoryStatus = null;
38+
public ?bool $passedBackgroundCheck = null;
39+
public ?bool $canCreateForms = null;
40+
public ?bool $canEmailLists = null;
41+
public ?string $schoolType = null;
42+
public ?string $status = null;
43+
public ?int $primaryCampusId = null;
44+
public ?int $remoteId = null;
4545
}

src/Objects/People/Person.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ private function mapToPco(): array
148148
"first_name" => $this->attributes->firstName ?? null,
149149
"middle_name" => $this->attributes->middleName ?? null,
150150
"last_name" => $this->attributes->lastName ?? null,
151-
"birthdate" => $this->attributes->birthdate ?? null,
152-
"anniversary" => $this->attributes->anniversary ?? null,
151+
"birthdate" => $this->attributes->birthdate?->toDateString() ?? null,
152+
"anniversary" => $this->attributes->anniversary?->toDateString() ?? null,
153153
"gender" => $this->attributes->gender ?? null,
154154
"grade" => $this->attributes->grade ?? null,
155155
"child" => $this->attributes->child ?? null,
@@ -158,11 +158,11 @@ private function mapToPco(): array
158158
"accounting_administrator" => $this->attributes->accountingAdministrator ?? null,
159159
"people_permissions" => $this->attributes->peoplePermissions ?? null,
160160
"membership" => $this->attributes->membership ?? null,
161-
"inactivated_at" => $this->attributes->inactivatedAt ?? null,
161+
"inactivated_at" => $this->attributes->inactivatedAt?->toDateTimeString() ?? null,
162162
"medical_notes" => $this->attributes->medicalNotes ?? null,
163163
"mfa_configured" => $this->attributes->mfaConfigured ?? null,
164-
"created_at" => $this->attributes->createdAt ?? null,
165-
"updated_at" => $this->attributes->updatedAt ?? null,
164+
"created_at" => $this->attributes->createdAt?->toDateTimeString() ?? null,
165+
"updated_at" => $this->attributes->updatedAt?->toDateTimeString() ?? null,
166166
"avatar" => $this->attributes->avatar ?? null,
167167
"name" => $this->attributes->name ?? null,
168168
"demographic_avatar_url" => $this->attributes->demographicAvatarUrl ?? null,
@@ -186,6 +186,8 @@ private function mapToPco(): array
186186
$person["data"]["attributes"]["demographic_avatar_url"]
187187
);
188188

189-
return Arr::whereNotNull($person["data"]["attributes"]);
189+
$person["data"]["attributes"] = Arr::whereNotNull($person["data"]["attributes"]);
190+
191+
return $person;
190192
}
191193
}

0 commit comments

Comments
 (0)