Giter Club home page Giter Club logo

membership-portal's Introduction

membership-portal

The ACM Membership Portal repo contains the backend for the ACM Membership Portal website.

Overview

This repo uses the following main technologies:

  • ExpressJS
  • Postgres
  • GoogleAuth
  • Docker (for development)
  • Jest (for testing)

The backend source code can be found in the 'app' directory. The routes for the backend are found in 'app/api/v1'. The unit tests can be found in the 'tests' directory.

Prerequisites

To run this repo for development or testing, you need to have Docker installed.

Development

Development mode is where you should code and test new features. In development mode, a docker container for the database and the backend API are created and ran. Any saved changes to a file will automatically recompile the server code.

To run in development:

$ make

Testing

To run unit tests:

$ make test

This command will create and run the database and run all the unit tests.

Accessing the Server

The server runs on port 8080.

You can test that the server is running by going to http://localhost:8080/api/v1/health. If the server is running on a computer that is not your development computer, the address will be http:<IP ADDRESS>:8080/api/v1/health, where IP ADDRESS is the address of the server.

membership-portal's People

Contributors

advaithg avatar alexanderqchen avatar dtjanaka avatar ellieyhcheng avatar heboyuan avatar howardwang15 avatar matthewcn56 avatar mattxwang avatar nkansal96 avatar ramsgoli avatar reginawang3495 avatar seijiotsu avatar victorwen avatar xorkevin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

reginawang3495

membership-portal's Issues

More descriptive error messages for attendance code error

Expected Behavior

If attendance code is not unique, the validation error should specify that.

Current Behavior

I get "validation error", which gives no indication on what I filled out incorrectly

Screenshot(s)

screen shot 2017-08-08 at 10 56 05 pm

Steps to Reproduce

  1. Create an event with an attendance code
  2. Reuse that attendance code for another event

Your Environment

  • Desktop:
    Operating System:
  • Chrome (Version: )
  • Firefox (Version: )
  • Safari (Version: )
  • Opera (Version: )
  • IE (Version: )
  • EDGE (Version: )

Implement endpoint to get events by committee

Motivation

The "Event Analytics" section of the control panel should show the events organized by committee. Creating the endpoint for getting events by committee is the first step in making this functionality.

To Do

  • Create a new db function called getCommitteeEvents(committee, offset, limit) that queries the database for events from that committee
  • Create a new endpoint at app/api/v1/event/:committee? that returns the events from a specific committee

Convert to TypeScript: Boyuan

Files to convert to typescript

On the improvement/typescriptify branch, convert the following files to TypeScript:

  • src/app/api/v1/index.js
  • src/app/api/v1/event/index.js
  • src/app/error/index.js

Fix user attendence points overflow

Motivation

Some users have reported that the amount of points they have has overflowed

Todo

Find where and why in the backend this overflow is happening

Update routes that require events to be deleted

  • Update app/db/schema/event.js to make queries query for events that aren't deleted

  • Update app/api/v1/event/index.js to return events that aren't deleted, update event deletion to set deleted field to true in db

Create admin endpoint to get users that attended an event

Motivation

This will help with allowing officers to get a list of people who attended an event. This is a feature that has been requested a lot and has been fulfilled by manually running sql queries, so this will automate that process.

To Do

  • add attendance objects to the dev-setup.js file to allow easy testing of attendance endpoints
  • add admin authorization for attendance when uuid is included in endpoint

Default max length for URL

Hi, Dev team,

You guys are doing great work. One issue that we ran into constantly is that the URL field for creating an event is limited to 255 characters, but facebook's image assets URLs are usually super-duper long, which does not fit into the field.

Can we increase that limit?

Thank you guys so much!

`make test` fails on testing branch

See below error message:

