-
Environment Variable
-
cd backend/api
-
Create
.env
file with reference to example_env.txtADMIN: used to access service account and perform tasks, must be an admin account in the domain
DOMAIN: target domain
-
-
Set up docker container
docker compose build
With docker
docker compose up
-
Follow the README.file on mod_auth_cas
-
Add cert
- Download the InCommon Certificates for CAS service from Rutgers CAS certificate.
Rutgers Calendar Service stores its data in MongoDB local Database.
The main database is when
├── when
│ ├── subcals
│ ├── subscriptions
│ ├── groupsubscriptions
│ ├── admins
subcals is the colleation that stores all subscrideble calendars.
Each document is one subscrideble calendars
- summery [string] : summery(title) of the google calendar
- calendarId [string]: unique id for the google calendar
- description [string]: a description of what the google calendar is for
- netId [string]: the netId of the host of the calendar
- organization [string]: the organization the calendar belongs
- createdTime [Datetime]: the time when admin adds the calendar to database
- editedTime [Datetime]: latest edited time
- numSub [int]: total number of subscriptions
{
_id: ObjectId('66998ca579b05baf30b3af4d'),
summary: 'Academic Calendar',
calendarId: 'c_cef2ddd17b7974627cdab796544ddb5e0091d0cb3b8d5c4f79034293a71ae71b@group.calendar.google.com',
description: 'Rutgers Univerisity-wide Academic Calendar',
netId: 'abc123',
organization: 'Rutgers Univeristy',
createdTime: '2024-07-18T21:44:05.091Z',
editedTime: '',
numSub: 3
}
subscriptions is the colleation that stores all cases of calendar subscriptions
Each document is one case of calendar subscriptions
- calendarID [string] : unique id for the google calendar
- netID [string]: netID of the user that subscribed to the calendar
- time [Datetime]: time of subscription
{
_id: ObjectId('669e9dc2f798dd7f971fa3c3'),
calendarID: 'c_cef2ddd17b7974627cdab796544ddb5e0091d0cb3b8d5c4f79034293a71ae71b@group.calendar.google.com',
netID: 'abc123',
time: '2024-07-22T17:58:25.197Z',
}
admins is the colleation that stores all admins for when.
Each document is one admin
- netID [string] : netID of the admin
- createdTime [Datetime]: time when admin is being added
{
_id: ObjectId('66995f3ba2449285b4149f48'),
netID: 'abc123',
createdTime: '2024-07-18T18:30:19.172Z'
}
admins can only be added and edited manually through mongo
Add an admin
mongosh
use when
db.admins.insertOne({ netID: "abc123", createdTime: new Date()})
- Description: This port is used by the application server to handle incoming HTTP requests.
- URL:
localhost:8080
Endpoint Structure
- /data/:summary/[:detail] - send data from server and database to frontend
- /request/:role/:type/:id - used to process request send from frontend
- /request-results/:id - send request result to frontend
/data/:summary/[:detail]
- summary: short summary of the content of the data
- detail: to get specific part of the data (optional)
-
Description: This endpoint returns all subscribable calendars in the database.
-
URL:
/data/subcals
-
Method:
GET
-
Success Response:
Code: 200 OK
Example Response Body:0: Object{ "summary": "Spring 2024 Academic Calendar", "id": "c_cef2ddd17b7974627cdab796544ddb5e0091d0cb3b8d5c4f79034293a71ae71b@group.calendar.google.com" }, 1: Object{ "summary": "Test 1", "id": "c_c05ef1daf37942ea1edc613cd0c294b0054a711f4470155d6e357579d29134b2@group.calendar.google.com" },
/request/:role/:type/:id
- type: the type of request
- role: the role of the client sends the request (admin/user)
- id: unique identifier for each request
- Description: This endpoint returns the calendar user reuqest to subscribe
- URL:
/request/user/subscirbe-calendar/:id
- Method:
POST
- Description: This endpoint returns the calendar to be added to subcals database
- URL:
/request/admin/add-calendar/:id
- Method:
POST
/request-results/:id
- id: unique identifier previously assigned for the request
- Description: This endpoint returns all subscribable calendars in the database.
- URL:
/data/subcals
- Method:
GET
Service account represents a Google Cloud service identity, use to connect to API service and make requests to google API. To access the service account used in this project
- Enter Google Cloud Console's Calendar Service Project with an developer account under the domain
- In Navigation Menu (side bar) => IAM & Admin => Service Account
Used to identify and authenticate the service account.
Currently Used Service Account Key:
Access this key with service-account-key1.json.
Code | Description |
---|---|
201 | Title |
102 | Text |
202 | Fail to load collection from mongodb database |
| 110 | Fail to decode Json file from frontend|
Code | Description |
---|---|
201 | Title |
202 | Text |
202 | Fail to load collection from mongodb database |
210 | Error occurs when inserting item into database |
211 | Item already existed in the collection when attempting to add |
220 | Error occurs when finding item in database |
221 | Item doesn't exist when attempting to find |
222 | Item exists, required attribute missing |
223 | Item exists, current user doesn't have permission to edit |
230 | Error occurs when deleting item in database |
240 | Error occurs when updating item in database |
Code | Description |
---|---|
201 | Title |
202 | Text |
202 | Fail to load collection from mongodb database |
310 | Error occurs when using calendarmod Go Package |
311 | Error occurs when subscribing user with calendarmod Go Package |
312 | Error occurs when subscribing group with calendarmod Go Package |
321 | Error occurs when send mail |
Code | Description |
---|---|
501 | Log in as User |
502 | Log in as Admin |
- JWT Token Incalid for Google API
Post "https://www.googleapis.com/calendar/v3/calendars?alt=json&prettyPrint=false": oauth2: cannot fetch token: 400 Bad RequestRespons: {"error": "invalid_grant", "error_description": "Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values and use a clock with skew to account for clock differences between systems." }
- Trivial Solution: Reboot device
- Sync server with NTP
a. Run
timedatectl
b. Refer to the followeing to enable system sync and ntp service
- Dynamic Calendar doesn't support full-day event, has to have valid start and end time
- EventForm.tsm- reoccurance feature
- EventForm.tsm- Guest accesibility feature
- LoginPage.jsx- login authenitification
- Create a database for subscribable calendars
- Create base admin account to manage for calendar service (currently using sk2779@gtest.rutgers.edu)
Calendar Service is developed from rutgers google util, reference to this project to see the implementations of following utilities:
- Get all users from an Google admin account (func getAllUsers)
- View google drive of an account
- Use terminal to access and change calendar events
Access Rutgers Google Util on GitLab