Skip to content

Commit

Permalink
[People] Fix Person Syncing (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
onairmarc authored Dec 4, 2024
1 parent c1560ea commit 9a4b35e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 37 deletions.
62 changes: 31 additions & 31 deletions src/Objects/People/Attributes/PersonAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,35 @@
class PersonAttributes
{
public string $personId;
public ?string $givenName;
public ?string $firstName;
public ?string $nickname;
public ?string $middleName;
public ?string $lastName;
public ?Carbon $birthdate;
public ?Carbon $anniversary;
public ?string $gender;
public ?int $grade;
public ?bool $child;
public ?int $graduationYear;
public ?bool $siteAdministrator;
public ?bool $accountingAdministrator;
public ?string $peoplePermissions;
public ?string $membership;
public ?Carbon $inactivatedAt;
public ?string $medicalNotes;
public ?bool $mfaConfigured;
public ?Carbon $createdAt;
public ?Carbon $updatedAt;
public ?string $avatar;
public ?string $name;
public ?string $demographicAvatarUrl;
public ?string $directoryStatus;
public ?bool $passedBackgroundCheck;
public ?bool $canCreateForms;
public ?bool $canEmailLists;
public ?string $schoolType;
public ?string $status;
public ?int $primaryCampusId;
public ?int $remoteId;
public ?string $givenName = null;
public ?string $firstName = null;
public ?string $nickname = null;
public ?string $middleName = null;
public ?string $lastName = null;
public ?Carbon $birthdate = null;
public ?Carbon $anniversary = null;
public ?string $gender = null;
public ?int $grade = null;
public ?bool $child = null;
public ?int $graduationYear = null;
public ?bool $siteAdministrator = null;
public ?bool $accountingAdministrator = null;
public ?string $peoplePermissions = null;
public ?string $membership = null;
public ?Carbon $inactivatedAt = null;
public ?string $medicalNotes = null;
public ?bool $mfaConfigured = null;
public ?Carbon $createdAt = null;
public ?Carbon $updatedAt = null;
public ?string $avatar = null;
public ?string $name = null;
public ?string $demographicAvatarUrl = null;
public ?string $directoryStatus = null;
public ?bool $passedBackgroundCheck = null;
public ?bool $canCreateForms = null;
public ?bool $canEmailLists = null;
public ?string $schoolType = null;
public ?string $status = null;
public ?int $primaryCampusId = null;
public ?int $remoteId = null;
}
14 changes: 8 additions & 6 deletions src/Objects/People/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ private function mapToPco(): array
"first_name" => $this->attributes->firstName ?? null,
"middle_name" => $this->attributes->middleName ?? null,
"last_name" => $this->attributes->lastName ?? null,
"birthdate" => $this->attributes->birthdate ?? null,
"anniversary" => $this->attributes->anniversary ?? null,
"birthdate" => $this->attributes->birthdate?->toDateString() ?? null,
"anniversary" => $this->attributes->anniversary?->toDateString() ?? null,
"gender" => $this->attributes->gender ?? null,
"grade" => $this->attributes->grade ?? null,
"child" => $this->attributes->child ?? null,
Expand All @@ -158,11 +158,11 @@ private function mapToPco(): array
"accounting_administrator" => $this->attributes->accountingAdministrator ?? null,
"people_permissions" => $this->attributes->peoplePermissions ?? null,
"membership" => $this->attributes->membership ?? null,
"inactivated_at" => $this->attributes->inactivatedAt ?? null,
"inactivated_at" => $this->attributes->inactivatedAt?->toDateTimeString() ?? null,
"medical_notes" => $this->attributes->medicalNotes ?? null,
"mfa_configured" => $this->attributes->mfaConfigured ?? null,
"created_at" => $this->attributes->createdAt ?? null,
"updated_at" => $this->attributes->updatedAt ?? null,
"created_at" => $this->attributes->createdAt?->toDateTimeString() ?? null,
"updated_at" => $this->attributes->updatedAt?->toDateTimeString() ?? null,
"avatar" => $this->attributes->avatar ?? null,
"name" => $this->attributes->name ?? null,
"demographic_avatar_url" => $this->attributes->demographicAvatarUrl ?? null,
Expand All @@ -186,6 +186,8 @@ private function mapToPco(): array
$person["data"]["attributes"]["demographic_avatar_url"]
);

return Arr::whereNotNull($person["data"]["attributes"]);
$person["data"]["attributes"] = Arr::whereNotNull($person["data"]["attributes"]);

return $person;
}
}

0 comments on commit 9a4b35e

Please sign in to comment.