Skip to content

Commit

Permalink
Merge pull request #9 from evecommander/Define-JSON-API-schemas
Browse files Browse the repository at this point in the history
Define json api schemas
  • Loading branch information
Wizofgoz authored May 17, 2018
2 parents 0710528 + 2a42cb9 commit 966f6f8
Show file tree
Hide file tree
Showing 171 changed files with 2,173 additions and 964 deletions.
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ before_script:
- sudo apt install node
- composer install --optimize-autoloader
- php artisan config:cache
- php artisan route:cache
- cd resources/assets/src/evecommander
- npm install
- npm run build

after_success:
- rm .env
Expand Down
17 changes: 12 additions & 5 deletions app/Abstracts/Organization.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@

namespace App\Abstracts;

use App\FleetType;
use App\Traits\HasHandbooks;
use App\Traits\HasMembers;
use App\Traits\IsMember;
use Illuminate\Database\Eloquent\Model;

abstract class Organization extends Model
{
use HasHandbooks;
use HasMembers;
use IsMember;
use HasHandbooks, HasMembers, IsMember;

public $incrementing = false;
}
/**
* Get relation between this organization and any fleet types it owns.
*
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
*/
public function fleetTypes()
{
return $this->morphMany(FleetType::class, 'owner');
}
}
29 changes: 26 additions & 3 deletions app/Alliance.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
use App\Traits\HasSRP;
use App\Traits\IssuesInvoices;
use App\Traits\ReceivesInvoices;
use App\Traits\UuidTrait;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Carbon;

