SJTU CS1951 lab assignment
Assignment details: https://github.com/ACMClassCourse-2021/TicketSystem
You need CMake (≥ v3.16) and a C++ compiler capable of C++
20. We use g++ and clang++. To build the project, run
bin/build
from the root directory. More details can be
found in HACKING.md
.
A Node.js binding is available. To build the binding, you
need to have a recent version of Node.js and npm, and
cmake-js
on your $PATH. To build the binding,
run bin/build-node
from the root directory.
This project runs only on *nix systems (i.e. not Microsoft Windows).
Overall structure: Alan-Liang
Library utilities: Alan-Liang
Misc, Order, User, Parser: Alan-Liang
Rollback, Train: BLeaves
Frontend:
UI & API Design, Implementation, BFF: BLeaves
Node-C++ interop: Alan-Liang
lib/
contains library stuff unrelated to business logic.
It is written to replace many useful utilities in the C++
STL, and to implement file storage.
src/
contains business logic of the ticket system. The
main function performs a Read-Eval-Print Loop (REPL).
The node module provides an interface to the Node platform.
The command parser parses the command string into command
arguments, and main dispatches the command.
Frontend code is to be written in JavaScript utilizing the Vue.js library. A backend-for-frontend (BFF), also written in JavaScript and to be ran in the Node runtime, acts as the intermediary between frontend API calls and the C++ backend. It also serves static assets. Optionally, a reverse proxy could be used to achieve load balancing, HTTPS, logging or other purposes.
The frontend would be a single-page application (SPA). The frontend code would fetch raw data in JSON format from the BFF, and turn it into a DOM structure to be rendered in the browser. Detailed UI/UX design is TBD.
For the detailed code structure, see docs/refman.pdf
or
https://faketicket-docs-demo.vercel.app/, both generated
by Doxygen. They contain the
same contents. You can generate these docs by running
doxygen
in the root directory of this repository.
orders
: ordersorders.user.ix
: index of orders on usernameorders-pending.ride.ix
: index of pending orders on ride (i.e. train ID and date)rollback-log
: rollback logtrains
: trainstrains.train-id.ix
: index of trains on train IDtrains.stop.ix
: index of trains on station namesride-seats
: remaining seat count informationride-seats.ride.ix
: index of ride-seats on rideusers
: usersusers.username.ix
: index of users on username
- Add/Remove the file::File instance
- Update the list above
- Update command::Clean in src/misc.cpp
+-----------------------------------------+
| Filesystem Server |
| ^ |
| | Filesystem APIs |
| v |
| C++ "./code" |
| ^ |
| | Node-API |
| v |
| BFF (Backend for frontend) Server |
+-----^-----------------------------------+
| | http(s) Network |
+-----v-----------------------------------+
| Browser Client |
+-----------------------------------------+
SPDX-License-Identifier: GPL-3.0-or-later