This repo includes services built in MongoDB Realm to provide access to data stored in MongoDB Atlas for the main FightPandemics app.
These apps are intended for use by FightPandemics team members and generally. They may be stop gap solutions until the desired functionality can be built into the main app itself.
The front-end is currently Google Sheets. The code is defined within a google-sheets/Code.js
file.
This app provides access to post content for FightPandemics team members to review the content for abuse. "Sourced by FightPandemics" posts are excluded.
The app is made available through a Google Sheet stored in the FightPandemics accounts Google Drive. Since G Suite is not being used users will be given access to this specific sheet by email invite.
- Get the email of the user requiring access for moderation.
- Open the "FightPandemics Moderation" sheet
- Click the "Share" button (top-right)
- Enter the email and add as an "Editor" and click "Send"
Since G Suite is not being used the script must be granted permission to run by each invited user.
- Click the link in invitation email
- Once the sheet fully loads click "Get Posts"
- Click "Continue" in prompt asking for permission to run
- A pop-up will open. Select your account & click "Advanced"
- Click "Go to fightpandemics-posts-moderation (unsafe)"
The "Get Posts" button will get 100 posts at a time with the most recent posts displayed first. "Sourced by FightPandemics" posts are excluded.
It will clear all the content under the column headers in the "Posts" sheet, so any content to be persisted should be entered elsewhere.
- If desired, to get a different page (each chunk of 100 in descending order by creation timestamp), enter the page number in the corresponding cell (currently B1)
- Click "Get Posts". Depending on connection speed the data should be refreshed in less than a second.
Note: If "Posts on Page" is less than 100 then it is the last page.
These shouldn't change but if need be you can change these properties in the Google Sheet to match the Realm App. Get the values from a Realm app developer or have them complete these steps
- Click "Change Realm App Config Properties" button
- Enter
REALM_APP_ID
(this should start with "posts-moderation-") and click "Ok" - Enter
REALM_WEBHOOKS_SECRET
and click "Ok" - Click "Get Posts" to confirm there are no errors
The most important code to update are:
posts-moderation/realm-config/services/http-service/incoming_webhooks/get-posts/source.js
posts-moderation/google-sheets/Code.js
Typically these would be edited & iterated on in MongoDB Realm & Google Sheets respectively.
They are saved here for source control purposes.
NOTE: There are import/export functions available via realm-cli that generated all the files under realm-config. The steps to most easily keep the realm app & repo in sync are WIP. Until then the copy & paste is suggested:
- Login into to MongoDB Atlas and select the "Production" project.
- Go to Realm
- Go to 3rd Party Services > http-service > get-posts
- Edit the function & save
- Click "Review & Deploy" then "Deploy"
- Test with Google Sheets and iterate as required
- Save the file to
posts-moderation/realm-config/services/http-service/incoming_webhooks/get-posts/source.js
- Access the Google Sheet as described above
- Go to Tools > Script editor
- Edit the Code.gs file, save & test as required
- Save the updated file to
posts-moderation/google-sheets/Code.js