Skip to content

flukexp/CSSupport

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CS Support

CS Support is a platform designed to support computer science students by providing access to resources, facilitating discussions, and fostering collaboration within the community.


Table of Contents

Features

  • Report an issue: Report the issue that has occured in your distinct environment in order to let the admin/manager acknowledged the problem.
  • Tracking: Track the status of the issue/problem that has been reported to the bot.
  • Cost Evaluation: Built in material cost evaluation that is used for fixing/maintenance the problem/issue.
  • Notifications: Stay informed with updates on the reported issue.

Getting Started

Installation

  1. Clone the repository:

    git clone https://github.com/Codezilla-CMU/CSSupport.git

Don't forget to extract the .zip file.

  1. For the next step, you need to import the code to Google App Script, in order to deploy the code through the server for usage.

Usage

  • Add CSSupport: Add CSSupport bot through the provided QR Code below: CSSupport QR Code
  • Rich Menu: Browse the specific function in the rich menu.
  • Report: Report the issue through the bot.

Contributing

We welcome contributions from the community. If you'd like to contribute to this project, please follow these steps:

  1. Fork the repository on GitHub.
  2. Clone your forked repository to your local machine.
  3. Create a new branch for your feature or bug fix.
  4. Make your changes and commit them with descriptive messages.
  5. Push your changes to your forked repository.
  6. Submit a pull request to the main repository, explaining your changes and why they should be merged.

Please follow our Contribution Guidelines for more details.

License

This project is licensed under the MIT License. See the LICENSE.md file for details.

Deployment

To deploy this project

  RUN/DEPLOY through Google App Script

Set-Up Apps Script

Step 1: Open the Apps Script in Google Workspace and add Status, Repair, and Regfixer to the Apps Script. These files establish connections between Line and MongoDB.

  • Status is used to display the status of users and fixers.
  • Repair is used for user repair requests.
  • Regfixer is used for registering or adding repair technicians.

Step 2: Add Files - status.html, regfixer.html, repair.html

These files serve to retrieve user information from Line LIFE:

  • status.html is used to link to the Status page on Line.

  • regfixer.html is used to link to the Repair page on Line.

  • repair.html is used to link to the Regfixer page on Line.


Step 3: Use "drive-to-web" to create an HTML link and paste it into Line LIFE for accessing websites through Line.

drive-to-web Link: https://api.drv.tw/[email protected]/gd/?a=admin#authed=1

*To access the websites through Line, use the following links:


*paste it into Line LIFE for accessing websites through Line, at the endpoint


Set-Up MongoDB

Getting Started with MongoDB HTTP Endpoint

Prerequisites

Before you begin, make sure you have the following prerequisites in place:

  1. MongoDB Atlas Account: Sign up for or log in to your MongoDB Atlas account at MongoDB Atlas.

  2. MongoDB Cluster: Create a MongoDB cluster in your Atlas account if you haven't already.

  3. Database & Collection: Set up a database name and collection within your MongoDB cluster to store your data.

Step 1: Access the MongoDB Atlas Dashboard

  1. Log in to your MongoDB Atlas account.

  2. In the Atlas dashboard, select the project and cluster where you want to enable the HTTP endpoint.

Step 2: Enable the HTTP Endpoint

  1. In the cluster view, click on "Database Access" in the left sidebar.

  2. Click the "Add New Database User" button to create a database user with the necessary permissions. Make sure to remember the username and password for this user.

  3. Next, click on "Network Access" in the left sidebar and add your current IP address to the IP Whitelist. This allows your current IP to access the cluster.

  4. Once the IP is added, go back to the cluster view and click on "Database Access" again. Edit the user you created earlier and assign the appropriate role, such as "Atlas Admin" or "Read and Write to Any Database."

Step 3: Configure the HTTP Endpoint

  1. In the cluster view, click on "Connect" at the top of the screen.

  2. Click on the "Connect with MongoDB Compass" button.

  3. Follow the instructions to download and install MongoDB Compass, if you haven't already.

  4. Open MongoDB Compass and click on "Fill in connection fields individually."

  5. Enter the following details:

    • Hostname: Found in the MongoDB Atlas cluster view.
    • Port: 27017
    • Authentication: Select "Username / Password" and enter the database user credentials you created in Step 2.
  6. Click "Connect" to establish a connection to your MongoDB cluster.

