-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/new-organisation-sign-up-form (#251)
* Updated database ERD * Updated dependencies * Added migration to make update_requests.updateable_id nullable * Update request updateable_type values refactored They now use string constants on the UpdateRequest class. * Test log cleared when tests first ran * Update request observer no longer removes fields for new requests * Update request updateable_id nullable in API docs * Fixed typo * Used scope instead of where clause * Updated API docs with new endpoint * Made update_requests.user_id nullable * Endpoint created with no data * Added request validation * Added store update request logic to controller * Linted code * Added failing test for approving update request * Working test for organisation sign up form approval * Fixed permissions not being set for service * Linted code
- Loading branch information
1 parent
424fa69
commit d4db477
Showing
36 changed files
with
1,570 additions
and
363 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
app/Docs/Operations/OrganisationSignUpForms/StoreOrganisationSignUpFormOperation.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace App\Docs\Operations\OrganisationSignUpForms; | ||
|
||
use App\Docs\Responses\UpdateRequestReceivedResponse; | ||
use App\Docs\Schemas\OrganisationSignUpForm\StoreOrganisationSignUpFormSchema; | ||
use App\Docs\Tags\OrganisationSignUpFormsTag; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\BaseObject; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\MediaType; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Operation; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\RequestBody; | ||
|
||
class StoreOrganisationSignUpFormOperation extends Operation | ||
{ | ||
/** | ||
* @param string|null $objectId | ||
* @throws \GoldSpecDigital\ObjectOrientedOAS\Exceptions\InvalidArgumentException | ||
* @return static | ||
*/ | ||
public static function create(string $objectId = null): BaseObject | ||
{ | ||
return parent::create($objectId) | ||
->action(static::ACTION_POST) | ||
->tags(OrganisationSignUpFormsTag::create()) | ||
->summary('Submit an organisation sign up form') | ||
->description('**Permission:** `Open`') | ||
->noSecurity() | ||
->requestBody( | ||
RequestBody::create() | ||
->required() | ||
->content( | ||
MediaType::json()->schema( | ||
StoreOrganisationSignUpFormSchema::create() | ||
) | ||
) | ||
) | ||
->responses( | ||
UpdateRequestReceivedResponse::create(null, StoreOrganisationSignUpFormSchema::create()) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
app/Docs/Paths/OrganisationSignUpForms/OrganisationSignUpFormsRootPath.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace App\Docs\Paths\OrganisationSignUpForms; | ||
|
||
use App\Docs\Operations\OrganisationSignUpForms\StoreOrganisationSignUpFormOperation; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\BaseObject; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\PathItem; | ||
|
||
class OrganisationSignUpFormsRootPath extends PathItem | ||
{ | ||
/** | ||
* @param string|null $objectId | ||
* @return static | ||
*/ | ||
public static function create(string $objectId = null): BaseObject | ||
{ | ||
return parent::create($objectId) | ||
->route('/organisation-sign-up-forms') | ||
->operations( | ||
StoreOrganisationSignUpFormOperation::create() | ||
); | ||
} | ||
} |
94 changes: 94 additions & 0 deletions
94
app/Docs/Schemas/OrganisationSignUpForm/StoreOrganisationSignUpFormSchema.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
|
||
namespace App\Docs\Schemas\OrganisationSignUpForm; | ||
|
||
use App\Docs\Schemas\Organisation\StoreOrganisationSchema; | ||
use App\Docs\Schemas\Service\StoreServiceSchema; | ||
use App\Docs\Schemas\User\StoreUserSchema; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\BaseObject; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Schema; | ||
|
||
class StoreOrganisationSignUpFormSchema extends Schema | ||
{ | ||
/** | ||
* @param string|null $objectId | ||
* @throws \GoldSpecDigital\ObjectOrientedOAS\Exceptions\InvalidArgumentException | ||
* @return static | ||
*/ | ||
public static function create(string $objectId = null): BaseObject | ||
{ | ||
return parent::create($objectId) | ||
->type(static::TYPE_OBJECT) | ||
->required( | ||
'user', | ||
'organisation', | ||
'service' | ||
) | ||
->properties( | ||
StoreUserSchema::create('user') | ||
->required( | ||
...array_filter( | ||
StoreUserSchema::create()->required, | ||
function (string $required): bool { | ||
return !in_array($required, ['roles']); | ||
} | ||
) | ||
) | ||
->properties( | ||
...array_filter( | ||
StoreUserSchema::create()->properties, | ||
function (Schema $property): bool { | ||
return !in_array($property->objectId, ['roles']); | ||
} | ||
) | ||
), | ||
StoreOrganisationSchema::create('organisation') | ||
->properties( | ||
...array_filter( | ||
StoreOrganisationSchema::create()->properties, | ||
function (Schema $property): bool { | ||
return !in_array($property->objectId, ['logo_file_id']); | ||
} | ||
) | ||
), | ||
StoreServiceSchema::create('service') | ||
->required( | ||
...array_filter( | ||
StoreServiceSchema::create()->required, | ||
function (string $required): bool { | ||
return !in_array($required, [ | ||
'organisation_id', | ||
'status', | ||
'show_referral_disclaimer', | ||
'referral_method', | ||
'referral_button_text', | ||
'referral_email', | ||
'referral_url', | ||
'gallery_items', | ||
'category_taxonomies', | ||
]); | ||
} | ||
) | ||
) | ||
->properties( | ||
...array_filter( | ||
StoreServiceSchema::create()->properties, | ||
function (Schema $property): bool { | ||
return !in_array($property->objectId, [ | ||
'organisation_id', | ||
'status', | ||
'show_referral_disclaimer', | ||
'referral_method', | ||
'referral_button_text', | ||
'referral_email', | ||
'referral_url', | ||
'logo_file_id', | ||
'gallery_items', | ||
'category_taxonomies', | ||
]); | ||
} | ||
) | ||
) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace App\Docs\Tags; | ||
|
||
use GoldSpecDigital\ObjectOrientedOAS\Objects\BaseObject; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Tag; | ||
|
||
class OrganisationSignUpFormsTag extends Tag | ||
{ | ||
/** | ||
* @param string|null $objectId | ||
* @return static | ||
*/ | ||
public static function create(string $objectId = null): BaseObject | ||
{ | ||
return parent::create($objectId) | ||
->name('Organisation Sign Up Forms'); | ||
} | ||
} |
Oops, something went wrong.