This repository has been archived by the owner on Mar 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from sanstzu/dev
Application Skeleton
- Loading branch information
Showing
49 changed files
with
23,491 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,169 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.pnpm-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
web_modules/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional stylelint cache | ||
.stylelintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variable files | ||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# vuepress v2.x temp and cache directory | ||
.temp | ||
.cache | ||
|
||
# Docusaurus cache and generated files | ||
.docusaurus | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v2 | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
# database volume | ||
backend/database/volume | ||
|
||
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files | ||
|
||
# dependencies | ||
node_modules/ | ||
|
||
# Expo | ||
.expo/ | ||
dist/ | ||
web-build/ | ||
|
||
# Native | ||
*.orig.* | ||
*.jks | ||
*.p8 | ||
*.p12 | ||
*.key | ||
*.mobileprovision | ||
|
||
# Metro | ||
.metro-health-check* | ||
|
||
# debug | ||
npm-debug.* | ||
yarn-debug.* | ||
yarn-error.* | ||
|
||
# macOS | ||
.DS_Store | ||
*.pem | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# typescript | ||
*.tsbuildinfo |
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,9 @@ | ||
DB_ROOT_PASSWORD = | ||
DB_DATABASE = | ||
DB_USER = | ||
DB_PASSWORD = | ||
|
||
DB_UPDATER_AVAILABILITY_FREQUENCY = | ||
DB_UPDATER_PRICE_FREQUENCY = | ||
|
||
API_PORT = |
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,92 @@ | ||
# Backend | ||
|
||
## Setup | ||
|
||
To start the database and database updater using Docker, run the following command from repository root: | ||
|
||
```bash | ||
cd backend | ||
docker-compose up -u | ||
``` | ||
|
||
To start the backend API for development purposes, run the following command from repository root: | ||
|
||
```bash | ||
cd backend/api | ||
npm install | ||
npm run dev | ||
``` | ||
|
||
For production purposes, run the following command from repository root: | ||
|
||
```bash | ||
cd backend/api | ||
npm install | ||
npm run prod | ||
``` | ||
|
||
parking | ||
router.get("/motorized/search", searchMotorizedParking); | ||
router.get("/bicycle/search", searchBicycleParking); | ||
router.get("/motorized/:id", fetchMotorizedParking); | ||
router.get("/bicycle/:id", fetchBicycleParking); | ||
|
||
maps | ||
router.get("/places/search", searchPlace); | ||
router.get("/places/:id", fetchPlace); | ||
|
||
## Backend API | ||
|
||
There are two main routes in the backend API, `/maps` and `/carparks`. | ||
|
||
### `/maps` Route | ||
|
||
| Route | Method | Description | | ||
| --------------------- | ------ | ---------------------------------------- | | ||
| `/maps/places/search` | `GET` | Search for places based on given keyword | | ||
| `/maps/places/:id` | `GET` | Fetch a place based on given ID | | ||
|
||
### `/parking` Route | ||
|
||
| Route | Method | Description | | ||
| --------------------------- | ------ | ------------------------------------------------------ | | ||
| `/parking/motorized/search` | `GET` | Search for motorized parking based on given coordinate | | ||
| `/parking/bicycle/search` | `GET` | Search for bicycle parking based on given coordinate | | ||
| `/parking/motorized/:id` | `GET` | Fetch a motorized parking details based on given ID | | ||
| `/parking/bicycle/:id` | `GET` | Fetch a bicycle parking details based on given ID | | ||
|
||
## Database | ||
|
||
The initialized database contains two tables, `MotorizedParking` and `ParkingPrice`. | ||
|
||
The `MotorizedParking` table contains the following columns: | ||
|Column Name|Type|Description| | ||
|---|---|---| | ||
|`CarParkID`|`VARCHAR(25)`|Unique identifier for a car park| | ||
|`LotType`|`VARCHAR(1)`|Type of parking lot, either `C` for car, `Y` for motorcycle, 'H' for heavy vehicles| | ||
|`Coordinate`|`POINT`|Coordinates of the car park (`SRID 4326`)| | ||
|`Development`|`VARCHAR(150)`|Name of the car park| | ||
|`AvailableLots`|`INT`|Number of available lots in the car park| | ||
|`Agency`|`VARCHAR(3)`|Agency that manages the car park| | ||
|`CreatedOn`|`DATETIME`|Timestamp of when the car park was created| | ||
|`UpdatedOn`|`DATETIME`|Timestamp of when the car park was last updated| | ||
|
||
\ | ||
The `ParkingPrice` table contains the following columns: | ||
|Column Name|Type|Description| | ||
|---|---|---| | ||
|`CarParkID`|`VARCHAR(25)`|Unique identifier for a car park | | ||
|`LotType`|`VARCHAR(1)`|Type of parking lot, either `C` for car, `Y` for motorcycle, 'H' for heavy vehicles| | ||
|`Day`|`VARCHAR(10)`|Day of the week, either `mon`, `tue`, `wed`, `thu`, `fri`, `sat`, `sun`| | ||
|`StartTime`|`TIME`|Start time of the parking price| | ||
|`EndTime`|`TIME`|End time of the parking price| | ||
|`Price`|`DECIMAL(5,2)`|Price of the parking price| | ||
|`IsSingleEntry`|`BOOLEAN`|Whether the parking price is for single entry or multiple entry| | ||
|`CreatedOn`|`DATETIME`|Timestamp of when the parking price was created| | ||
|`UpdatedOn`|`DATETIME`|Timestamp of when the parking price was last updated| | ||
|
||
## Database Updater | ||
|
||
The database updater uses Node.js in TypeScript to update the database with the latest car park information from several dynamic sources and also static sources. | ||
|
||
The frequency of updates is configurable in `backend/.env` with the `DB_UPDATER_AVAILABILITY_FREQUENCY` or `DB_UPDATER_PRICE_FREQUENCY` variables. The default value are 12 seconds and 12 hours respectively. |
Oops, something went wrong.