minor fixes

This commit is contained in:
David Bomba 2021-03-09 17:06:03 +11:00
parent 67cedb8348
commit 0a3b5e0665
2 changed files with 50 additions and 1 deletions

View File

@ -1,5 +1,13 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Factory;
@ -11,6 +19,8 @@ class BillingSubscriptionFactory
public static function create(int $company_id, int $user_id): BillingSubscription
{
$billing_subscription = new BillingSubscription();
$billing_subscription->company_id = $company_id;
$billing_subscription->user_id = $user_id;
return $billing_subscription;
}

View File

@ -84,6 +84,45 @@ class BillingSubscriptionController extends BaseController
return $this->listResponse($billing_subscriptions);
}
/**
* Show the form for creating a new resource.
*
* @param CreateBillingSubscriptionRequest $request The request
*
* @return Response
*
*
* @OA\Get(
* path="/api/v1/billing_subscriptions/create",
* operationId="getBillingSubscriptionsCreate",
* tags={"billing_subscriptions"},
* summary="Gets a new blank billing_subscriptions object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
* @OA\Response(
* response=200,
* description="A blank billing_subscriptions object",
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
* @OA\JsonContent(ref="#/components/schemas/BillingSubscription"),
* ),
* @OA\Response(
* response=422,
* description="Validation error",
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
*
* ),
* @OA\Response(
* response="default",
* description="Unexpected Error",
* @OA\JsonContent(ref="#/components/schemas/Error"),
* ),
* )
*/
public function create(CreateBillingSubscriptionRequest $request): \Illuminate\Http\Response
{
$billing_subscription = BillingSubscriptionFactory::create(auth()->user()->company()->id, auth()->user()->id);