GithubHelp home page GithubHelp logo

mkild / dental-admin-api Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 729 KB

基于Node.js koa2 的 牙科诊所管理系统 API | Dental Admin API based on koa2

License: GNU Affero General Public License v3.0

JavaScript 94.65% Shell 0.12% CSS 3.44% HTML 1.78%
koa2 sequelize koa-router koa-passport log4js mysql agpl-v3 nodejs

dental-admin-api's Introduction

Dental Admin API

dental-admin-api

koa sequelize koa-router koa-passport log4js MySQL version license

Dental Admin API 牙科诊所管理系统 API

基于 Node.js koa2 的 牙科诊所管理系统 API | Dental Admin API based on koa2

同时使用了:ORM sequelize,路由 koa-router,认证中间件 koa-passport, 日志模块 log4js, 关系型数据库 MySQL...

简介

一个平平无奇的 web 后台管理系统的接口,提供 牙科诊所管理系统 的接口。

前后端分离。

密码进行简单加密(MD5 + uuid)。

基于 Token(JWT) 实现登录注册和权限认证。

包含以下模块:

用户模块、公告模块、科室模块、药品模块、病历模块、收费统计模块、收入统计模块、门诊量统计模块、问题反馈模块等。

更多接口有待后续开发。

提供接口文档,文档使用 Apifox 生成。

为方便使用,接口全部使用 GET 或 POST

接口文档指路: 接口文档在线分享

前端在我的另一个仓库:dental-admin

前端指路: dental-admin

快速启动

首先确保 Node.jsMySQL 已经安装且能正常运行。

作为参考,我的 Node.js 版本是16.14.0,MySQL 版本是8.0.22,其他版本请自行测试。

# 克隆项目
# cnpmjs
git clone https://github.com.cnpmjs.org/Mkild/dental-admin-api.git
# or
git clone https://github.com/Mkild/dental-admin-api.git
# 进入项目目录
cd dental-admin-api
# 安装依赖
npm install
# 修改MySQL配置
# 修改根目录下config文件夹中的 mysql_config.js 和 mysql_sequelize.js 中的配置
# 将user、password等修改成你自己MySQL中的user、password等
# 为方便使用、降低使用门槛才将配置信息保存在项目根目录,请注意保护好自己的配置信息,采用其他方式保管
# 启动服务 (默认为http://localhost:3000)
npm run start  / nodemon

工程化

dental-admin-api's People

Contributors

mkild avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dental-admin-api's Issues

同学,您这个项目引入了483个开源组件,存在9个漏洞,辛苦升级一下

检测到 Mkild/dental-admin-api 一共引入了483个开源组件,存在9个漏洞

漏洞标题:nodejs ejs远程代码执行漏洞
缺陷组件:[email protected]
漏洞编号:CVE-2017-1000228
漏洞描述:nodejs ejs是一款嵌入式JavaScript模板,它具有流量控制、自定义分隔符和转义输出等功能。

nodejs ejs 2.5.3之前的版本中的‘ejs.renderFile()’函数存在远程代码执行漏洞,该漏洞源于较弱的输入验证。远程攻击者可利用该漏洞执行代码。 
国家漏洞库信息:https://www.cnvd.org.cn/flaw/show/CNVD-2017-36621
影响范围:(∞, 2.5.3)
最小修复版本:2.5.3
缺陷组件引入路径:[email protected]>[email protected]

另外还有9个漏洞,详细报告:https://mofeisec.com/jr?p=a1c537

[Bug] \node_modules\sequelize\lib\dialects\mysql\query.js 建表错误

