Update for open api docs

This commit is contained in:
David Bomba 2023-11-23 11:28:38 +11:00
parent 149c5b6a0e
commit 2fa010b42f
7 changed files with 92 additions and 19 deletions

View File

@ -416,7 +416,6 @@ class InvoiceController extends BaseController
$invoice->service()
->triggeredActions($request)
// ->deletePdf()
->adjustInventory($old_invoice);
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));

View File

@ -28,7 +28,7 @@ class ClientContactRepository extends BaseRepository
public function save(array $data, Client $client) : void
{
//06-09-2022 sometimes users pass a contact object instead of a nested array, this sequence handles this scenario
if (isset($data['contacts']) && (count($data['contacts']) !== count($data['contacts'], COUNT_RECURSIVE))) {
$contacts = collect($data['contacts']);
} elseif (isset($data['contacts'])) {

View File

@ -25,8 +25,12 @@ class VendorContactRepository extends BaseRepository
public function save(array $data, Vendor $vendor) : void
{
if (isset($data['contacts'])) {
if (isset($data['contacts']) && (count($data['contacts']) !== count($data['contacts'], COUNT_RECURSIVE))) {
$contacts = collect($data['contacts']);
} elseif (isset($data['contacts'])) {
$temp_array[] = $data['contacts'];
$contacts = collect($temp_array);
} else {
$contacts = collect();
}
@ -80,10 +84,10 @@ class VendorContactRepository extends BaseRepository
});
$vendor->load('contacts');
$vendor->fresh();
//always made sure we have one blank contact to maintain state
if ($vendor->contacts->count() == 0) {
if ($vendor->contacts()->count() == 0) {
$new_contact = new VendorContact;
$new_contact->vendor_id = $vendor->id;
$new_contact->company_id = $vendor->company_id;

View File

@ -17855,18 +17855,22 @@ components:
description: 'The hashed if of the contact'
type: string
example: Opnel5aKBz
readOnly: true
user_id:
description: 'The hashed id of the user who created the contact'
type: string
example: Opnel5aKBz
readOnly: true
company_id:
description: 'The hashed id of the company'
type: string
example: Opnel5aKBz
readOnly: true
client_id:
description: 'The hashed id of the client'
type: string
example: Opnel5aKBz
readOnly: true
first_name:
description: 'The first name of the contact'
type: string
@ -17903,18 +17907,26 @@ components:
description: 'The terms of service which the contact has accpeted'
type: string
example: 'A long set of ToS'
readOnly: true
password:
description: 'The hashed password of the contact'
type: string
example: '*****'
confirmation-code:
confirmation_code:
description: 'The confirmation code used to authenticate the contacts email address'
type: string
example: 333-sdjkh34gbasd
readOnly: true
token:
description: 'A uuid based token.'
type: string
example: 333-sdjkh34gbasd
readOnly: true
contact_key:
description: 'A unique identifier for the contact'
type: string
example: JD0X52bkfZlJRiroCJ0tcSiAjsJTntZ5uqKdiZ0a
readOnly: true
is_primary:
description: 'Defines is this contact is the primary contact for the client'
type: boolean
@ -17936,31 +17948,37 @@ components:
type: number
format: integer
example: '3'
readOnly: true
email_verified_at:
description: 'The date which the contact confirmed their email'
type: number
format: integer
example: '134341234234'
readOnly: true
last_login:
description: Timestamp
type: number
format: integer
example: '134341234234'
readOnly: true
created_at:
description: Timestamp
type: number
format: integer
example: '134341234234'
readOnly: true
updated_at:
description: Timestamp
type: number
format: integer
example: '134341234234'
readOnly: true
deleted_at:
description: Timestamp
type: number
format: integer
example: '134341234234'
readOnly: true
type: object
ClientContactRequest:
properties:
@ -18021,14 +18039,17 @@ components:
description: 'The hashed id of the user id'
type: string
example: Opnel5aKBz
readOnly: true
company_id:
description: 'The hashed id of the company'
type: string
example: Opnel5aKBz
readOnly: true
vendor_id:
description: 'The hashed id of the vendor'
type: string
example: Opnel5aKBz
readOnly: true
first_name:
description: 'The first name of the contact'
type: string
@ -18037,6 +18058,16 @@ components:
description: 'The last name of the contact'
type: string
example: Windsor
contact_key:
description: 'A unique identifier for the contact'
type: string
example: JD0X52bkfZlJRiroCJ0tcSiAjsJTntZ5uqKdiZ0a
readOnly: true
confirmation_code:
description: 'The confirmation code used to authenticate the contacts email address'
type: string
example: 333-sdjkh34gbasd
readOnly: true
phone:
description: 'The contacts phone number'
type: string
@ -18061,6 +18092,16 @@ components:
description: 'The contact email address'
type: string
example: harry@windsor.com
email_verified_at:
description: 'The date which the contact confirmed their email'
type: number
format: integer
example: '134341234234'
readOnly: true
password:
description: 'The hashed password of the contact'
type: string
example: '*****'
is_primary:
description: 'Boolean flag determining if the contact is the primary contact for the vendor'
type: boolean
@ -19392,10 +19433,6 @@ components:
description: 'The hashed id of the company. This is a unique identifier for the company.'
type: string
example: Opnel5aKBz
client_id:
description: 'The hashed id of the client. This is a unique identifier for the client.'
type: string
example: Opnel5aKBz
contacts:
type: array
items:
@ -19525,8 +19562,6 @@ components:
type: string
example: 'Bob the vendor'
readOnly: true
settings:
$ref: '#/components/schemas/CompanySettings'
type: object
ClientSettings:
required:

View File

@ -4,18 +4,22 @@
description: 'The hashed if of the contact'
type: string
example: Opnel5aKBz
readOnly: true
user_id:
description: 'The hashed id of the user who created the contact'
type: string
example: Opnel5aKBz
readOnly: true
company_id:
description: 'The hashed id of the company'
type: string
example: Opnel5aKBz
readOnly: true
client_id:
description: 'The hashed id of the client'
type: string
example: Opnel5aKBz
readOnly: true
first_name:
description: 'The first name of the contact'
type: string
@ -52,18 +56,26 @@
description: 'The terms of service which the contact has accpeted'
type: string
example: 'A long set of ToS'
readOnly: true
password:
description: 'The hashed password of the contact'
type: string
example: '*****'
confirmation-code:
confirmation_code:
description: 'The confirmation code used to authenticate the contacts email address'
type: string
example: 333-sdjkh34gbasd
readOnly: true
token:
description: 'A uuid based token.'
type: string
example: 333-sdjkh34gbasd
readOnly: true
contact_key:
description: 'A unique identifier for the contact'
type: string
example: JD0X52bkfZlJRiroCJ0tcSiAjsJTntZ5uqKdiZ0a
readOnly: true
is_primary:
description: 'Defines is this contact is the primary contact for the client'
type: boolean
@ -85,29 +97,35 @@
type: number
format: integer
example: '3'
readOnly: true
email_verified_at:
description: 'The date which the contact confirmed their email'
type: number
format: integer
example: '134341234234'
readOnly: true
last_login:
description: Timestamp
type: number
format: integer
example: '134341234234'
readOnly: true
created_at:
description: Timestamp
type: number
format: integer
example: '134341234234'
readOnly: true
updated_at:
description: Timestamp
type: number
format: integer
example: '134341234234'
readOnly: true
deleted_at:
description: Timestamp
type: number
format: integer
example: '134341234234'
readOnly: true
type: object

View File

@ -17,10 +17,6 @@
description: 'The hashed id of the company. This is a unique identifier for the company.'
type: string
example: Opnel5aKBz
client_id:
description: 'The hashed id of the client. This is a unique identifier for the client.'
type: string
example: Opnel5aKBz
contacts:
type: array
items:
@ -150,6 +146,4 @@
type: string
example: 'Bob the vendor'
readOnly: true
settings:
$ref: '#/components/schemas/CompanySettings'
type: object

View File

@ -9,14 +9,17 @@
description: 'The hashed id of the user id'
type: string
example: Opnel5aKBz
readOnly: true
company_id:
description: 'The hashed id of the company'
type: string
example: Opnel5aKBz
readOnly: true
vendor_id:
description: 'The hashed id of the vendor'
type: string
example: Opnel5aKBz
readOnly: true
first_name:
description: 'The first name of the contact'
type: string
@ -25,6 +28,16 @@
description: 'The last name of the contact'
type: string
example: Windsor
contact_key:
description: 'A unique identifier for the contact'
type: string
example: JD0X52bkfZlJRiroCJ0tcSiAjsJTntZ5uqKdiZ0a
readOnly: true
confirmation_code:
description: 'The confirmation code used to authenticate the contacts email address'
type: string
example: 333-sdjkh34gbasd
readOnly: true
phone:
description: 'The contacts phone number'
type: string
@ -49,6 +62,16 @@
description: 'The contact email address'
type: string
example: harry@windsor.com
email_verified_at:
description: 'The date which the contact confirmed their email'
type: number
format: integer
example: '134341234234'
readOnly: true
password:
description: 'The hashed password of the contact'
type: string
example: '*****'
is_primary:
description: 'Boolean flag determining if the contact is the primary contact for the vendor'
type: boolean