Git Product home page Git Product logo

affiliate_invites_tech_test's Introduction

Description

This is a basic system with one html page. used cdn boostrap to make look a little better. Have one route that has XSS stripping and HTTP Headers under the middleware. Using Service and Action pattern. Have a global try catch. That emails if any exception occurs. Using Laravel 10 with single welcome blade file.

Also included a Feature and 2 Unit tests for this project.

Middleware added

app\Http\Middleware\XssSanitization.php

app\Http\Middleware\SecureHeaders.php

Mailing/Error Handling

app\Exceptions\Handler.php app\Mail\ErrorAlert.php

resources\views\emails\error_alert.blade.php

Steps to use the api from Testing to Postman

Step 1 - git clone https://github.com/marcovie/affiliate_invites_tech_test

https://github.com/marcovie/affiliate_invites_tech_test

Step 2 - "composer install"

Step 3 - Make copy of the ".env.example" file and change the copy name to .env open 
file and change settings required.

Step 4 - Update in .env file the "APP_DEV_EMAIL" to a dev email to so that if any errors occur 
you can see the email for it.

Step 5 - For full experience if Critical errors occur create account on "https://mailtrap.io/" 
and put username and password into .env file but not required as shouldnt have Critical error 
but it is there if needed.

Step 6 - No DB is needed for this task.

Step 7 - In command prompt in the root of this laravel project. Run this commands below:

Step 8 - "php artisan key:generate"

Step 9 - Either run clearcache.bat if on windows or can run following commands
php artisan cache:clear
php artisan route:clear
php artisan view:clear

php artisan route:cache
php artisan config:cache
php artisan view:cache

php artisan clear-compiled 
composer dump-autoload
php artisan optimize

Step 10 - "php artisan serve" - Which should give you url -> "http://127.0.0.1:8000"
By Default area is set to 100 km. The Dublin Lat/Lon is set in AffiliateService as public 
variable.

Step 11 - To run tests go to command prompt run: "php artisan test" to get tests to run. 
(Make sure composer install has run)

Must have Requirements

Dev Code Test

The JSON-encoded affiliates.txt file attached contains a shortlist of affiliate contact records - one per line. Stored under "storage\app\public\affiliate_list\affiliates.txt"

We want to invite any affiliates that lives within 100km of office for some food and drinks using this text file as the input (without being altered).

Task

Write a program that will read the full list of affiliates from this txt file and output the name and IDs of matching affiliates within 100km, sorted by Affiliate ID (ascending).

You can use the first formula from this Wikipedia article to calculate distance. Don't forget, you'll need to convert degrees to radians.

The GPS coordinates for Office are 53.3340285, -6.2535495.

You can find the affiliate list in this repository called affiliates.txt. Stored under "storage\app\public\affiliate_list\affiliates.txt"

Please don’t forget, your code should be production ready, clean and tested!

Nice to haves:

  • Demonstrate understanding of MVC
  • Unit Tests
  • Basic HTML output
  • Usage of a PHP Framework (Laravel)
  • Use the original txt file as input

affiliate_invites_tech_test's People

Contributors

marcovie avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.