Ignoring invalid configuration option passed to Connection: collate. This is currently a warning, but in future versions of MySQL2, an error will be thrown if 
you pass an invalid configuration option to a Connection
Ignoring invalid configuration option passed to Connection: collate. This is currently a warning, but in future versions of MySQL2, an error will be thrown if 
you pass an invalid configuration option to a Connection
Ignoring invalid configuration option passed to Connection: collate. This is currently a warning, but in future versions of MySQL2, an error will be thrown if 
you pass an invalid configuration option to a Connection
Ignoring invalid configuration option passed to Connection: collate. This is currently a warning, but in future versions of MySQL2, an error will be thrown if 
you pass an invalid configuration option to a Connection
Ignoring invalid configuration option passed to Connection: collate. This is currently a warning, but in future versions of MySQL2, an error will be thrown if 
you pass an invalid configuration option to a Connection
Ignoring invalid configuration option passed to Connection: collate. This is currently a warning, but in future versions of MySQL2, an error will be thrown if 
you pass an invalid configuration option to a Connection
Executing (default): CREATE TABLE IF NOT EXISTS `user` (`id` INTEGER NOT NULL auto_increment , `username` VARCHAR(255) NOT NULL UNIQUE, `password` VARCHAR(255) NOT NULL, `salt` VARCHAR(255) NOT NULL, `state` TINYINT(1) NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;
Executing (default): CREATE TABLE IF NOT EXISTS `user_role` (`id` INTEGER NOT NULL auto_increment , `username` VARCHAR(255) NOT NULL, `role_id` INTEGER NOT NULL, PRIMARY KEY (`id`), FOREIGN KEY (`username`) REFERENCES `user` (`username`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE) ENGINE=InnoDB;
Executing (default): CREATE TABLE IF NOT EXISTS `role` (`id` INTEGER NOT NULL auto_increment , `rolename` VARCHAR(255) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;
Executing (default): CREATE TABLE IF NOT EXISTS `user_detail` (`id` INTEGER NOT NULL auto_increment , `name` VARCHAR(255), `username` VARCHAR(255) NOT NULL, `gender` VARCHAR(255), `phone` VARCHAR(255), `email` VARCHAR(255), PRIMARY KEY (`id`), FOREIGN KEY (`username`) REFERENCES `user` (`username`) ON DELETE CASCADE 
ON UPDATE CASCADE) ENGINE=InnoDB;
Executing (default): CREATE TABLE IF NOT EXISTS `notice` (`id` INTEGER NOT NULL auto_increment , `title` VARCHAR(255) NOT NULL, `author` VARCHAR(255) NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`), FOREIGN KEY (`author`) REFERENCES `user` (`username`) ON DELETE NO ACTION ON UPDATE CASCADE) ENGINE=InnoDB;
Executing (default): CREATE TABLE IF NOT EXISTS `notice_text` (`id` INTEGER NOT NULL auto_increment , `notice_id` INTEGER NOT NULL, `text` TEXT NOT NULL, PRIMARY KEY (`id`), FOREIGN KEY (`notice_id`) REFERENCES `notice` (`id`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB;
Executing (default): CREATE TABLE IF NOT EXISTS `department` (`id` INTEGER NOT NULL auto_increment , `name` VARCHAR(255) NOT NULL UNIQUE, `director` VARCHAR(255) NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;
C:\Users\Desktop\dental-admin-api-master\node_modules\sequelize\lib\dialects\mysql\query.js:239
        return new sequelizeErrors.DatabaseError(err);
               ^
      at Socket.emit (node:events:526:28)
      at addChunk (node:internal/streams/readable:315:12)
      at readableAddChunk (node:internal/streams/readable:289:9)
      at Socket.Readable.push (node:internal/streams/readable:228:10)
      at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
    code: 'ER_FK_CANNOT_OPEN_PARENT',
    errno: 1824,
    sqlState: 'HY000',
    sqlMessage: "Failed to open the referenced table 'role'",
    sql: 'CREATE TABLE IF NOT EXISTS `user_role` (`id` INTEGER NOT NULL auto_increment , `username` VARCHAR(255) NOT NULL, `role_id` INTEGER NOT NULL, PRIMARY 
KEY (`id`), FOREIGN KEY (`username`) REFERENCES `user` (`username`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE) ENGINE=InnoDB;',
    parameters: undefined
  },
  original: Error: Failed to open the referenced table 'role'
      at Socket.emit (node:events:526:28)
      at addChunk (node:internal/streams/readable:315:12)
      at readableAddChunk (node:internal/streams/readable:289:9)
      at Socket.Readable.push (node:internal/streams/readable:228:10)
      at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
    code: 'ER_FK_CANNOT_OPEN_PARENT',
    errno: 1824,
    sqlState: 'HY000',
    sqlMessage: "Failed to open the referenced table 'role'",
    sql: 'CREATE TABLE IF NOT EXISTS `user_role` (`id` INTEGER NOT NULL auto_increment , `username` VARCHAR(255) NOT NULL, `role_id` INTEGER NOT NULL, PRIMARY 
KEY (`id`), FOREIGN KEY (`username`) REFERENCES `user` (`username`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE) ENGINE=InnoDB;',
    parameters: undefined
  },
  sql: 'CREATE TABLE IF NOT EXISTS `user_role` (`id` INTEGER NOT NULL auto_increment , `username` VARCHAR(255) NOT NULL, `role_id` INTEGER NOT NULL, PRIMARY KEY (`id`), FOREIGN KEY (`username`) REFERENCES `user` (`username`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE) ENGINE=InnoDB;',
  parameters: undefined
}

错误有两处:
1、建表recorde时,引用department表中dp作为外键时,会出现无法引用的问题,看了一下是因为dp不是pk而且不是unique,修改之后好了。

2、如上面的error log,role表无法引用,但是在日志里可以看到role已经顺利建表了,我尝试直接在myusql workbench中运行代码CREATE TABLE IF NOT EXISTS `user_role` (`id` INTEGER NOT NULL auto_increment , `username` VARCHAR(255) NOT NULL, `role_id` INTEGER NOT NULL, PRIMARY KEY (`id`), FOREIGN KEY (`username`) REFERENCES `user` (`username`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE) ENGINE=InnoDB;,意外好用,但仍不知道为啥。

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.