acmucsd / membership-portal

REST API for the UC San Diego ACM chapter's membership portal.
https://members.acmucsd.com
Mozilla Public License 2.0
17 stars 5 forks source link

membership-portal-api   CircleCI

REST API for the UC San Diego ACM chapter's membership portal. This is an open-source project, made for members by members, and we welcome any contributions! If you're interested in using the API for your own project and/or contributing, check out our guide here.

Build Instructions

Feel free to use yarn ... instead of npm run ..., but make sure not to commit the yarn.lock.

  1. Clone the repository: git clone https://github.com/acmucsd/membership-portal.
  2. Navigate to the directory: cd membership-portal.
  3. Install PostgreSQL. See installation instructions below.
  4. Install the necessary dependencies: npm install. For Windows users, see specific build instructions below.
  5. Create a new .env file using .env.example as a template: cp .env.example .env.
  6. Fill out the .env. See the example file below.
  7. Run the containerized service(s) (e.g. Postgres): docker-compose up -d.
  8. Initialize the database: npm run db:migrate.
  9. Populate the database: npm run db:seed.
  10. Start the Node app: npm run dev.

Installing Postgres

Even though our actual Postgres instance runs in a Docker container, we need to install Postgres to install the official pg Node package. MacOS and Linux users can install Postgres via Homebrew, and Linux users can use apt. Windows users will need to download the Postgres 11.5 installer from here, run the installer, and add the Postgres bin to the PATH environment variable.

Windows Build Instructions

  1. Run the Windows Powershell as administrator.
  2. Install build tools to compile native Node modules: npm install -g windows-build-tools.
  3. Rerun npm install in a separate command prompt window.

Sample .env

RDS_HOST=localhost
RDS_PORT=5432
RDS_DATABASE=membership_portal
RDS_USER=acmucsd_dev
RDS_PASSWORD=password

AUTH_SECRET=secret

CLIENT=localhost:8000

Note: For Windows users, localhost won't work—you'll need to set RDS_HOST to the Docker Machine's IP address.

Useful Commands

Take a look at package.json for the actual commands.

Testing Information

After having executed npm run db:seed, tests/Seeds.ts will have been used to generate sample data. For all testing accounts, the password is password. To test basic features of the portal, acm@ucsd.edu can be used for the demo admin account, and any seed email (e.g. s3bansal@ucsd.edu) can be used for a demo member account.

For testing out the different portal roles, use the email acm_[role]@ucsd.edu, such that [role] is replaced with any of the following terms:

For testing out the store, use the email acm_store@ucsd.edu, as the majority of demo orders will be placed with this account.

Upgrading to Latest Version

The first iteration of the membership portal is a JavaScript app written in 2019. The second and latest iteration, written 2020, is a TypeScript app built with better reliability and error handling, stronger concurrency guarantees, and a smoother development experience in mind, and includes a number of breaking changes at the API and database levels. For a more concrete list of improvements, see acmucsd/membership-portal#115.

API Breaks and Changes

To Upgrade

  1. Update the app to the latest release of the first iteration (v1-latest).
  2. Manually run this SQL script (0000-sequelize-to-typeorm.sql).
  3. Update the app to the latest release (latest).