GithubHelp home page GithubHelp logo

note-squared's People

Contributors

chen-gary avatar frida161 avatar lynn-chen avatar timothy-197 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

note-squared's Issues

项目需求&分工

CSC4001 Group Project

1. Requirement & Specification

描述: Web端笔记软件

必须功能(具体见Project Specification.pdf, Page 6):

  • 注册(邮箱验证码)/登录/登出
  • 上传个性化头像
  • 改密码
  • Admin User
  • ...

主要功能:

  • create/modify/delete 笔记
    • 设置私有或公开
    • 允许结构化管理笔记(OneNote)
  • web端笔记编辑器
    • 纯文本(markdown)
      • 分左右两部分 - 简书/overleaf/w3schools
      • github
      • 所见即所得、实时渲染 - typora
    • 富文本(notion)
  • 允许在笔记中添加图片
  • 网站首页(笔记推荐?)
  • 浏览笔记(类似博客)
  • 支持不同笔记格式,背景样式(notability)

次要功能:

  • 移动端支持
  • 笔记搜索功能(搜索自己的笔记 / 搜索所有公开的笔记)
  • fork 他人分享的笔记
  • 收藏
  • 评论功能
  • 合作文档(石墨、overleaf / 可选择开放其他用户编辑权限

2. 开发工具

  • 前端:React / Vue
  • 后端:NodeJS - Express框架
  • 数据库:mySQL / MongoDB
  • 接口:REST API

3. 分工

  • 前端、UI设计:CC, CT
  • 后端、数据库:CHH, HYY

4. 分工:Project Design Document

Project Specification.pdf, Page 8

Latex, Overleaf

  1. INTRODUCTION: CC
  2. BACKGROUND: CHH
  3. SPECIFICATION: CT
  4. SYSTEM ARCHITECTURE: HYY

其他:

项目名字(待定)

  • CSC4001-project

下次开会?

  • 周二晚上9点

Server To-do List

User 相关待办

1. admin

  • 改所有user的 profile info (包括:赋予admin权限)
  • 改所有user的密码
  • user list 分页
  • 改头像?

2. normal user

  • 注册 / 登录

  • 上传/获取 头像

    • 把原先上传的头像删掉
  • 改名

  • 改密码*2(with old password / with email)

  • 改邮箱?

3. user schema

  • 添加个性签名?

4. Others

  • 检查Email syntax

  • 检查password复杂度

  • 昵称最短长度?

笔记部分

  • 编辑/新增/删除 笔记

  • 加folder(分类)

  • 数据库查询笔记 - 结果需要分页

    • 查询结果给所有normal user(仅限public note)

      • 笔记推荐功能(sort by time, sort by 点赞数, 其他算法?)

      • 搜索功能 - 搜索所有public notes(正则匹配?)

    • 查询结果给自己(public + private)

      • 查询自己的所有笔记,包含folder信息
      • 搜索所有自己的笔记
    • 查询结果给admin?(public + private)

      • 查询所有数据库中的笔记
  • fork 他人分享的笔记

  • 点赞?

  • 评论

其他部分

  • 部署到云服务器

presentation guide

Part 1: 普通用户操作

  • 普通用户注册
  • 进入profile界面
    • 修改nickname
    • 设置头像
    • 使用旧密码,设置一次新密码
  • 登出
  • 使用“忘记密码”功能,通过邮箱重置密码
  • 再次登录

Part 2: 普通用户笔记相关操作

  • 创建一个新的笔记

    • 编辑笔记时,上传一张图片
    • 笔记中插入一个公式?
    • 保存并退出
  • 查看新上传的笔记

  • 笔记管理操作:文件夹

    • 创建多个文件夹a1,a2

    • 在某一个文件夹a1下创建多个文件b1,b2,b3

    • 将b3文件移动至a2

    • 删除文件b2

    • 删除文件夹a1

  • Note community:

    • 查看他人的笔记,笔记广场
    • 在笔记广场内查看推荐笔记,并返回广场
    • 点赞他人的笔记(可以点几个),并取消点赞,再再次点赞
    • public search查找一个别人的笔记,并fork这个笔记(可以点几个),然后navigate到文件位置,设置文件位置,查看fork内容
    • 简单编辑这个笔记
    • 接着按照这个笔记的信息在private search查找刚刚fork的笔记

Part 3: Admin用户操作

  • 登录一个提前准备好的admin账号,网页自动跳转到“用户列表”页面
  • user相关管理功能展示
    • 更新另一个账号的profile
    • 更新另一个账号的密码
  • note相关管理功能展示?

Server Deployment Guide

1. Adjust Server Code

  • Change server listening port if needed.

    In app/index.js, update the following code:

    const PORT = 3000
  • Remove console log info if needed.

    In app/index.js, update the following code:

    // print request info from front-end to console
    // (comment this out if you do not want to see the log)
    app.use(morgan('dev'))
  • Update database config if needed.

    Go to app/config/db.js, update the config.

  • Update secret key for jwt signing if needed.

    Go to app/config/key.js, update secret_jwt.

  • Update email and password for sending verification code.

    Go to app/config/nodemailer.config.js, update the following.

    // config of email sender
    const user = "[email protected]"
    const pass = "xxxxxxxxxxxxxxx"
  • [IMPORTANT] Make the server really send the verification code emails.

    • Go to app/router/user/register-email-verification-code.js, uncomment the following:

      // send verification email
      // (temporarily removed)
      //await nodemailer.sendVerificationCode_register(_email, _email, _verificationCode)
    • Go to app/router/user/set-pwd-email-verification-code.js, uncomment the following:

      // send verification email
      // (temporarily removed)
      // await nodemailer.sendVerificationCode_resetPwd(user.name, _email, _verificationCode)

2. Deployment

Tutorial: https://www.youtube.com/watch?v=-oTdaFDvLo4

apt update

#apt install nginx
#service nginx status

apt install mongodb
service mongodb status

apt install npm
npm -v
node -v
# install `n` to manage node version
npm i -g n
n 12

#exit and login to server again
node -v
npm -v

git clone ...

# install dependencies
#npm i -g yarn
#yarn
npm install

#set nginx to deliver static files...

npm i -g pm2

pm2 start ...
#pm2 start app
#pm2 restart app

pm2 status

#set nginx again...
#set server to only listen to localhost...

Note Operations Explanation

Note Operations

This document explains the note apis
All the operations here need user authentication


Post operations

Modify Notes

modify note: create

modify note: edit:

Modify Folders

Modify folder: create

Modify folder: edit

Delete folders / notes

Move notes

Like notes

Fork notes

  • http://localhost:3000/api/note/like-note
  • Function: copy other's note to the local folder (note: only public notes can be forked, you cannot fork your own note)
  • Arguments: noteId (note to be forked), folderId (where the new note will be saved)

Get operations

get single note

Get local folders and notes

get folders & notes formats

get folders and notes:

[
    {
        "folder_id":"6257bde2ae6b2d0f2d28250c",
        "folder_title": "folder 1",
        "folder_name": "1",   // created by frontend automatically, should be posted to backend when creating a new folder
        "note": [
            {
                "note_id": "12345",
                "note_title": "article title",
                "note_description": "balabala",
                "mode": "public/privacy" 
                // other infomation: liked num, comments num, ... (optional)
            },
            {
                "note_id": "123456",
                "note_title": "article title",
                "note_description": "balabala",
                "mode": "public/privacy"
            }
        ]
    },
    {
        "folder_id":"6257bde2ae6b2d0f2d28250d",
        "folder_title": "folder 2",
        "folder_name": "2", 
        "note":[]
    }
]

get folders

[
    {
        "folder_id":"6257bde2ae6b2d0f2d28250c",
        "folder_title": "folder 1",
        "folder_name": "1",   // created by frontend automatically, should be posted to backend when creating a new folder
    },
    {
        "folder_id":"6257bde2ae6b2d0f2d28250d",
        "folder_title": "folder 2",
        "folder_name": "2", 
    }
]

implmentation suggestion
change the "/note/local-folder-notes-get" method to be post
according to different params:
{ withNote: true/false }
return different data

Run Server in Local Computer

1. Environment

  • Node.js

    Server will run in port 3000 (i.e. localhost:3000)

  • MongoDB

    完全使用默认配置

    • 保证 MongoDB daemon 运行在 port 27017
    • 不设置数据库用户名、密码
    • 运行 server 后,会自动创建名为 note_squared 的数据库,可使用MongoDB Compass查看

2. Run Server

cd /note-squared/server

# 安装依赖
npm install

# 使用 nodemon 运行 server(如果修改 server 代码,会自动 restart)
npm run dev

# OR 使用以下命令(如果修改 server 代码,不会自动 restart)
npm run start

3. 其他注意事项

  • 如何获得一个带有 admin 权限的账号?

    现在无法直接注册带有 admin 权限的账号了,需要手动修改数据库: users => role,手动改为admin / normal

image

  • 注册时,需要验证邮箱吗?

    目前调用获取邮箱验证码的API后,验证码会直接返回给前端,所以即使填了假邮箱也没事。

    如果需要测试邮件是否真的能发送,找到server/app/router/user/register_emailVerificationCode.js文件中以下代码:

    // send verification email
    // (temporarily removed)
    //await nodemailer.sendVerificationCode(_email, _email, _verificationCode)

    删掉最后一行的注释即可。

About testing (the content in the request body)

测试参考:

鉴于后端测试的时候照着脚本一个一个填写req.body的元素有些麻烦,这里列出填写内容参考:
需要填写body的post:

  • register-email-verification

email: [email protected]
password: 123
name: tim

  • register

email: [email protected]
password: 123
name: tim
verification code: mGXy

  • login

id: 6252f5d83c277bd5d3b97d0e
email: [email protected]
password: 123

  • upload pic (need authentication token)

picture: local path

  • modify note - post (need authentication token)

mode: edit / new
folderId: 9089089-98
title: hyy_blog
description: this is a test
contentMD: holle word!!!!!
visibility: public / private
noteId: 794y59237534589

  • modify folder -post (need authentication token)

title: hyy_directory
folderId: 7889880909898

  • delete note - post (need authentication token)

noteId: the id of the note to be deleted
folderId: the folder that the note is attached to

  • delete folder - post (need authentication token)

folderId: the folder to be deleted

  • move note - post (need authentication token)

noteId: the id of the note to be deleted
oldFolderId: the folder to move out the note
newFolderId: the folder to move in the note

  • like note - post (need authentication token)

mode: like / dislike
noteId: the note to be liked or disliked

  • fork note - post (need authentication token)

noteId: the note to fork
folderId: the folder to save the forked note

  • get single note - get

params: noteId

  • get local folders and notes - get (need authentication token)

no input

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.