{"id":18496743,"url":"https://github.com/agh-cs-imbeciles/train-transport-management-system","last_synced_at":"2026-04-08T11:31:35.269Z","repository":{"id":147621902,"uuid":"617445602","full_name":"agh-cs-imbeciles/train-transport-management-system","owner":"agh-cs-imbeciles","description":"Train transport management system","archived":false,"fork":false,"pushed_at":"2023-06-14T11:24:13.000Z","size":255,"stargazers_count":1,"open_issues_count":9,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-16T00:49:38.882Z","etag":null,"topics":["database","es6","es6-javascript","express","javascript","mongodb","mongodb-atlas","mongoose","nosql","nosql-database","react","reactjs","scss","typescript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agh-cs-imbeciles.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-03-22T12:12:03.000Z","updated_at":"2023-07-25T09:38:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"54b1b93d-a90e-4f28-9914-ecc94f6a4f0b","html_url":"https://github.com/agh-cs-imbeciles/train-transport-management-system","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/agh-cs-imbeciles/train-transport-management-system","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agh-cs-imbeciles%2Ftrain-transport-management-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agh-cs-imbeciles%2Ftrain-transport-management-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agh-cs-imbeciles%2Ftrain-transport-management-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agh-cs-imbeciles%2Ftrain-transport-management-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agh-cs-imbeciles","download_url":"https://codeload.github.com/agh-cs-imbeciles/train-transport-management-system/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agh-cs-imbeciles%2Ftrain-transport-management-system/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31554008,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T10:21:54.569Z","status":"ssl_error","status_checked_at":"2026-04-08T10:21:38.171Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["database","es6","es6-javascript","express","javascript","mongodb","mongodb-atlas","mongoose","nosql","nosql-database","react","reactjs","scss","typescript"],"created_at":"2024-11-06T13:31:19.519Z","updated_at":"2026-04-08T11:31:35.238Z","avatar_url":"https://github.com/agh-cs-imbeciles.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Trainly\nTrain transport management system\n\n## Authors\n- [Jakub Szaredko](https://github.com/Szaroslav)\n- [Piotr Kuchta](https://github.com/kpiotr6)\n- [Mateusz Knap](https://github.com/MatoKnap)\n\n## Introduction\nThe train transport management system, which provides basic rail routes listing and reservations.\n\n### Used technologies and tools\n- `React`\n- `SCSS`\n- `ExpressJS`\n- `MongoDB`\n\nDocumentation:\n## Backend\n\n`Express` backend application\n\n#### Build on machine with\n\n`Node.js`: 18.15.0  \n\n`npm`: 9.6.6\n\n\n## Table of contents\n1. [Instructions how to run](#instructions-how-to-run)\n2. [Database](#database)\n    1. [Collections](#collections)\n        1. [Users](#users-collections)\n        2. [Places](#places-collection)\n        3. [Stops](#stops-collection)\n        4. [Trains](#trains-collection)\n        5. [Rail routes](#rail-routes-collection)\n        6. [Reservations](#reservations-collection)\n3. [Backend application](#backend-application)\n    1. [API endpoints](#api-endpoints)\n        1. [Account](#account)\n            1. [Sign-up](#sign-up)\n            2. [Login](#login)\n        2. [Places](#places)\n            - [Insert a new place](#insert-a-new-place)\n            - [Get a place by its ID](#get-a-place-by-its-id)\n            - [Get all places](#get-all-places)\n            - [Get a place by its name](#get-a-place-by-its-name)\n            - [Get all places by their province name](#get-all-places-by-their-province-name)\n        3. [Stops](#stops)\n            - [Insert a new stop](#insert-a-new-stop)\n            - [Get a stop by its ID](#get-a-stop-by-its-id)\n            - [Get all stops](#get-all-stops)\n            - [Get a stop by its name](#get-a-stop-by-its-name)\n            - [Get all stops by their place](#get-all-stops-by-their-place)\n        4. [Trains](#trains)\n            - [Insert a new train](#insert-a-new-train)\n            - [Get a train by its ID](#get-a-train-by-its-id)\n            - [Get a list of selected types seats from selected train](#get-a-seats-by-its-type)\n        5. [Rail routes](#rail-routes)\n            - [Insert a new rail route](#insert-a-new-rail-stop)\n            - [Get a rail route by its ID](#get-a-rail-route-by-its-id)\n            - [Get all rail routes by departure or arrival date and stop IDs](#get-all-rail-routes-by-departure-or-arrival-date-and-stop-ids)\n        6. [Reservations](#reservations)\n            - [Insert a new Reservation](#insert-a-new-train)\n            - [Get a reservation by its ID](#get-a-train-by-its-id)\n            - [Get all reservations by user ID](#get-all-reservations-by-user-id)\n4. [Frontend application](#frontend-application)\n    1. [Components](#components)\n        1. [Base](#base)\n        2. [login_register](#login-register)\n            1. [Login](#login)\n            2. [Register](#register)\n        3. [cockpit](#cockpit)\n            1. [Cockpit](#cockpit-component)\n            2. [cockpit_views](#cockpit-views)\n                1. [ListElement](#listelement)\n                2. [ReservationList](#reservationlist)\n                4. [Reservations](#reservations)\n                5. [SearchPanel](#searchpanel)   \n        4. [ReservationPanel](#reservationpanel)\n            \n\n\n\n## Instructions how to run\n1. Clone the repository\n    ```\n    git@github.com:agh-cs-imbeciles/train-transport-management-system.git\n    ```\n2. Go the _backend_ directory\n    ```\n    cd backend\n    ```\n3. Install node packages\n    ```\n    npm install\n    npm install --save-dev\n    ```\n4. Run development server\n    ```\n    npm run dev\n    ```\n\n\n## Database\nThe database is document-oriented, runned on `MongoDB`, more precisely [MongoDB Atlas](https://www.mongodb.com/atlas/database).\n\n### Collections\nContains __X__ collections.\n\n#### Users collection\nDefines users of the application, clients and staff but without checking their roles.\n\n- Source code: [user.js](./backend/models/user.js)\n- Source code preview:  \n    `UserSchema`\n    ```js\n    {\n        firstName: {\n            type: String,\n            required: [true, 'First name is required'],\n            minLength: [2, 'First name is too short'],\n            maxLength: [32, 'First name is too long'],\n            match: [/^\\p{Lu}\\p{Ll}+$/u, 'First name must be at least 2 characters long, start with uppercase followed by lowercase'],\n            trim: true\n        },\n        lastName: {\n            type: String,\n            required: [true, 'Last name is required'],\n            minLength: [2, 'Last name is too short'],\n            maxLength: [32, 'Last name is too long'],\n            match: [/^\\p{Lu}\\p{Ll}+$/u, 'Last name must be at least 2 characters long, start with uppercase followed by lowercase'],\n            trim: true\n        },\n        email: {\n            type: String,\n            required: [true, 'Email is required'],\n            minLength: [5, 'Email is too short'],\n            maxLength: [128, 'Email name is too long'],\n            match: [/^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$/, 'Email is not valid'],\n            trim: true\n        },\n        password: {\n            type: String,\n            required: [true, 'Password is required']\n        },\n        address: {\n            street: {\n                name: {\n                    type: String,\n                    required: [true, 'Street name is required'],\n                    minLength: [2, 'Street name is too short'],\n                    maxLength: [64, 'Street name is too long'],\n                    trim: true\n                },\n                houseNumber: {\n                    type: String,\n                    required: [true, 'House number is required'],\n                    minLength: [1, 'House number is too short'],\n                    maxLength: [10, 'House number is too long'],\n                    trim: true\n                },\n                apartmentNumber: {\n                    type: String,\n                    required: [true, 'Apartment number is required'],\n                    minLength: [1, 'Apartment number is too short'],\n                    maxLength: [10, 'Apartment number is too long'],\n                    trim: true\n                }  \n            },\n            city: {\n                type: String,\n                required: [true, 'City is required'],\n                minLength: [2, 'City is too short'],\n                maxLength: [32, 'City is too long'],\n                trim: true\n            },\n            zipCode: {\n                type: String,\n                required: [true, 'Zip code is required'],\n                minLength: [1, 'Zip code is too short'],\n                maxLength: [10, 'Zip code is too long'],\n                trim: true\n            }\n        }\n    }\n    ```\n\n#### Places collection\nDefines places - cities, towns and villages.\n\n- Source code: [place.js](./backend/models/place.js)\n- Source code preview:  \n    `PlaceSchema`\n    ```js\n    {\n        name: {\n            type: String,\n            required: [true, 'Name of the place is required'],\n            minLength: [2, 'Name of the place is too short'],\n            maxLength: [48, 'Name of the place is too long'],\n            trim: true\n        },\n        province: {\n            type: String,\n            required: [true, 'Province of the place is required'],\n            minLength: [2, 'Province of the place is too short'],\n            maxLength: [48, 'Province of the place is too long'],\n            trim: true\n        }\n    }\n    ```\n\n#### Stops collection\nDefines stops, contains `placeId`, so that it's combined with `Place` collection.\n\n- Source code: [stops.js](./backend/models/stop.js)\n- Source code preview:  \n    `StopSchema`\n    ```js\n    {\n        name: {\n            type: String,\n            required: [true, 'Name of the stop is required'],\n            minLength: [2, 'Name of the stop is too short'],\n            maxLength: [48, 'Name of the stop is too long'],\n            trim: true\n        },\n        placeId: {\n            type: mongoose.ObjectId,\n            required: [true, 'Place id of the stop is required']\n        }\n    }\n    ```\n\n#### Trains collection\nDefines all currently active trains and their seats.\n\n- Source code: [train.js](./backend/models/train.js)\n- Source code preview:  \n    `TrainSchema`\n    ```js\n    {\n        name: {\n            type: String,\n            required: [true, 'Name is required'],\n            minLength: [1, 'Name is too short'],\n            maxLength: [48, 'Name is too long'],\n            trim: true\n        },\n        types: {\n            type: Map,\n            required: [true, 'Type map is required'],\n            of: Number\n        },\n        manufacturerInfo: {\n            manufacturer: {\n                type: String,\n                required: [true, 'Manufacturer name is required'],\n                minLength: [1, 'Manufacturer name is too short'],\n                maxLength: [48, 'Manufacturer name is too long'],\n                trim: true\n            },\n            model: {\n                type: String,\n                required: [true, 'Model is required'],\n                minLength: [1, 'Model is too short'],\n                maxLength: [32, 'Model is too long'],\n                trim: true\n            },\n            createdAtYear: {\n                type: Number,\n                min: [1804, 'Created at year is lower than 1804'],\n                max: [new Date().getFullYear(), 'Created at year is greater than current year']\n            }\n        },\n        obtainedAtYear: {\n            type: Number,\n            required: [true, 'Obtained at year is required'],\n            min: [2023, 'Obtained at year is lower than 2023'],\n            max: [new Date().getFullYear(), 'Obtained at year is greater than current year']\n        },\n        inspections: [\n            {\n                year: {\n                    type: Number,\n                    required: [true, 'Inspection year is required'],\n                    min: [1804, 'Inspection year is lower than 1804'],\n                    max: [new Date().getFullYear(), 'Inspection year is greater than current year']\n                }\n            }\n        ],\n        seats: {\n            type: Map,\n            of: TrainSeatSchema,\n            required: [true, 'Seats map is required']\n        }\n    }\n    ```\n\n    `TrainSeatSchema`\n    ```js\n    {\n        seatId: {\n            type: String,\n            required: [true, 'Seat ID is required'],\n            minLength: [1, 'Seat ID is too short'],\n            maxLength: [16, 'Seat ID is too long'],\n            trim: true\n        },\n        types: {\n            type: Map,\n            of: Number\n        },\n        position: {\n            row: {\n                type: Number,\n                required: [true, 'Seat row is required'],\n                min: [1, 'Seat row is too low'],\n                max: [512, 'Seat row is too high']\n            },\n            column: {\n                type: Number,\n                required: [true, 'Seat column is required'],\n                min: [1, 'Seat column is too low'],\n                max: [32, 'Seat column is too high']\n            }\n        }\n    }\n    ```\n\n#### Rail routes collection\nDefines all currently on- or furthergoing rail routes.\n\n- Source code: [railRoute.js](./backend/models/railRoute.js)\n- Source code preview:  \n    `RailRouteSchema`\n    ```js\n    {\n        trainId: {\n            type: mongoose.ObjectId,\n            required: [true, 'Train ID of the rail route is required']\n        },\n        ticketsCost: {\n            type: Map,\n            of: Number,\n            required: [true, 'Tickets cost map of the rail route is required']\n        },\n        departure: {\n            stopId: {\n                type: mongoose.ObjectId,\n                required: [true, 'Departure stop ID of the rail route is required']\n            },\n            date: {\n                type: Date,\n                required: [true, 'Departure stop of the rail is required']\n            }\n        },\n        arrival: {\n            stopId: {\n                type: mongoose.ObjectId,\n                required: [true, 'Arrival stop ID of the rail route is required']\n            },\n            date: {\n                type: Date,\n                required: [true, 'Arrival date of the rail is required']\n            }\n        },\n        stops: [{\n            stopId: {\n                type: mongoose.ObjectId,\n                required: [true, 'Stop ID of the rail route is required']\n            },\n            date: {\n                type: Date,\n                required: [true, 'Stop date of the rail is required']\n            }\n        }]\n    },\n    {\n        timestamps: true\n    }\n    ```\n\n    ##### Example of the extended `RailRouteSchema`:\n    ```json\n    {\n        \"_id\": \"6487e6faecffa599c1d815ce\",\n        \"trainId\": \"6485f91a69d92892eb4b0965\",\n        \"ticketsCost\": {\n            \"firstClass\": 400,\n            \"standard\": 20\n        },\n        \"departure\": {\n            \"stopId\": \"6485e52712372c03b8747898\",\n            \"date\": \"2023-06-17T08:30:00.000Z\",\n        \"stop\": [\n            {\n                \"_id\": \"6485e52712372c03b8747898\",\n                \"name\": \"Zakopane\",\n                \"place\": {\n                    \"_id\": \"6485063716691550652486e6\",\n                    \"name\": \"Zakopane\"\n                }\n            }\n        ]\n        },\n        \"arrival\": {\n            \"stopId\": \"6485e34012372c03b874786e\",\n            \"date\": \"2023-06-17T10:04:00.000Z\",\n            \"stop\": [\n                {\n                    \"_id\": \"6485e34012372c03b874786e\",\n                    \"name\": \"Kraków Główny\",\n                    \"place\": {\n                        \"_id\": \"648503a7221f629a17f924b8\",\n                        \"name\": \"Kraków\"\n                    }\n                }\n            ]\n        },\n        \"stops\": {\n        \"stop\": [\n            {\n                \"_id\": \"6485e37512372c03b8747876\",\n                \"name\": \"Kraków Łagiewniki\",\n                \"place\": {\n                    \"_id\": \"648503a7221f629a17f924b8\",\n                    \"name\": \"Kraków\"\n                }\n            },\n            {\n                \"_id\": \"6485e41012372c03b8747882\",\n                \"name\": \"Radziszów\",\n                \"place\": {\n                    \"_id\": \"648504db16691550652486ae\",\n                    \"name\": \"Radziszów\"\n                }\n            },\n            {\n                \"_id\": \"6485e4d112372c03b874788e\",\n                \"name\": \"Skawa Środkowa\",\n                \"place\": {\n                    \"_id\": \"6485058816691550652486ce\",\n                    \"name\": \"Skawa\"\n                }\n            },\n            {\n                \"_id\": \"6485e51012372c03b8747894\",\n                \"name\": \"Nowy Targ\",\n                \"place\": {\n                    \"_id\": \"648505f316691550652486de\",\n                    \"name\": \"Nowy Targ\"\n                }\n            }\n        ]\n        },\n        \"createdAt\": \"2023-06-13T03:48:10.171Z\",\n        \"updatedAt\": \"2023-06-13T03:48:10.171Z\"\n  }\n  ```\n\n#### Reservations collection\nDefines all currently active reservations, grouped by `userId`.\n\n- Source code: [reservation.js](./backend/models/reservation.js)\n- Source code preview:  \n    `ReservationSchema`\n    ```js\n    {\n        userId: {\n            type: mongoose.ObjectId,\n            required: [true, 'User ID is required']\n        },\n        railRouteId: {\n            type: mongoose.ObjectId,\n            required: [true, 'Train route ID is required']\n        },\n        seats: [\n            {\n                seatId: {\n                    type: String,\n                    required: [true, 'Seat ID is required']\n                }\n            }\n        ]\n    },\n    {\n        timestamps: true\n    }\n    ```\n\n## Backend application\n\n## API Endpoints\n\n### Account\n#### Sign-up\n- URL: `/signup`,\n- Method: `PUT`,\n- Required body: [full user schema](#users)\n\n##### _Source code_:\n- [sign-up controller](./backend/controllers/signUp.js),\n- [sign-up route](./backend/routes/signUp.js)\n\n#### Login\n- URL: `/login`,\n- Method: `POST`,\n- Required body:  \n    `string email` - email  \n    `string password` - plain password\n```json\n{ \"email\": \"\", \"password\": \"\" }\n```\n\n##### _Source code_:\n- [login controller](./backend/controllers/login.js),\n- [login route](./backend/routes/login.js)\n\n\n### Places\n\nSource code\n- [places controller](./backend/controllers/places.js),\n- [places route](./backend/routes/places.js)\n\n#### Insert a new place\n- URL: `/places`,\n- Method: `PUT`,\n- Required body: [full place schema](#places-collection)\n\n#### Get a place by its ID\n- URL: `/places/id/:id`,\n- Method: `GET`,\n- Required body: none\n- Returns: `PlaceSchema`  \n`string :id` - 24-character id of place\n\n#### Get all places\n- URL: `/places/all`,\n- Method: `GET`,\n- Required body: none\n- Returns: `[PlaceSchema]`  \n\n#### Get a place by its name\n- URL: `/places/name/:name`,\n- Method: `GET`,\n- Required body: none\n- Returns: `PlaceSchema` (best matched)  \n`string :name` - name of place\n\n#### Get all places by their province name\n- URL: `/places/province/:name`,\n- Method: `GET`,\n- Required body: none\n- Returns: `[PlaceSchema]`  \n`string :name` - name of province\n\n\n### Stops\n\nSource code\n- [stops controller](./backend/controllers/stops.js),\n- [stops route](./backend/routes/stops.js)\n\n#### Insert a new stop\n- URL: `/rail/stops`,\n- Method: `PUT`,\n- Required body: [full stop schema](#stops-collection)\n\n#### Get a stop by its ID\n- URL: `/rail/stops/id/:id`,\n- Method: `GET`,\n- Required body: none\n- Returns: `StopSchema`  \n`string :id` - 24-character id of stop\n\n#### Get all stops\n- URL: `/rail/stops/all`,\n- Method: `GET`,\n- Required body: none\n- Returns: `[StopSchema]`  \n\n#### Get a stop by its name\n- URL: `/rail/stop/name/:name`,\n- Method: `GET`,\n- Required body: none\n- Returns: `StopSchema` (best matched)  \n`string :name` - name of stop\n\n#### Get all stops by their place\n- URL: `/rail/stops/place`,\n- Method: `GET`,\n- Required body: place and/or province names  \n    `string placeName` - name of the place, through which a filter be applied  \n    `string provinceName` - name of the province, through which a filter be applied  \n- Returns: `[StopSchema]`\n\n_Example request_:\n```\n/rail/stops/place?placeName=Mszana\u0026provinceName=polskie\n```\n\n\n### Rail routes\n\nSource code\n- [rail routes controller](./backend/controllers/railRoutes.js),\n- [rail routes route](./backend/routes/railRoutes.js)\n\n#### Insert a new rail stop\n- URL: `/rail/routes`,\n- Method: `PUT`,\n- Required body: [full rail route schema](#rail-routes)  \n    _Example body_:\n    ```json\n    {\n        \"trainId\": \"6485f91a69d92892eb4b0965\",\n        \"ticketsCost\": {\n            \"firstClass\": 250,\n            \"standard\": 150\n        },\n        \"departure\": {\n            \"stopId\": \"648508346ebe5f779de65375\",\n            \"date\": \"2023-06-13T03:33+02:00\"\n        },\n        \"arrival\": {\n            \"stopId\": \"6485e34012372c03b874786e\",\n            \"date\": \"2023-06-13T04:45+02:00\"\n        },\n        \"stops\": [\n            {\n                \"stopId\": \"6485e4fc12372c03b8747892\",\n                \"date\": \"2023-06-13T03:52+02:00\"\n            },\n            {\n                \"stopId\": \"6485e49f12372c03b8747888\",\n                \"date\": \"2023-06-13T04:02+02:00\"\n            },\n            {\n                \"stopId\": \"6485e37512372c03b8747876\",\n                \"date\": \"2023-06-13T04:36+02:00\"\n            }\n        ]\n    }\n    ```\n\n#### Get a rail routes by its ID\n- URL: `/rail/routes/id/:id`,\n- Method: `GET`,\n- Required body: none\n- Returns: `RailRouteSchema`  \n`string :id` - 24-character id of stop\n\n#### Get all rail routes by departure or arrival date and stop IDs\n- URL: `/rail/routes/query`,\n- Method: `POST`,\n- Required body:  \n    `| string departureDate` - string date format of minimum departure date (_one of them required_)  \n    `| string arrivalDate` - string date format of minimum arrival date (_one of them required_)  \n    `string departureStopId` - 24-character long ID of the departure stop (_required_)  \n    `string arrivalStopId` - 24-character long ID of the arrival stop (_required_)  \n\n    _Example body_:\n    ```json\n    {\n        \"departureDate\": \"2023-06-08T04:00+02:00\",\n        \"arrivalDate\": \"2023-06-20T04:00+02:00\",\n        \"departureStopId\": \"648508346ebe5f779de65375\",\n        \"arrivalStopId\": \"6485e3c012372c03b8747878\"\n    }\n    ```\n- Returns: [extended `[RailRouteSchema]`](#example-of-the-extended-railrouteschema)  \n\n\n### Trains\n\nSource code\n- [trains controller](./backend/controllers/train.js),\n- [trains route](./backend/routes/trains.js)\n\n#### Insert a new train\n- URL: `/trains`,\n- Method: `POST`,\n- Required body: [full trains schema](#trains-collection)\n\n#### Get a train by its ID\n- URL: `/trains/:id`,\n- Method: `GET`,\n- Required body: none\n- Returns: `TrainSchema`  \n\n#### Get a seats by its type\n- URL: `/trains/:id/seats/:listOfSeatTypes`, seperated by `,`,\n- Method: `GET`,\n- Required body: none\n- Returns: List of `TrainSeatSchema`  \n\n\n### Reservations\n\nSource code\n- [reservations controller](./backend/controllers/reservation.js),\n- [reservation route](./backend/routes/reservation.js)\n\n#### Insert a new reservation\n- URL: `/reservation`,\n- Method: `POST`,\n- Required body: [full reservation schema](#reservations-collection)\n\n#### Get a reservation by its ID\n- URL: `/reservation/:id`,\n- Method: `GET`,\n- Required body: none\n- Returns: `ReservationSchema`  \n`string :id` - 24-character id of reservation\n\n#### Get all reservations by user ID\n- URL: `/reservation/user/:id`,\n- Method: `GET`,\n- Required body: none\n- Returns: `ReservationSchema`  \n`string :id` - 24-character id of user\n\n\n\n\n## Frontend Application\nWe based our solution on `React` library and its functional components.\n\n### Base\nResponsible for displaying navigation bar and path protection.\n![Screenshot](https://github.com/agh-cs-imbeciles/train-transport-management-system/assets/114953716/8d84aa5b-788f-4657-a3e6-2be7e93dc9a0)\n![Screenshot](https://github.com/agh-cs-imbeciles/train-transport-management-system/assets/114953716/04860066-7a64-46c3-85c1-84a8e2b8c503)\n\n### login_register\nThis folder contains components that allow user to log in or register to application.\n#### Login\n![Screenshot](https://github.com/agh-cs-imbeciles/train-transport-management-system/assets/114953716/2a7f0f67-7f79-4c71-94af-2be7390b8155)\n#### Register\n![Screenshot](https://github.com/agh-cs-imbeciles/train-transport-management-system/assets/114953716/7a55563c-64bd-4494-9cdb-a18c52da1eec)\n\n### cockpit\nFolder contains components that display basic information about reservations, allows to search for new connections.\n#### Cockpit Component\n![Screenshot](https://github.com/agh-cs-imbeciles/train-transport-management-system/assets/114953716/e048d6ac-558b-4cba-ab56-1137d326fca5)\n#### Cockpit Views\n##### ListElement\nDisplays basic data about connection. After being clicked, allows user to book seats certain connection.\n![Screenshot](https://github.com/agh-cs-imbeciles/train-transport-management-system/assets/114953716/1bbbd676-82ef-45e0-8735-526a2a35746c)\n##### ReservationList\nDisplays extended data about already booked connenctions.\n![Screenshot](https://github.com/agh-cs-imbeciles/train-transport-management-system/assets/114953716/6d142793-a38c-44f5-ada6-4df49cfdabfa)\n##### SearchPanel\nAllows user to find new connections. User is able to filter connections by arrival/departure time,start/stop places.\n![Screenshot](https://github.com/agh-cs-imbeciles/train-transport-management-system/assets/114953716/07c41a51-7218-4c63-9590-59ebe457cb8f)\n#### ReservationPanel\nAllows user to choose how many places he would like to book. Displays additional data about connection.\n![Screenshot](https://github.com/agh-cs-imbeciles/train-transport-management-system/assets/114953716/14132752-052b-42c1-bcd9-8ce64705777d)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagh-cs-imbeciles%2Ftrain-transport-management-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagh-cs-imbeciles%2Ftrain-transport-management-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagh-cs-imbeciles%2Ftrain-transport-management-system/lists"}