{"id":17683211,"url":"https://github.com/nemanjam/eurovision","last_synced_at":"2025-03-30T19:49:04.955Z","repository":{"id":102334590,"uuid":"166677889","full_name":"nemanjam/eurovision","owner":"nemanjam","description":"Eurovision voting test task.","archived":false,"fork":false,"pushed_at":"2022-11-10T17:43:39.000Z","size":290,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-05T22:46:33.019Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://laravel-angular-eurovision.herokuapp.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nemanjam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-20T15:38:55.000Z","updated_at":"2022-10-09T18:41:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"bdedd85c-d5f3-490a-a4cb-32f5b9a13b87","html_url":"https://github.com/nemanjam/eurovision","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemanjam%2Feurovision","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemanjam%2Feurovision/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemanjam%2Feurovision/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemanjam%2Feurovision/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nemanjam","download_url":"https://codeload.github.com/nemanjam/eurovision/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246372501,"owners_count":20766627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-24T09:44:40.431Z","updated_at":"2025-03-30T19:49:04.935Z","avatar_url":"https://github.com/nemanjam.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Instructions (English)\n\nProject is done using angular 7 frontend and laravel 5.4 backend. I used 5.4 because at the moment I have php 5.6 on my machine, and also I saw that [https://chinesepod.com](https://chinesepod.com) is running on php 5.6.\n\nAll functionalities from assignment are working, demo can be seen on [http://laravel-angular-eurovision.herokuapp.com](http://laravel-angular-eurovision.herokuapp.com), the list of functionalities is following:\n\n\n### Angular\n\n* router with 4 pages `home`, `countries`, `countries/country` and `results`\n* voting, disabling countries that already voted in the list\n* filtering country that is voted for and countries that already voted from the options of the select control\n* template driven form with validation\n* report with scores list and matrix with voting overview \n* reset votes link for removing all the votes and voting all over again\n\n### Laravel\n\n* CORS middleware for frontend on another domain which can be disabled in `app\\http\\kernel.php`\n* 2 tables, countries and votes, and eloquent models with foreign key\n* migrations and seed\n* CountryController with 3 services\n  * index() which returns all countries with all votes, `/api/countries` route\n  * update() service which validates and receives votes for given country, `/api/countries/{name_id}` route\n  * destroy() which resets all the votes for all the countries, `/api/reset` route\n\n### List of bugs:\n* the select control is loosing the view of selected country while options list is filtered which is needed for the following controls. Value is kept and the form is submitted correctly. Solution can be in reactive angular forms instead template driven or using 3rd party control which is not build on top of the native html select control\n  \n***\n\n## Installation and running (Windows)\n\n### Requirements\n\n* php 5.6\n* postgresql or mysql\n* apache2\n* node and npm\n* composer\n\n\n## Laravel setup\n\n### Install dependencies:\n\nFrom the root laravel folder (`laravel-eurovision`) install dependencies with: \n\n`composer install`\n\n### Create virtual host:\n\nFor apache2 in `httpd-vhosts.conf` file add the following:  \n\n```\n\u003cVirtualHost 127.0.0.7:80\u003e\n\tDocumentRoot \"C:/xampp/htdocs/1/eurovision/laravel-eurovision/public\" # absolute path to the laravels /public folder \n\tServerName laravel-eurovision.app \t# domain\n\tServerAlias www.laravel-eurovision.app  # domain\n\t\u003cDirectory \"C:/xampp/htdocs/1/eurovision/laravel-eurovision/public\"\u003e # absolute path to the laravels /public folder\n\t\tDirectoryIndex index.php\n\t\tAllowOverride All\n\t\tOrder allow,deny\n\t\tAllow from all\n\t\u003c/Directory\u003e\n\u003c/VirtualHost\u003e\n```\n\nIn the hosts file add mapping domain to IP:\n\n`127.0.0.7   laravel-eurovision.app`\n\nRestart apache2.\n\nIn `.env` file set the domain:\n`APP_URL=http://laravel-eurovision.app`\n\n### Create database:\n\nCreate database using phppgadmin or phpmyadmin. I used postgresql dbms. Then in `.env` file add credentials, for example:\n \n```\nDB_CONNECTION=pgsql\nDB_HOST=127.0.0.1\nDB_DATABASE=eurovisiondb\nDB_USERNAME=postgres\nDB_PASSWORD=root\n```\nRun migrations:\n\n`php artisan migrate`\n\nSeed database:\n\n`php artisan db:seed --class=CountriesTableSeeder`\n\n***\n\n## Angular setup\n\n### Install dependencies:\n\nFrom the root angular folder (`ng-eurovision`) in console run:\n\n`npm install`\n\n### Set laravel api endpoint:\n\nIn the `environments/environment.ts` file set `app_url` to the laravel domain + `'/api'`, for example:\n\n`api_url: 'http://laravel-eurovision.app/api'`\n\n### Run the application:\n\nFrom the root angular folder run:\n\n`ng serve`\n\nNow the angular application should be available on link `http://localhost:4200`\n\n## Author\n\nNemanja Mitic, 20. 1. 2019.\n\n***\n***\n\n\n# Uputstvo (Srpsko-Hrvatski)\n\nProjekat je radjen u angular 7 frontend i laravel 5.4 backend. 5.4 sam koristio jer trenutno imam php 5.6 na racunaru, a i [https://chinesepod.com](https://chinesepod.com) sam video da je na php 5.6. \n\nSve funkcionalnosti iz zadatka rade, demo se moze videti na [http://laravel-angular-eurovision.herokuapp.com](http://laravel-angular-eurovision.herokuapp.com), lista funkcionalnosti je sledeca:\n\n### Angular\n\n* ruter sa 4 stranice `home`, `countries`, `countries/country` i `results`\n* glasanje, disabliranje zemalja koje su vec glasale u listi\n* uklanjanje zemlje za koju se glasa i zemalja koje su glasale iz opcija select kontrole\n* template driven forma sa validacijom\n* izvestaj sa listom poena i matrica sa pregledom glasanja\n* reset votes link za brisanje svih glasova za glasanje iz pocetka\n\n### Laravel\n\n* CORS middleware za frontend sa drugog domena koji se po potrebi moze iskljuciti u `app\\http\\kernel.php`\n* 2 tabele, countries i votes, i eloquent modeli sa stranim kljucem\n* migracije i seed\n* CountryController sa 3 servisa\n  * index() koji vraca sve zemlje sa svim glasovima, `/api/countries` ruta\n  * update() servis koji validira i prihvata glasove za odredjenu zemlju, `/api/countries/{name_id}` ruta\n  * destroy() koji resetuje sve glasove za sve zemlje, `/api/reset` ruta\n\n### Lista bugova:\n\n* select kontrola gubi prikaz selektovane zemlje kada se filtrira lista optiona sto je neophodno za sledece kontrole. Inace vrednost je zadrzana i forma je uredno submitovana. Resenje moze biti u reaktivnim angular formama umesto template driven ili koriscenje 3rd party kontrole koja se ne zasniva na native html select.\n  \n***\n\n## Instalacija i pokretanje (Windows)\n\n### Requrements\n\n* php 5.6\n* postgres ili mysql\n* apache2\n* node i npm\n* composer\n\n\n## Laravel setup\n\n### Instalirati zavisnosti:\n\nU root folderu laravela (`laravel-eurovision`) instalirati zavisnosti sa: \n\n`composer install`\n\n### Kreirati virtual host:\n\nU apache2 u `httpd-vhosts.conf` fajlu dodati sledece:  \n\n```\n\u003cVirtualHost 127.0.0.7:80\u003e\n\tDocumentRoot \"C:/xampp/htdocs/1/eurovision/laravel-eurovision/public\" # apsolutna staza do laravelovog /public foldera\n\tServerName laravel-eurovision.app \t# domen\n\tServerAlias www.laravel-eurovision.app  # domen\n\t\u003cDirectory \"C:/xampp/htdocs/1/eurovision/laravel-eurovision/public\"\u003e # apsolutna staza do laravelovog /public foldera\n\t\tDirectoryIndex index.php\n\t\tAllowOverride All\n\t\tOrder allow,deny\n\t\tAllow from all\n\t\u003c/Directory\u003e\n\u003c/VirtualHost\u003e\n```\n\nU hosts fajlu dodati mapiranje domena na IP:\n\n`127.0.0.7   laravel-eurovision.app`\n\nRestartovati apache2.\n\nU `.env` fajlu podesiti domen:\n`APP_URL=http://laravel-eurovision.app`\n\n### Kreirati bazu:\n\nKreirati bazu u pgphpmyadmin ili phpmyadmin. Ja sam koristio postgresql bazu.\nZatim u `.env` fajlu dodati credentials od baze, na primer:\n```\nDB_CONNECTION=pgsql\nDB_HOST=127.0.0.1\nDB_DATABASE=eurovisiondb\nDB_USERNAME=postgres\nDB_PASSWORD=root\n```\nPokrenuti migracije:\n\n`php artisan migrate`\n\nSeedovati bazu:\n\n`php artisan db:seed --class=CountriesTableSeeder`\n\n***\n\n## Angular setup\n\n### Instalirati zavisnosti:\n\nU konzoli u root folderu angulara (`ng-eurovision`) pokrenuti:\n\n`npm install`\n\n### Podesiti laravel api endpoint:\n\nU fajlu `environments/environment.ts` podesiti `app_url` do laravel domena + `'/api'`, npr:\n\n`api_url: 'http://laravel-eurovision.app/api'`\n\n### Pokrenuti aplikaciju:\n\nU konzoli u root folderu angulara pokrenuti:\n\n`ng serve`\n\nSada bi angular aplikacija trebala biti dostupna na linku `http://localhost:4200`\n\n## Autor\n\nNemanja Mitic, 20. 1. 2019.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnemanjam%2Feurovision","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnemanjam%2Feurovision","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnemanjam%2Feurovision/lists"}