For this assessment, you can create a new laravel project and either post it on github or a local zip
- Create a route for
POST
->/api/campaign/create
- Create a controller for
CampaignController.php
with the API resource methods - Create a model for campaigns table and update the campaign controller to create, update, and delete
- Within
CampaignController
create method forindex
and query the campaign model forstatus
=active
return the results - Create a database migration for the
campaigns
table
Campaigns table:
- id
- name
- order (int)
- type
- status
- start_date
You can either do this in a service method or model, but write a query within a method called findActiveCampaigns
and return results from the following query:
status = active
type != rvm
- order by
order
field descending - Only return 10 items
You can write this as a database migration.
There are 100 million rows in the database, and you need to update all of them with the following logic:
- For each campaign, you need ot run this method and update the campaign
start_date
with the date returned from this method: $startDate = CampaignService::filter()->requestStartDate($campaignId);
Note: the php script has no timeout, so how ever long it takes for the query to run is not relevant.