Skip to content

Commit

Permalink
Merge pull request #142 from HiEventsDev/develop
Browse files Browse the repository at this point in the history
main <- develop
  • Loading branch information
daveearley authored Aug 17, 2024
2 parents 037e7ad + 9a7a014 commit d1d873f
Show file tree
Hide file tree
Showing 136 changed files with 6,229 additions and 384 deletions.
25 changes: 25 additions & 0 deletions backend/app/DataTransferObjects/ErrorBagDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace HiEvents\DataTransferObjects;

class ErrorBagDTO extends BaseDTO
{
public function __construct(
/**
* @var array<string, string>
*/
public array $errors = [],
)
{
}

public function addError(string $key, string $message): void
{
$this->errors[$key] = $message;
}

public function toArray(array $without = []): array
{
return $this->errors;
}
}
19 changes: 19 additions & 0 deletions backend/app/DomainObjects/AttendeeCheckInDomainObject.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace HiEvents\DomainObjects;

class AttendeeCheckInDomainObject extends Generated\AttendeeCheckInDomainObjectAbstract
{
private ?AttendeeDomainObject $attendee = null;

public function getAttendee(): ?AttendeeDomainObject
{
return $this->attendee;
}

public function setAttendee(AttendeeDomainObject $attendee): self
{
$this->attendee = $attendee;
return $this;
}
}
13 changes: 13 additions & 0 deletions backend/app/DomainObjects/AttendeeDomainObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class AttendeeDomainObject extends Generated\AttendeeDomainObjectAbstract implem
/** @var Collection<QuestionAndAnswerViewDomainObject>|null */
public ?Collection $questionAndAnswerViews = null;

public ?AttendeeCheckInDomainObject $checkIn = null;

public static function getDefaultSort(): string
{
return self::CREATED_AT;
Expand Down Expand Up @@ -99,4 +101,15 @@ public function getQuestionAndAnswerViews(): ?Collection
{
return $this->questionAndAnswerViews;
}

public function setCheckIn(?AttendeeCheckInDomainObject $checkIn): AttendeeDomainObject
{
$this->checkIn = $checkIn;
return $this;
}

public function getCheckIn(): ?AttendeeCheckInDomainObject
{
return $this->checkIn;
}
}
137 changes: 137 additions & 0 deletions backend/app/DomainObjects/CheckInListDomainObject.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
<?php

namespace HiEvents\DomainObjects;

use Carbon\Carbon;
use HiEvents\DomainObjects\Interfaces\IsSortable;
use HiEvents\DomainObjects\SortingAndFiltering\AllowedSorts;
use Illuminate\Support\Collection;

