Get started by initialising the project as you would normally.
There are migrations to be run, and also a database seeder. Make sure you run those.
There is an artisan command that has been created to make a user for you to test with (CreateUserCommand). This creates a user with the credentials: test@test.com
/ password
Create an endpoint to create an organisation. A few files will need to be completed for this to work.
- Criteria for completion:
- Request must be validated.
- A user must be logged in to complete the request.
- Organisations should be created with trial period of 30 days.
- An email should be triggered upon organisation creation that send the logged in user a confirmation. (just a plaintext email with the details is perfect for this test.)
- The JSON response should include the user inside of the organisation. Half of this has been completed, you will need to create a transformer for the User and include the data that you believe to be relevant.
- Criteria for completion:
Fix the code that outputs a collection of organisations
- Use the transformer to return the data (hint: transformCollection)
- The endpoint should be able to take a http query param of filter, which can be
subbed
,trial
orall
. If not included,all
is the default case. - Abstract the controller logic into the service
- Code must adhere to PSR12 standards.
- All datetimes returned must be in unix timestamps.
- Code should include docblocks.
- Laravel Passport
- Fractal (for transformers)
Thanks for the time given to me.
You could not clear the technical round conducted by Clubwise – Nashik, Maharashtra.
As requested, below is the detailed review of your test -
My colleague rates the concerns 5 being a big issue and 1 being relatively trivial. The feedback given was as follows:
- Missing return types (3/5) [AuthController.php l:28 for example]
- Validation not using request classes and extending logic in controllers (3/5)
- Odd way of generating access token (3/5)
- Added unecessary extra logic to return responses with `JsonApiResponse.php`. Methods are very similar to each other however it just feels like added blob that doesn't help make anything more accessible. (4/5)
- Wrong usage of transformers (base code is pretty much ready to with very little effort use transformers properly) (4/5)
- Using base php function to send email instead of Laravel wrapper with classes (also seems very much like copy&paste code) (5/5)
- Using $_GET which is unfiltered and not escaped input instead of normal way of using request classes from Laravel to access user input (5/5)
- Getting all organisations loaded into memory and only them filter which entries go to output is a terrible solution if the organisation table ever gets slightly big (5/5)
- Getting all organisations even if the currently logged in user shouldn't have access to an organisation (5/5)
- Inconsistent double or triple equals comparisons (3/5)
- Does not block requests that send a filter that isn't supported, instead pretends that no filter was passed (4/5)
- PSR-12 isn't completely followed, using `phpcs --standard=psr12 app/` would've thrown the errors (no big deal, easy to learn and adjust, most of the errors were by using tabs and not spaces) (1/5)
No comments:
Post a Comment