-
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.
- Loading branch information
0 parents
commit d6c9d6a
Showing
62 changed files
with
29,091 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
5053,eyJpdiI6InZMODJaMjVyZXZhaUREaDVkc01TM0E9PSIsInZhbHVlIjoicGR5QlZ1b09LWW13WHVqdXlJSWxvZz09IiwibWFjIjoiNjk0NzBlYjAxNTU4NTdjNDA0ZjY5YzVkN2I3MDU5ZWVjZDg1N2U2ZmFmNWU0ZmUyZWQ3MjRiODg5ZWYzODhiOSJ9,https://app.codeaid.io | ||
// ///////////////////////////////////////////////////////////////////////////// | ||
// IMPORTANT: | ||
// THIS FILE IS READ ONLY, DO NOT MODIFY IT IN ANY WAY AS THAT WILL RESULT IN A TEST FAILURE | ||
// ///////////////////////////////////////////////////////////////////////////// |
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,16 @@ | ||
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. | ||
# For additional information regarding the format and rule options, please see: | ||
# https://github.com/browserslist/browserslist#queries | ||
|
||
# For the full list of supported browsers by the Angular framework, please see: | ||
# https://angular.io/guide/browser-support | ||
|
||
# You can see what browsers were selected by your queries by running: | ||
# npx browserslist | ||
|
||
last 1 Chrome version | ||
last 1 Firefox version | ||
last 2 Edge major versions | ||
last 2 Safari major versions | ||
last 2 iOS major versions | ||
Firefox ESR |
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,16 @@ | ||
# Editor configuration, see https://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.ts] | ||
quote_type = single | ||
|
||
[*.md] | ||
max_line_length = off | ||
trim_trailing_whitespace = false |
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,48 @@ | ||
# See http://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# Compiled output | ||
/dist | ||
/tmp | ||
/out-tsc | ||
/bazel-out | ||
|
||
# Node | ||
/node_modules | ||
npm-debug.log | ||
yarn-error.log | ||
|
||
# IDEs and editors | ||
.idea/ | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# Visual Studio Code | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
.history/* | ||
|
||
# Miscellaneous | ||
/.angular/cache | ||
.sass-cache/ | ||
/connect.lock | ||
/coverage | ||
/libpeerconnection.log | ||
testem.log | ||
/typings | ||
|
||
# System files | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# SonarQube | ||
.scannerwork/ | ||
|
||
# jest-junit | ||
junit.xml |
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,53 @@ | ||
# Football League Web UI | ||
|
||
Welcome to the Football League Web UI project. The goal of the project is to build a browser based web frontend SPA that gets the data about match schedule/results from the backend and then computes leaderboard based on the rules explained in the challenge description. | ||
|
||
## Install Dependencies | ||
|
||
In order to install project dependencies run: | ||
|
||
> **npm** install | ||
## Running Backend Mock Server | ||
|
||
In order to work on the frontend application we have provided a simple mock database server. | ||
|
||
To run the mock server run the following command: | ||
|
||
> **npx** json-fake-server -m dev-mock-server-config.json | ||
After this you would be able to access backend at http://localhost:3001. To verify if the server is running you can run: | ||
|
||
> **curl** http://localhost:3001/api/version | ||
The response should be `{"success": true, "version": "1.0"}` | ||
|
||
**IMPORTANT:** If you need to change default backend port, make sure to revert them back to 3001 before submitting the solution as otherwise the grading system might not detect the backend server and you will lose points. | ||
|
||
## Running Frontend Application | ||
|
||
The following command will run the SPA in local dev server: | ||
|
||
> **npm** start | ||
The application will be available at http://localhost:3000 and by default you should see a welcome message there. | ||
|
||
## Production Build | ||
|
||
In order to prepare production build you need to run: | ||
|
||
> **npm** run build | ||
It is important to make sure that code can be built for production succesfully before submitting the solution. | ||
|
||
## Run tests | ||
|
||
The test file to verify src/app/services/league.service.ts is located at tests/leaderboard.test.ts. Feel free to modify the code there in order to test your work. | ||
It is important to implement all methods on src/app/services/league.service.ts and TO NOT CHANGE the interface of them. | ||
|
||
To run the tests just run this command. | ||
|
||
```shell | ||
npm test | ||
``` | ||
|
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,117 @@ | ||
{ | ||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json", | ||
"cli": { | ||
"analytics": false | ||
}, | ||
"version": 1, | ||
"newProjectRoot": "projects", | ||
"projects": { | ||
"league-table": { | ||
"projectType": "application", | ||
"schematics": { | ||
"@schematics/angular:component": { | ||
"style": "scss" | ||
}, | ||
"@schematics/angular:application": { | ||
"strict": true | ||
} | ||
}, | ||
"root": "", | ||
"sourceRoot": "src", | ||
"prefix": "app", | ||
"architect": { | ||
"build": { | ||
"builder": "@angular-devkit/build-angular:browser", | ||
"options": { | ||
"outputPath": "./dist", | ||
"index": "src/index.html", | ||
"main": "src/main.ts", | ||
"polyfills": "src/polyfills.ts", | ||
"tsConfig": "tsconfig.app.json", | ||
"inlineStyleLanguage": "scss", | ||
"assets": [ | ||
"src/favicon.ico", | ||
"src/assets" | ||
], | ||
"styles": [ | ||
"src/styles.scss" | ||
], | ||
"scripts": [] | ||
}, | ||
"configurations": { | ||
"production": { | ||
"budgets": [ | ||
{ | ||
"type": "initial", | ||
"maximumWarning": "500kb", | ||
"maximumError": "1mb" | ||
}, | ||
{ | ||
"type": "anyComponentStyle", | ||
"maximumWarning": "2kb", | ||
"maximumError": "40kb" | ||
} | ||
], | ||
"fileReplacements": [ | ||
{ | ||
"replace": "src/environments/environment.ts", | ||
"with": "src/environments/environment.prod.ts" | ||
} | ||
], | ||
"outputHashing": "all" | ||
}, | ||
"development": { | ||
"buildOptimizer": false, | ||
"optimization": false, | ||
"vendorChunk": true, | ||
"extractLicenses": false, | ||
"sourceMap": true, | ||
"namedChunks": true | ||
} | ||
}, | ||
"defaultConfiguration": "production" | ||
}, | ||
"serve": { | ||
"builder": "@angular-devkit/build-angular:dev-server", | ||
"options": { | ||
"port": 3000 | ||
}, | ||
"configurations": { | ||
"production": { | ||
"browserTarget": "league-table:build:production" | ||
}, | ||
"development": { | ||
"browserTarget": "league-table:build:development" | ||
} | ||
}, | ||
"defaultConfiguration": "development" | ||
}, | ||
"extract-i18n": { | ||
"builder": "@angular-devkit/build-angular:extract-i18n", | ||
"options": { | ||
"browserTarget": "league-table:build" | ||
} | ||
}, | ||
"test": { | ||
"builder": "@angular-devkit/build-angular:karma", | ||
"options": { | ||
"main": "src/test.ts", | ||
"polyfills": "src/polyfills.ts", | ||
"tsConfig": "tsconfig.spec.json", | ||
"karmaConfig": "karma.conf.js", | ||
"inlineStyleLanguage": "scss", | ||
"assets": [ | ||
"src/favicon.ico", | ||
"src/assets" | ||
], | ||
"styles": [ | ||
"src/styles.scss" | ||
], | ||
"scripts": [] | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"defaultProject": "league-table" | ||
} |
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,3 @@ | ||
module.exports = { | ||
presets: [["@babel/preset-env", { targets: { node: "current" } }]], | ||
}; |
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,96 @@ | ||
{ | ||
"port": 3001, | ||
"host": "0.0.0.0", | ||
"authorization": { | ||
"type": "headers" | ||
}, | ||
"api": [ | ||
{ | ||
"method": "GET", | ||
"path": "/api/v1/getAllMatches", | ||
"response": { | ||
"success": true, | ||
"matches": [ | ||
{ | ||
"matchDate": 1651744228685, | ||
"stadium": "Maracanã", | ||
"homeTeam": "Brazil", | ||
"awayTeam": "Serbia", | ||
"matchPlayed": true, | ||
"homeTeamScore": 1, | ||
"awayTeamScore": 0 | ||
}, | ||
{ | ||
"matchDate": 1651744228685, | ||
"stadium": "Stade de Suisse", | ||
"homeTeam": "Switzerland", | ||
"awayTeam": "Serbia", | ||
"matchPlayed": true, | ||
"homeTeamScore": 2, | ||
"awayTeamScore": 2 | ||
}, | ||
{ | ||
"matchDate": 1651744228685, | ||
"stadium": "Stadion Rajko Mitic", | ||
"homeTeam": "Serbia", | ||
"awayTeam": "Cameroon", | ||
"matchPlayed": true, | ||
"homeTeamScore": 0, | ||
"awayTeamScore": 1 | ||
}, | ||
{ | ||
"matchDate": 1651744228685, | ||
"stadium": "Maracanã", | ||
"homeTeam": "Brazil", | ||
"awayTeam": "Switzerland", | ||
"matchPlayed": true, | ||
"homeTeamScore": 3, | ||
"awayTeamScore": 0 | ||
}, | ||
{ | ||
"matchDate": 1651744228685, | ||
"stadium": "Maracanã", | ||
"homeTeam": "Brazil", | ||
"awayTeam": "Cameroon", | ||
"matchPlayed": true, | ||
"homeTeamScore": 4, | ||
"awayTeamScore": 4 | ||
}, | ||
{ | ||
"matchDate": 1651744228685, | ||
"stadium": "Stade de Suisse", | ||
"homeTeam": "Switzerland", | ||
"awayTeam": "Cameroon", | ||
"matchPlayed": true, | ||
"homeTeamScore": 2, | ||
"awayTeamScore": 2 | ||
} | ||
] | ||
}, | ||
"authorization": { | ||
"unauthorized": { | ||
"success": false, | ||
"error": "Unauthorized Access." | ||
}, | ||
"status": 401, | ||
"token": "YuHBdSlDXY000xa8IlCm7Qgq4_s" | ||
} | ||
}, | ||
{ | ||
"method": "GET", | ||
"path": "/api/v1/getAccessToken", | ||
"response": { | ||
"success": true, | ||
"access_token": "YuHBdSlDXY000xa8IlCm7Qgq4_s" | ||
} | ||
}, | ||
{ | ||
"method": "GET", | ||
"path": "/api/version", | ||
"response": { | ||
"success": true, | ||
"version": "1.0" | ||
} | ||
} | ||
] | ||
} |
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,24 @@ | ||
module.exports = { | ||
preset: "jest-preset-angular", | ||
testEnvironment: "jsdom", | ||
roots: [ | ||
"<rootDir>" | ||
], | ||
testMatch: [ | ||
"**/__tests__/**/*.+(ts|tsx|js)", | ||
"**/?(*.)+(spec|test).+(ts|tsx|js)" | ||
], | ||
transform: { | ||
"^.+\\.(ts|tsx)$": "ts-jest" | ||
}, | ||
setupFilesAfterEnv: [ | ||
'jest-extended', | ||
'jest-preset-angular/setup-jest' | ||
], | ||
globals: { | ||
'ts-jest': { | ||
isolatedModules: false, | ||
}, | ||
}, | ||
testTimeout: 5000 | ||
} |
Oops, something went wrong.