Skip to content

Commit

Permalink
Merge pull request #117 from HiEventsDev/develop
Browse files Browse the repository at this point in the history
main <- develop
  • Loading branch information
daveearley authored Aug 2, 2024
2 parents 7313619 + 433fbad commit 8d22c1f
Show file tree
Hide file tree
Showing 136 changed files with 5,838 additions and 2,051 deletions.
102 changes: 63 additions & 39 deletions .do/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ databases:
production: true
version: "12"
domains:
- domain: dev.app.hi.events
- domain: demo.hi.events
type: PRIMARY
- domain: dev.api.hi.events
- domain: app.hi.events
type: ALIAS
envs:
- key: APP_KEY
scope: RUN_AND_BUILD_TIME
type: SECRET
value: EV[1:tgNynPB6rjrGHux5SLWOaGXa0Dq2wUb9:EkhnCswHYeeErT6Mvx+XPQ2tjyq4C250jc2PCPOkz3c98IeV8s98ncrlucqXN9og5RFoNHD/T0UaZdZo/N5hwf3alA==]
value: EV[1:XXX:XXX]
- key: APP_SAAS_MODE_ENABLED
scope: RUN_AND_BUILD_TIME
value: "true"
Expand All @@ -42,18 +42,18 @@ envs:
- key: JWT_SECRET
scope: RUN_AND_BUILD_TIME
type: SECRET
value: EV[1:JBreFQlA8IdEHquwAg9P58pMz0JEa+KL:4UMIEVR52tj7N1SzSqykHXJNaO9QrCKB1iSa5AOOEHwBoPoiA8WLeplfaaowgliyk/h51NX26+oA0tw7SHL3JrADnw==]
value: EV[1:XXX:XXX]
- key: LOG_CHANNEL
scope: RUN_AND_BUILD_TIME
value: stderr
- key: AWS_ACCESS_KEY_ID
scope: RUN_AND_BUILD_TIME
type: SECRET
value: EV[1:nzGNZAsAUDy/A4I57t55AtmGPrdMWVtk:SKvcYl/NT0+IKcu2KaftzbiG3t5nQPfaP/VAj8AE+uzcCWlD]
value: EV[1:XXX:XXX]
- key: AWS_SECRET_ACCESS_KEY
scope: RUN_AND_BUILD_TIME
type: SECRET
value: EV[1:vmiq656HFNEtHHJs07EQQeV1HVwjM2ea:h9a00bBytMXPz0sNKHOUOfu5e5EUVeBz1kAcdqRLtYhREmhjr1/oUFQ66fJjMxRuCMCyYpu9kbg=]
value: EV[1:XXX:XXX]
- key: AWS_DEFAULT_REGION
scope: RUN_AND_BUILD_TIME
value: us-west-1
Expand All @@ -66,32 +66,20 @@ envs:
- key: STRIPE_PUBLIC_KEY
scope: RUN_AND_BUILD_TIME
type: SECRET
value: EV[1:XWMOWzHz/fCYVb824fdEDC1dzGM8O7cC:HV/yWPv7eI721IxatBR9alNVIgsyzS1+SOpk3sxdo8kBK2QcRl+seuhB/MTx4dENQRvI083S7Ybe66UrWKAgR5jO4T2xoyEulvJlCeuZksbv0dC0L6rLFX6wJnZCCqhUei6ua02tU71XQqRg5WGO6daLvGbN6xQ5hrbO]
value: EV[1:XXX:XXX]
- key: STRIPE_SECRET_KEY
scope: RUN_AND_BUILD_TIME
type: SECRET
value: EV[1:i3ZPSO52CRk6hX2IoC0hox+8yfa8nCNc:NRV6VGMKIGKHlcxw1HTRW25jfNF7tKWuKIF0trHFECPcQ0c7d12BkKlaENi5qi4MxsS3cmbA5wI7lgFwcmEhEz4DOqBBbHjpRgUGF9UXaRvW0PxIixOb9glKW45gPuQGeZn/MJLHNE98p9xi/UyRdgX6wlba96bkauKT]
- key: STRIPE_WEBHOOK_SECRET
scope: RUN_AND_BUILD_TIME
type: SECRET
value: EV[1:R1RgskZKXSKnNsqSCQnPX4VrvJ7GANAW:0yNAzT6WlSBM56ghXUWYtK6Cp0O1WyJZS5RLT17bsqnYrvSCEr2x3mEaR0Go7hSKSODHe1Ql]
value: EV[1:XXX:XXX]
- key: MAIL_MAILER
scope: RUN_AND_BUILD_TIME
value: smtp
- key: MAIL_HOST
scope: RUN_AND_BUILD_TIME
value: sandbox.smtp.mailtrap.io
value: smtp-relay.brevo.com
- key: MAIL_PORT
scope: RUN_AND_BUILD_TIME
value: "2525"
- key: MAIL_USERNAME
scope: RUN_AND_BUILD_TIME
type: SECRET
value: EV[1:FVdDTpQf7I1jYF63nPkgQo8dsvRMTKPU:hTCQ3cK6XFZaqp6Fd6jprgRB61oDfwO30p0ii4VL]
- key: MAIL_PASSWORD
scope: RUN_AND_BUILD_TIME
type: SECRET
value: EV[1:kzHCAK6w/8muUxfl9XQ++aCgbbPiq9PK:5Hmdbri+Xz6JVzV9FT0nrrqR+ece7Irq3mm/zdzi]
value: "587"
- key: DB_CONNECTION
scope: RUN_AND_BUILD_TIME
value: pgsql
Expand Down Expand Up @@ -131,29 +119,49 @@ envs:
- key: DATABASE_URL
scope: RUN_AND_BUILD_TIME
value: ${hi-events-postgres.DATABASE_URL}
- key: STRIPE_WEBHOOK_SECRET
scope: RUN_AND_BUILD_TIME
type: SECRET
value: EV[1:XXX:XXX]
- key: MAIL_USERNAME
scope: RUN_AND_BUILD_TIME
value: 758230001@smtp-brevo.com
- key: MAIL_PASSWORD
scope: RUN_AND_BUILD_TIME
value: XXX
- key: MAIL_FROM_ADDRESS
scope: RUN_AND_BUILD_TIME
value: hello@hi.events
- key: MAIL_FROM_NAME
scope: RUN_AND_BUILD_TIME
value: Hi.Events
features:
- buildpack-stack=ubuntu-22
ingress:
rules:
- component:
name: hi-events-frontend
name: hi-events-backend
match:
path:
prefix: /
prefix: /api
- component:
name: hi-events-backend
name: hi-events-frontend
match:
path:
prefix: /api
prefix: /
jobs:
- dockerfile_path: /backend/Dockerfile
github:
branch: main
deploy_on_push: true
repo: HiEventsDev/hi.events
repo: HiEventsDev/Hi.Events
instance_count: 2
instance_size_slug: professional-xs
kind: PRE_DEPLOY
log_destinations:
- logtail:
token: XXX
name: LogTail
name: hi-events-migration
run_command: php artisan migrate --force
source_dir: backend
Expand All @@ -173,37 +181,53 @@ services:
github:
branch: main
deploy_on_push: true
repo: HiEventsDev/hi.events
http_port: 80
repo: HiEventsDev/Hi.Events
http_port: 8080
instance_count: 1
instance_size_slug: professional-xs
log_destinations:
- logtail:
token: XXX
name: LogTail
name: hi-events-backend
source_dir: backend
static_sites:
- build_command: yarn build
catchall_document: index.html
environment_slug: node-js
envs:
- key: VITE_API_URL
scope: BUILD_TIME
value: ${APP_URL}/api
- key: VITE_STRIPE_PUBLISHABLE_KEY
scope: BUILD_TIME
value: pk_test_51Ofu1CJKnXOyGeQuDPUHiZcJxZozRuERiv4vQRBtCscwTbxOL574cxUjAoNRL2YLCumgC5160pl6kvTIiAc9mOeM0058KAWQ55
scope: RUN_AND_BUILD_TIME
value: pk_test_XXX
- key: VITE_API_URL_SERVER
scope: RUN_AND_BUILD_TIME
value: ${APP_URL}/api
- key: VITE_API_URL_CLIENT
scope: RUN_AND_BUILD_TIME
value: ${APP_URL}/api
- key: VITE_FRONTEND_URL
scope: RUN_AND_BUILD_TIME
value: ${APP_URL}
github:
branch: main
deploy_on_push: true
repo: HiEventsDev/hi.events
repo: HiEventsDev/Hi.Events
http_port: 5678
instance_count: 1
instance_size_slug: professional-xs
name: hi-events-frontend
run_command: yarn start
source_dir: frontend
workers:
- dockerfile_path: /backend/Dockerfile
github:
branch: main
deploy_on_push: true
repo: HiEventsDev/hi.events
repo: HiEventsDev/Hi.Events
instance_count: 1
instance_size_slug: professional-xs
log_destinations:
- logtail:
token: XXX
name: LogTail
name: hi-events-worker
run_command: php artisan queue:work
source_dir: backend
source_dir: backend
16 changes: 0 additions & 16 deletions .do/deploy.template.yml

