Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Docker frontend build #151

Merged
merged 46 commits into from
Oct 19, 2023
Merged

Fix Docker frontend build #151

merged 46 commits into from
Oct 19, 2023

Conversation

yhtMinceraft1010X
Copy link
Contributor

No description provided.

ong6 and others added 30 commits October 11, 2023 16:51
todos: 
make question service work with collaboration service and matching
service

can merge this before it gets too large - i've split the tickets alr

fixes #71

---------

Co-authored-by: YIHSUEN\Yi Hsuen <[email protected]>
Co-authored-by: Charisma Kausar <[email protected]>
Let's rename the env variables associated with the prisma relational 
database to avoid ambiguity and confusion with MongoDB.
- Operational Transformations in Collaboration Service
- Add utils/shared-ot.ts
  - next.config.js: Enable experimental feature - external dir
  - Some scary warning appears here
- Fix frontend
  - remove debouncer
- Add cursor support, defaults to 0

Current design:

Client --> Server: OT + Cursor
Server --> Client: Full text + Version number + Cursor

Version number incremented by Server, client should not increment
because version number refers to previous version that is edited upon.

Client waits for: 
- Acknowledgement from server of prev request
- Sync version (and text) from server
before they can send the next update request

This ensures no conflicting versions and mix-ups.
Let's add a production deployment workflow.
Fix #76 , fix #95

- On save text (save API) and disconnect of all users, will save Attempt
  - if question_id not set, it will be empty string 
- (Collab service) socket emit `api/collaboration-service/question/set`
to set question_id
- (User service) 
  - `api/user-service/:uid/attempts/` to get attempts of user
  - `api/user-service/attempt/` to create an attempt
    - uid string
    - question_id string
    - answer string
    - solved? boolean defaults to false

Frontend can call user service to save attempt for attempts done alone
(without collaboration rooms)
The prod workflow is currently failing at the first step due to
permission issues on the workflow file side.
yhtMinceraft1010X and others added 16 commits October 19, 2023 14:08
The 400 error when POSTing to the database when the user is already
inside can surprise developers during debugging because everytime a
user logs in, the POST is made regardless of whether the user is inside
the database or not.

Let's change the status code to 200 to avoid showing it as an error
while still differentiating it from the status code 201 when the user
details are added for the first time.
Use Twilio video call API.

Also change Dockerfile to add utils as a dependency

To use:
- Add new variables to .env file
```
TWILIO_ACCOUNT_SID=
TWILIO_API_KEY=
TWILIO_API_SECRET=
```
- Run the collab service and frontend
- Visit http://localhost:3000/room/1?userId=user2 or choose a different
room/user id
- Visit http://localhost:3000/room/1?userId=user2&disableVideo=true if
you don't want to use video (save cost)
@yhtMinceraft1010X yhtMinceraft1010X merged commit c376ed6 into prod Oct 19, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants