You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
rustdreamer ad37c1bbba
continuous-integration/drone/push Build is passing Details
修改 apk
2 years ago
.vscode 增加厂区接口 2 years ago
src 修改 apk 2 years ago
test first commit 3 years ago
.drone.yml 增加自动部署 2 years ago
.eslintrc.js first commit 3 years ago
.gitignore first commit 3 years ago
.prettierrc first commit 3 years ago
Dockerfile 修改 apk 2 years ago
README.md first commit 3 years ago
development.env 增加接口 2 years ago
dump.rdb first commit 3 years ago
nest-cli.json first commit 3 years ago
package-lock.json fix 3 years ago
package.json 增加接口 2 years ago
production.env 完善 3 years ago
swagger-spec.json 修改 apk 2 years ago
test.env first commit 3 years ago
tsconfig.build.json first commit 3 years ago
tsconfig.json first commit 3 years ago
yarn.lock 增加接口 2 years ago

README.md

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

Nest framework TypeScript starter repository.

node version

>=16.15 

Installation

$ yarn install

Running the app

# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run start:prod

运行迁移文件

$ yarn run migration:run

Test

# unit tests
$ yarn run test

# e2e tests
$ yarn run test:e2e

# test coverage
$ yarn run test:cov

migration 迁移

  1. 创建迁移文件
    $ yarn run migration:create ./migrations/fileName # fileName 就是要创建的文件名,成功后会在migrations文件夹下生成${timestamp}-fileName.ts的迁移文件
    
  2. 运行迁移文件
    $ yarn run migration:run #该命令会运行所有的迁移文件,运行过的不会运行
    
  3. 回退迁移
    $ yarn run migration:revert #该命令会回退最近一个迁移,如果要退回到某个版本必须多次运行
    

questions

  1. 想Joi、dotenv等包应该是升级到最新版本了es6导入方式请使用
       import * as Joi from 'Joi'
    

迁移问题

开发环境中可以使用synchronize: true,实时同步数据库中字段但在生产环境中请禁用该配置如果在开发环境中使用该配置修改数据库字段类型时可能导致数据丢失请使migrations

migrations

使用migration迁移时可能报

con not find module '../xxx'

解决方案:项目中请使用相对路径导入例如:'import xxx from '../../xxx',当然migration只涉及到entity文件和migrations中的迁移文件所以请保证这些文件使用相对路径导入的方式

目录结构

api
├─ .drone.yml
├─ .eslintrc.js
├─ .prettierrc
├─ Dockerfile
├─ README.md
├─ development.env # 开发环境配置文件
├─ dump.rdb
├─ migrations  # 迁移文件
├─ nest-cli.json
├─ package-lock.json
├─ package.json
├─ patches
│  └─ co-wechat-api+3.11.0.patch
├─ production.env                   # 生产环境配置文件
├─ src                              #主程序
│  ├─ ali-apy                       # 阿里云支付
│  │  ├─ ali-pay-api.ts
│  │  └─ index.ts
│  ├─ app.controller.spec.ts
│  ├─ app.controller.ts
│  ├─ app.module.ts
│  ├─ app.service.ts
│  ├─ auth                         # 用户鉴权和登录
│  ├─ comment                       # 测试者测试项目的留言模块
│  ├─ common                         # 一些公用模块
│  ├─ config                       # 数据库等配置文件
│  ├─ file                         # 文件上传模块
│  ├─ industry                     # 系统配置中行业选项
│  ├─ invoicing                    # 开发票记录
│  ├─ job                          # 系统配置 职业经历配置
│  ├─ lib
│  ├─ main.ts
│  ├─ project                       # 企业端项目模块
│  ├─ project-module                # 项目组件
│  ├─ project-module-templage           # 系统配置项目模版组件
│  ├─ project-template                # 系统配置项目模版,包含测试者模拟测试项目及企业端创建项目时选择的模版
│  ├─ question                     # 系统配置测试者问题模块
│  ├─ recharge-give-count-history    # 企业充值或者赠送点数给企业的记录
│  ├─ recharge-order                # 企业充值订单
│  ├─ recruit-tester             # 招募测试者
│  ├─ redis                      # redis
│  ├─ simulate-result             # 测试者模拟测试回答组件模块
   ├─ simulate-result            # 测试者模拟测试项目
│  ├─ statics
│  ├─ team                       # 团队模块
│  ├─ team-member                # 团队成员
│  ├─ tester                     # 测试者接受测试项目
│  ├─ tester-account             # 测试者账户模块
│  ├─ tester-anwser              # 测试者正是式测试回答组件
│  ├─ tester-project             # 推送给测试者的项目列表
│  ├─ user                       # 系统用户
│  └─ wechat                     # 微信支付
├─ swagger-spec.json 
├─ test                          # 集成测试
│  ├─ app.e2e-spec.ts
│  └─ jest-e2e.json
├─ test.env
├─ tsconfig.build.json
├─ tsconfig.json
├─ upload                         # 上传的文件
│  └─ file
└─ yarn.lock