This file was deleted.

2 changes: 1 addition & 1 deletion backend/app/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ final class Constants
*
* @var int
*/
public const INFINITE = 123456789101112;
public const INFINITE = PHP_INT_MAX;
}
7 changes: 0 additions & 7 deletions backend/app/DomainObjects/AttributeEventDomainObject.php

This file was deleted.

86 changes: 86 additions & 0 deletions backend/app/DomainObjects/CapacityAssignmentDomainObject.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php

namespace HiEvents\DomainObjects;

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

class CapacityAssignmentDomainObject extends Generated\CapacityAssignmentDomainObjectAbstract implements IsSortable
{
public ?Collection $tickets = 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::CREATED_AT => [
'asc' => __('Oldest first'),
'desc' => __('Newest first'),
],
self::UPDATED_AT => [
'asc' => __('Updated oldest first'),
'desc' => __('Updated newest first'),
],
self::USED_CAPACITY => [
'desc' => __('Most capacity used'),
'asc' => __('Least capacity used'),
],
self::CAPACITY => [
'desc' => __('Least capacity'),
'asc' => __('Most capacity'),
],
]
);
}

public function getPercentageUsed(): float
{
if (!$this->getCapacity()) {
return 0;
}

return round(($this->getUsedCapacity() / $this->getCapacity()) * 100, 2);
}

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

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

return $this;
}

public function isCapacityUnlimited(): bool
{
return is_null($this->getCapacity());
}

public function getAvailableCapacity(): int
{
if ($this->isCapacityUnlimited()) {
return Constants::INFINITE;
}

return $this->getCapacity() - $this->getUsedCapacity();
}
}
7 changes: 0 additions & 7 deletions backend/app/DomainObjects/CustomerDomainObject.php

This file was deleted.

11 changes: 11 additions & 0 deletions backend/app/DomainObjects/Enums/CapacityAssignmentAppliesTo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace HiEvents\DomainObjects\Enums;

enum CapacityAssignmentAppliesTo
{
use BaseEnum;

case TICKETS;
case EVENT;
}
Loading

0 comments on commit 8d22c1f

Please sign in to comment.