class CheckInListDomainObject extends Generated\CheckInListDomainObjectAbstract implements IsSortable
{
private ?Collection $tickets = null;

private ?EventDomainObject $event = null;

private ?int $checkedInCount = null;

private ?int $totalAttendeesCount = null;

private ?string $timezone = null;

public static function getDefaultSort(): string
{
return static::CREATED_AT;
}

public static function getDefaultSortDirection(): string
{
return 'desc';
}

public static function getAllowedSorts(): AllowedSorts
{
return new AllowedSorts(
[
self::NAME => [
'asc' => __('Name A-Z'),
'desc' => __('Name Z-A'),
],
self::EXPIRES_AT => [
'asc' => __('Expires soonest'),
'desc' => __('Expires latest'),
],
self::CREATED_AT => [
'asc' => __('Oldest first'),
'desc' => __('Newest first'),
],
self::UPDATED_AT => [
'asc' => __('Updated oldest first'),
'desc' => __('Updated newest first'),
],
]
);
}

public function getTickets(): ?Collection
{
return $this->tickets;
}

public function setTickets(?Collection $tickets): static
{
$this->tickets = $tickets;

return $this;
}

public function getEvent(): ?EventDomainObject
{
return $this->event;
}

public function setEvent(?EventDomainObject $event): static
{
$this->event = $event;

return $this;
}

public function isExpired(string $timezone): bool
{
if ($this->getExpiresAt() === null) {
return false;
}
$endDate = Carbon::parse($this->getExpiresAt());
$endDate->setTimezone($timezone);

return $endDate->isPast();
}

public function isActivated(string $timezone): bool
{
if ($this->getActivatesAt() === null) {
return true;
}
$startDate = Carbon::parse($this->getActivatesAt());
$startDate->setTimezone($timezone);

return $startDate->isPast();
}

public function getCheckedInCount(): ?int
{
return $this->checkedInCount;
}

public function setCheckedInCount(?int $checkedInCount): static
{
$this->checkedInCount = $checkedInCount ?? 0;

return $this;
}

public function getTotalAttendeesCount(): ?int
{
return $this->totalAttendeesCount;
}

public function setTotalAttendeesCount(?int $totalAttendeesCount): static
{
$this->totalAttendeesCount = $totalAttendeesCount ?? 0;

return $this;
}

public function getTimezone(): ?string
{
return $this->timezone;
}

public function setTimezone(?string $timezone): static
{
$this->timezone = $timezone;

return $this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?php

namespace HiEvents\DomainObjects\Generated;

/**
* THIS FILE IS AUTOGENERATED - DO NOT EDIT IT DIRECTLY.
* @package HiEvents\DomainObjects\Generated
*/
abstract class AttendeeCheckInDomainObjectAbstract extends \HiEvents\DomainObjects\AbstractDomainObject
{
final public const SINGULAR_NAME = 'attendee_check_in';
final public const PLURAL_NAME = 'attendee_check_ins';
final public const ID = 'id';
final public const CHECK_IN_LIST_ID = 'check_in_list_id';
final public const TICKET_ID = 'ticket_id';
final public const ATTENDEE_ID = 'attendee_id';
final public const SHORT_ID = 'short_id';
final public const IP_ADDRESS = 'ip_address';
final public const DELETED_AT = 'deleted_at';
final public const CREATED_AT = 'created_at';
final public const UPDATED_AT = 'updated_at';

protected int $id;
protected int $check_in_list_id;
protected int $ticket_id;
protected int $attendee_id;
protected string $short_id;
protected string $ip_address;
protected ?string $deleted_at = null;
protected ?string $created_at = null;
protected ?string $updated_at = null;

public function toArray(): array
{
return [
'id' => $this->id ?? null,
'check_in_list_id' => $this->check_in_list_id ?? null,
'ticket_id' => $this->ticket_id ?? null,
'attendee_id' => $this->attendee_id ?? null,
'short_id' => $this->short_id ?? null,
'ip_address' => $this->ip_address ?? null,
'deleted_at' => $this->deleted_at ?? null,
'created_at' => $this->created_at ?? null,
'updated_at' => $this->updated_at ?? null,
];
}

public function setId(int $id): self
{
$this->id = $id;
return $this;
}

public function getId(): int
{
return $this->id;
}

public function setCheckInListId(int $check_in_list_id): self
{
$this->check_in_list_id = $check_in_list_id;
return $this;
}

public function getCheckInListId(): int
{
return $this->check_in_list_id;
}

public function setTicketId(int $ticket_id): self
{
$this->ticket_id = $ticket_id;
return $this;
}

public function getTicketId(): int
{
return $this->ticket_id;
}

public function setAttendeeId(int $attendee_id): self
{
$this->attendee_id = $attendee_id;
return $this;
}

public function getAttendeeId(): int
{
return $this->attendee_id;
}

public function setShortId(string $short_id): self
{
$this->short_id = $short_id;
return $this;
}

public function getShortId(): string
{
return $this->short_id;
}

public function setIpAddress(string $ip_address): self
{
$this->ip_address = $ip_address;
return $this;
}

public function getIpAddress(): string
{
return $this->ip_address;
}

public function setDeletedAt(?string $deleted_at): self
{
$this->deleted_at = $deleted_at;
return $this;
}

public function getDeletedAt(): ?string
{
return $this->deleted_at;
}

public function setCreatedAt(?string $created_at): self
{
$this->created_at = $created_at;
return $this;
}

public function getCreatedAt(): ?string
{
return $this->created_at;
}

public function setUpdatedAt(?string $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}

public function getUpdatedAt(): ?string
{
return $this->updated_at;
}
}
Loading

0 comments on commit d1d873f

Please sign in to comment.