Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • J jz-api-core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • jizhi-backend
  • jz-api-core
  • Wiki
  • Home

Last edited by xigua Sep 16, 2017
Page history
This is an old version of this page. You can view the most recent version or browse the history.

Home

jz-api-core 提供的基础功能模块

  • DBService - 直接对mongo数据库进行查询、统计等操作
  • Server - 服务器相关,用于初始化Hapi服务器
  • Logger - Log服务
  • Mongo - Mongo数据库的schema定义,一般不需要直接使用
  • CacheService - 一般DBService内部调用
  • Common - 通用的一些对象的申明
  • Lib - 一些常用方法库
  • AuthService - 权限校验服务,一般不用直接调用
  • EntityResolver - 生成的Graphql调用的方法,一般不直接调用
  • Hooks - 一般不直接使用

Common

  • 定义了一些和config文件对应的对象类型,一般不需要直接使用。有帮助的一些对象如下
  • Entity - 所有数据库对象的基础,默认包含6个缺省的字段
    1. _id
    2. createdAt - 创建时间的timestamp(毫秒)
    3. createdBy - 创建用户的id
    4. updatedAt - 最近一次更改时间的timestamp(毫秒)
    5. updatedBy - 最近一次更改人的id
    6. isRemove - true表示该记录被标记为删除,整个系统只有软删除,缺省值为false
  • MutationResult - graphql mutation的结果
    1. success - 是否操作成功
    2. error - 如有错误则包含错误信息
  • MutationSuccess - 上面MutationResult的一个实例,返回{success: true}
  • Me - 当前登录用户的信息,默认只包含两个field,这个信息由框架在用户登录的时候自动填写
    1. id - 用户的id
    2. role - 当前用户的角色
  • SysAdmin - 上面Me的一个实例,用于指代系统管理员,用户比如cron job中创建临时Context时设置Me信息
  • AnonymousUser - Me的另一个实例
Clone repository
  • Home
  • jz backend project skeleton