Step 4: Access Data via HTTP

  1. Once you have connected to your MongoDB cluster using MongoDB Compass, you can access your data via the HTTP endpoint.

  2. To use the code in our project you must to add 9 of method POST HTTP endpoint with following route.

  3. In each route have to enabled on Respond With Result.

  4. In each route have function to link in. It also have to include below code.

  5. In each function setting have to set Authentication to System.

  • /sheet2mongo/insert

      exports = function(payload) {
      const mongodb = context.services.get('mongodb-atlas');
      const col = JSON.parse(payload.body.text()).header;
      const collection = mongodb.db("Your Database Name").collection(col);
      query = JSON.parse(payload.body.text()).query;
    
      return collection.insertOne(query);}
  • /sheet2mongo/insertDate

      exports = function(payload) {
      const mongodb = context.services.get('mongodb-atlas');
      const col = JSON.parse(payload.body.text()).header;
      const collection = mongodb.db("Your Database Name").collection(col);
      query = JSON.parse(payload.body.text()).query;
      query.receiveDate = new Date(query.receiveDate);
    
      return collection.insertOne(query);}
  • /sheet2mongo/find

      exports = function(payload) {
      const mongodb = context.services.get('mongodb-atlas');
      const col = JSON.parse(payload.body.text()).header;
      const collection = mongodb.db("Your Database Name").collection(col);
      query = JSON.parse(payload.body.text()).query;
    
      return collection.find(query).toArray();}
  • /sheet2mongo/findDate

      exports = function(payload) {
      const mongodb = context.services.get('mongodb-atlas');
      const col = JSON.parse(payload.body.text()).header;
      const collection = mongodb.db("Your Database Name").collection(col);
      query = JSON.parse(payload.body.text()).query;
    
      return collection.find({
      $and: [
        { receiveDate: { $gte: new Date(query.sDate) } },
        { receiveDate: { $lte: new Date(query.eDate) } }
        ]
      }).toArray();}
  • /sheet2mongo/updateSet

      exports = function(payload) {
      const mongodb = context.services.get('mongodb-atlas');
      const col = JSON.parse(payload.body.text()).header;
      const collection = mongodb.db("Your Database Name").collection(col);
      filter = JSON.parse(payload.body.text()).filter;
      query = JSON.parse(payload.body.text()).query;
      
      return collection.updateOne(filter,{$set:query}); }
  • /sheet2mongo/updatePush

      exports = function(payload) {
      const mongodb = context.services.get('mongodb-atlas');
      const col = JSON.parse(payload.body.text()).header;
      const collection = mongodb.db("Your Database Name").collection(col);
      filter = JSON.parse(payload.body.text()).filter;
      query = JSON.parse(payload.body.text()).query;
      
      return collection.updateOne(filter,{$push:query});}
  • /sheet2mongo/updatePull

      exports = function(payload) {
      const mongodb = context.services.get('mongodb-atlas');
      const col = JSON.parse(payload.body.text()).header;
      const collection = mongodb.db("Your Database Name").collection(col);
      filter = JSON.parse(payload.body.text()).filter;
      query = JSON.parse(payload.body.text()).query;
      
      return collection.updateOne(filter,{$pull:query});}
  • /sheet2mongo/updateDate

      exports = function(payload) {
      const mongodb = context.services.get('mongodb-atlas');
      const col = JSON.parse(payload.body.text()).header;
      const collection = mongodb.db("Your Database Name").collection(col);
      filter = JSON.parse(payload.body.text()).filter;
      query = JSON.parse(payload.body.text()).query;
      query.finishDate = new Date(query.finishDate);
      
      return collection.updateOne(filter,{$set:query});}
  • /sheet2mongo/remove

      exports = function(payload) {
      const mongodb = context.services.get('mongodb-atlas');
      const col = JSON.parse(payload.body.text()).header;
      const collection = mongodb.db("Your Database Name").collection(col);
      query = JSON.parse(payload.body.text()).query;
    
      return collection.deleteOne(query);}

🛠 Skills

  • Programming Language: HTML, JavaScript, CSS
  • Extensive skills/tools: Line OA,Line Developers,MongoDB, Google Sheets

Authors

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 64.3%
  • HTML 35.7%