membership-portal-test-backend-1  | if [ ! -f app/config/SESSION_SECRET ]; then \
membership-portal-test-backend-1  |     cat /dev/urandom | od -N 32 -t x4 -An | tr -d '\n ' > app/config/SESSION_SECRET; \
membership-portal-test-backend-1  | fi
membership-portal-test-backend-1  | yarn run v1.22.15
membership-portal-test-backend-1  | $ export TESTING=true && jest --config jest.config.json
membership-portal-test-backend-1  | PASS tests/test.tests.js
membership-portal-test-backend-1  | FAIL tests/app.api.v1.test.js
membership-portal-test-backend-1  |   ● Test suite failed to run
membership-portal-test-backend-1  | 
membership-portal-test-backend-1  |     ReferenceError: TextEncoder is not defined
membership-portal-test-backend-1  | 
membership-portal-test-backend-1  |       13 | // https://stackoverflow.com/questions/65417340/docker-compose-postgres-restart-after-running-scripts-in-docker-entrypoint-initd/65417566#65417566
membership-portal-test-backend-1  |       14 | // The DB instance managed by sequelize
membership-portal-test-backend-1  |     > 15 | const db = new Sequelize(
membership-portal-test-backend-1  |          |            ^
membership-portal-test-backend-1  |       16 |   config.database.db,
membership-portal-test-backend-1  |       17 |   config.database.user,
membership-portal-test-backend-1  |       18 |   config.database.password,
membership-portal-test-backend-1  | 
membership-portal-test-backend-1  |       at Object.<anonymous> (node_modules/pg/lib/crypto/utils-webcrypto.js:22:21)
membership-portal-test-backend-1  |       at Object.<anonymous> (node_modules/pg/lib/crypto/utils.js:8:20)
membership-portal-test-backend-1  |       at Object.<anonymous> (node_modules/pg/lib/crypto/sasl.js:2:16)
membership-portal-test-backend-1  |       at Object.<anonymous> (node_modules/pg/lib/client.js:5:12)
membership-portal-test-backend-1  |       at Object.<anonymous> (node_modules/pg/lib/index.js:3:14)
membership-portal-test-backend-1  |       at new ConnectionManager (node_modules/sequelize/lib/dialects/postgres/connection-manager.js:24:17)
membership-portal-test-backend-1  |       at new PostgresDialect (node_modules/sequelize/lib/dialects/postgres/index.js:14:30)
membership-portal-test-backend-1  |       at new Sequelize (node_modules/sequelize/lib/sequelize.js:242:20)
membership-portal-test-backend-1  |       at Object.<anonymous> (app/db/index.js:15:12)
membership-portal-test-backend-1  |       at Object.<anonymous> (app/index.js:2:7)
membership-portal-test-backend-1  |       at Object.<anonymous> (index.js:6:13)
membership-portal-test-backend-1  |       at Object.<anonymous> (tests/app.api.v1.test.js:1:1)
membership-portal-test-backend-1  | 
membership-portal-test-backend-1  | 
membership-portal-test-backend-1  | Test Suites: 1 failed, 1 passed, 2 total
membership-portal-test-backend-1  | Tests:       1 passed, 1 total
membership-portal-test-backend-1  | Snapshots:   0 total
membership-portal-test-backend-1  | Time:        9.593s
membership-portal-test-backend-1  | Ran all test suites.
membership-portal-test-backend-1  | error Command failed with exit code 1.
membership-portal-test-backend-1  | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
membership-portal-test-backend-1 exited with code 1

Convert to TypeScript: Helen

Files to convert to typescript

On the improvement/typescriptify branch, convert the following files to TypeScript:

  • src/app/api/v1/auth/index.js
  • src/app/api/v1/health/index.js
  • src/app/api/v1/leaderboard/index.js

Reduce minimum password length to 8

Motivation

There have been a few issues with a 10 character minimum in the past. I've received complaints from people that they could not create an account because they did not realize that the password needs to be at least 10 characters (when 8 is much more common). Ideally, we would improve the UI so that the password character minimum is more clear, but this is a quick fix to solve the issue so that GM runs more smoothly.

Images are broken for past evens in uclaacm/events

Here's an image of what I see when I log in:

image

I've tested this issue on my desktop connecting from Firefox 90.0 as well as Chrome 91.0 on a Windows 10 desktop. The issue seems to be with how the image is hosted. Going into HTML and getting the image URL gives me this:

image

Meaning these images are expiring after a while. However, the images that re hosted on googleusercontent do not seem to have expired and load fine in the events page.

image

Convert to TypeScript: Alex

Files to convert to typescript

On the improvement/typescriptify branch, convert the following files to TypeScript:

  • src/app/api/v1/attendance/index.js
  • src/app/api/v1/analytics/index.js
  • src/app/api/v1/user/index.js

Migrate events table to include a deleted_on field and Soft Delete events from 2017 - 2018

Motivation

Right now, there's no way to actually delete events unless we send DELETE requests to /api/v1/event manually...however, we don't want to be able to actually delete the event from the database. Instead, we want to add a "deleted" field so that we won't render events that have been marked as deleted (while keeping the "deleted" events in the DB).

Look at this post to see how to write a migrations file

  • update the event database to include a "deleted" column to enable soft deletes

Convert to TypeScript: Su

Files to convert to typescript

On the improvement/typescriptify branch, convert the following files to TypeScript:

  • src/app/db/index.js
  • src/app/db/schema/event.js
  • src/app/db/schema/user.js

Convert to TypeScript: Kevin

Files to convert to typescript

On the improvement/typescriptify branch, convert the following files to TypeScript:

  • src/app/db/dev-setup.js
  • src/app/db/schema/activity.js
  • src/app/db/schema/attendance.js

Implement endpoint for committee-specific leaderboard

Motivation

It would be useful to know which members attend your committee events the most. This information could be used for prizes, shoutouts, or recruiting interns/officers.

To Do

  • Create a new db function called getCommitteeLeaderboard(committee, offset, limit) that queries the database

  • Extend the leaderboard api to include a /app/api/v1/leaderboard/:committee? endpoint
    This would respond with the users and the number of events from that committee each user has attended. We won't be doing this by points because we don't store points by committee, so it'll be a little complicated and point information is not as useful to admins.

Use getPublicProfile in leaderboard API

Motivation

The leaderboard API currently uses getUserProfile, which has some non-public data. This should not be accessible by non-admins, so use getPublicProfile instead.

Todo

  • add all necessary data to getPublicProfile
  • use the getPublicProfile function in the leaderboard API

Attendance code appears in other events and disappears after refresh

Expected Behavior

The code should only appear in the event I entered it in. Also shouldn't disappear after refresh.

Current Behavior

Disappears and appears across all events

Screenshot(s)

screen shot 2017-08-08 at 10 32 47 pm

Steps to Reproduce

  1. Select an event and enter the attendance code
  2. Without refreshing the page, view another event in the list. You'll see the attendance code you entered in the former event
  3. Refresh the page and you'll see the attendance code is gone from the form

Your Environment

  • Desktop:
    Operating System:
  • Chrome (Version: )
  • Firefox (Version: )
  • Safari (Version: )
  • Opera (Version: )
  • IE (Version: )
  • EDGE (Version: )

`make test` fails due to occupied Docker container port

Whether the tests succeed or fail, I have to manually stop the docker container to rerun the tests. See the below error message:

$ make test
docker-compose --profile test up --abort-on-container-exit
[+] Running 2/0
 ✔ Container membership-portal-postgres-1      Created                            0.0s 
 ✔ Container membership-portal-test-backend-1  Created                            0.0s 
Attaching to membership-portal-postgres-1, membership-portal-test-backend-1
Error response from daemon: driver failed programming external connectivity on endpoint membership-portal-test-backend-1 (0eea0d2d69c590f62f2455b7d70fff32e92d61f14e08185039d4f4b96f148d47): Bind for 0.0.0.0:8080 failed: port is already allocated
make: *** [test] Error 1

Google OAuth Policy Upgrade

Issue

Google Cloud Platform (GCP) recently upgraded its policies regarding app verification. This update directly affects the membership portal as we use Google OAuth 2 to sign in/sign up users on the portal. Due to this change, users encounter an error as shown in the screenshot below-

Screenshot 2024-02-23 at 9 15 04 PM

More details about the verification process and GCP can be found on this support page. Currently, the GCP account used for auth is of a past dev team officer.

Task

In order to comply with this policy and take the necessary action, we would have to migrate the project from the current gcp account to acm dev's gcp account (reach out to the current dev team director for credentials). This change will affect the docker container and the production build deployed on AWS EC2.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.