/**
* Class Alliance
* Class Alliance.
*
* @property string id
* @property int api_id
Expand All @@ -19,13 +20,35 @@
* @property array settings
* @property Carbon created_at
* @property Carbon updated_at
*
* Relationships
* @property \Illuminate\Database\Eloquent\Relations\MorphMany handbooks
* @property \Illuminate\Database\Eloquent\Relations\MorphMany members
* @property \Illuminate\Database\Eloquent\Relations\BelongsTo defaultMembershipLevel
* @property \Illuminate\Database\Eloquent\Relations\MorphMany membershipLevels
* @property \Illuminate\Database\Eloquent\Relations\MorphMany memberships
* @property \Illuminate\Database\Eloquent\Relations\MorphMany claims
* @property \Illuminate\Database\Eloquent\Relations\MorphMany invoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany fulfilledInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany overdueInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany pendingInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany defaultInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany issuedInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany fulfilledIssuedInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany overdueIssuedInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany pendingIssuedInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany defaultIssuedInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany notifications
* @property \Illuminate\Database\Eloquent\Relations\MorphMany readNotifications
* @property \Illuminate\Database\Eloquent\Relations\MorphMany unreadNotifications
* @property \Illuminate\Database\Eloquent\Relations\MorphMany coalition
*/
class Alliance extends Organization
{
use HasSRP, ReceivesInvoices, IssuesInvoices, Notifiable;
use UuidTrait, HasSRP, ReceivesInvoices, IssuesInvoices, Notifiable;

protected $casts = [
'settings' => 'array'
'settings' => 'array',
];

/**
Expand Down
7 changes: 6 additions & 1 deletion app/BillingCondition.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Illuminate\Support\Carbon;

/**
* Class BillingCondition
* Class BillingCondition.
*
* @property string id
* @property string owner_id
Expand All @@ -18,6 +18,11 @@
* @property int|null quantity
* @property Carbon created_at
* @property Carbon updated_at
*
* Relationships
* @property \Illuminate\Database\Eloquent\Relations\MorphTo owner
* @property \Illuminate\Database\Eloquent\Relations\HasMany discounts
* @property \Illuminate\Database\Eloquent\Relations\BelongsToMany membershipFees
*/
class BillingCondition extends Model
{
Expand Down
17 changes: 16 additions & 1 deletion app/Character.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,29 @@
use Illuminate\Support\Carbon;

/**
* Class Character
* Class Character.
*
* @property string id
* @property int user_id
* @property int eve_id
* @property string name
* @property Carbon created_at
* @property Carbon updated_at
*
* Relationships
* @property \Illuminate\Database\Eloquent\Relations\MorphMany notifications
* @property \Illuminate\Database\Eloquent\Relations\MorphMany readNotifications
* @property \Illuminate\Database\Eloquent\Relations\MorphMany unreadNotifications
* @property \Illuminate\Database\Eloquent\Relations\MorphMany invoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany fulfilledInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany overdueInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany pendingInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany defaultInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany memberships
* @property \Illuminate\Database\Eloquent\Relations\BelongsTo user
* @property \Illuminate\Database\Eloquent\Relations\HasOne token
* @property \Illuminate\Database\Eloquent\Relations\HasMany comments
* @property \Illuminate\Database\Eloquent\Relations\MorphMany corporation
*/
class Character extends Model
{
Expand Down
37 changes: 35 additions & 2 deletions app/Coalition.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Illuminate\Support\Carbon;

/**
* Class Coalition
* Class Coalition.
*
* @property string id
* @property int leader_character_id
Expand All @@ -21,13 +21,36 @@
* @property array settings
* @property Carbon created_at
* @property Carbon updated_at
*
* Relationships
* @property \Illuminate\Database\Eloquent\Relations\MorphMany handbooks
* @property \Illuminate\Database\Eloquent\Relations\MorphMany members
* @property \Illuminate\Database\Eloquent\Relations\BelongsTo defaultMembershipLevel
* @property \Illuminate\Database\Eloquent\Relations\MorphMany membershipLevels
* @property \Illuminate\Database\Eloquent\Relations\MorphMany memberships
* @property \Illuminate\Database\Eloquent\Relations\MorphMany claims
* @property \Illuminate\Database\Eloquent\Relations\MorphMany invoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany fulfilledInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany overdueInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany pendingInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany defaultInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany issuedInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany fulfilledIssuedInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany overdueIssuedInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany pendingIssuedInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany defaultIssuedInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany notifications
* @property \Illuminate\Database\Eloquent\Relations\MorphMany readNotifications
* @property \Illuminate\Database\Eloquent\Relations\MorphMany unreadNotifications
* @property \Illuminate\Database\Eloquent\Relations\BelongsTo leader
* @property \Illuminate\Database\Eloquent\Relations\MorphMany alliances
*/
class Coalition extends Organization
{
use UuidTrait, HasSRP, ReceivesInvoices, IssuesInvoices;

protected $casts = [
'settings' => 'array'
'settings' => 'array',
];

public function receivedInvoiceSubscribers()
Expand All @@ -44,11 +67,21 @@ public function receivedInvoiceSubscribers()
return $subscribers;
}

/**
* Get relation between this coalition and the character that is designated as the leader.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function leader()
{
return $this->belongsTo(Character::class, 'leader_character_id');
}

/**
* Get relation between this coalition and any alliances that are members of it.
*
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
*/
public function alliances()
{
return $this->members()->where('member_type', Alliance::class)->with('member');
Expand Down
10 changes: 7 additions & 3 deletions app/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

namespace App;

use App\Traits\Commentable;
use App\Traits\HasComments;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

/**
* Class Comment
* Class Comment.
*
* @property string id
* @property string commentable_id
Expand All @@ -17,6 +16,11 @@
* @property string text
* @property Carbon created_at
* @property Carbon updated_at
*
* Relationships
* @property \Illuminate\Database\Eloquent\Relations\MorphMany comments
* @property \Illuminate\Database\Eloquent\Relations\BelongsTo character
* @property \Illuminate\Database\Eloquent\Relations\MorphTo commentable
*/
class Comment extends Model
{
Expand All @@ -35,7 +39,7 @@ public function character()
/**
* Get the owning commentable model.
*
* @return mixed
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
*/
public function commentable()
{
Expand Down
3 changes: 2 additions & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class Kernel extends ConsoleKernel
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*
* @return void
*/
protected function schedule(Schedule $schedule)
Expand Down
27 changes: 25 additions & 2 deletions app/Corporation.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Illuminate\Support\Carbon;

/**
* Class Corporation
* Class Corporation.
*
* @property string id
* @property int api_id
Expand All @@ -20,6 +20,29 @@
* @property array settings
* @property Carbon created_at
* @property Carbon updated_at
*
* Relationships
* @property \Illuminate\Database\Eloquent\Relations\MorphMany handbooks
* @property \Illuminate\Database\Eloquent\Relations\MorphMany members
* @property \Illuminate\Database\Eloquent\Relations\BelongsTo defaultMembershipLevel
* @property \Illuminate\Database\Eloquent\Relations\MorphMany membershipLevels
* @property \Illuminate\Database\Eloquent\Relations\MorphMany memberships
* @property \Illuminate\Database\Eloquent\Relations\MorphMany claims
* @property \Illuminate\Database\Eloquent\Relations\MorphMany invoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany fulfilledInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany overdueInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany pendingInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany defaultInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany issuedInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany fulfilledIssuedInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany overdueIssuedInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany pendingIssuedInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany defaultIssuedInvoices
* @property \Illuminate\Database\Eloquent\Relations\MorphMany notifications
* @property \Illuminate\Database\Eloquent\Relations\MorphMany readNotifications
* @property \Illuminate\Database\Eloquent\Relations\MorphMany unreadNotifications
* @property \Illuminate\Database\Eloquent\Relations\MorphMany alliance
* @property \Illuminate\Database\Eloquent\Relations\MorphMany characters
*/
class Corporation extends Organization
{
Expand All @@ -31,7 +54,7 @@ protected function getBubbleToModels(Notification $notification)
}

protected $casts = [
'settings' => 'array'
'settings' => 'array',
];

/**
Expand Down
8 changes: 6 additions & 2 deletions app/Discount.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@
use Illuminate\Support\Carbon;

/**
* Class Discount
* Class Discount.
*
* @property string id
* @property string owner_id
* @property string owner_type
* @property string billing_condition_id
* @property string amount_type
* @property double amount
* @property float amount
* @property Carbon created_at
* @property Carbon updated_at
*
* Relationships
* @property \Illuminate\Database\Eloquent\Relations\MorphTo owner
* @property \Illuminate\Database\Eloquent\Relations\BelongsTo billingCondition
*/
class Discount extends Model
{
Expand Down
8 changes: 7 additions & 1 deletion app/Doctrine.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Illuminate\Support\Carbon;

/**
* Class Doctrine
* Class Doctrine.
*
* @property string id
* @property string owner_id
Expand All @@ -19,6 +19,12 @@
* @property string last_updated_by
* @property Carbon created_at
* @property Carbon updated_at
*
* Relationships
* @property \Illuminate\Database\Eloquent\Relations\MorphTo owner
* @property \Illuminate\Database\Eloquent\Relations\HasMany fittings
* @property \Illuminate\Database\Eloquent\Relations\BelongsTo createdBy
* @property \Illuminate\Database\Eloquent\Relations\BelongsTo lastUpdatedBy
*/
class Doctrine extends Model
{
Expand Down
9 changes: 6 additions & 3 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ class Handler extends ExceptionHandler
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $exception
* @param \Exception $exception
*
* @throws \Exception
*
* @return void
*/
public function report(Exception $exception)
Expand All @@ -44,8 +46,9 @@ public function report(Exception $exception)
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
*
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
Expand Down
8 changes: 7 additions & 1 deletion app/Fitting.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Illuminate\Support\Carbon;

/**
* Class Fitting
* Class Fitting.
*
* @property string id
* @property string owner_id
Expand All @@ -18,6 +18,12 @@
* @property int api_id
* @property Carbon created_at
* @property Carbon updated_at
*
* Relationships
* @property \Illuminate\Database\Eloquent\Relations\MorphMany comments
* @property \Illuminate\Database\Eloquent\Relations\BelongsTo doctrine
* @property \Illuminate\Database\Eloquent\Relations\MorphTo owner
* @property \Illuminate\Database\Eloquent\Relations\HasMany replacementClaims
*/
class Fitting extends Model
{
Expand Down
Loading

0 comments on commit 966f6f8

Please sign in to comment.