npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wusyou.baby.data-model

v0.1.2

Published

务实小孩应用的数据模型定义

Downloads

5

Readme

baby.data-model

务实小孩应用的数据模型定义


model.api

model.api 提供的general接口

model.api.new(arg, cb)      //除了Parent都可以用
model.api.remove(arg, cb)   //不能用于 Parent , Teacher
model.api.update(arg, cb)   //用于所有类 (因为operator上加了限制)
model.api.query(arg, cb)    //用于所有类
// cb(err, docs)
// arg格式见后面

arg的json格式

  • arg.class_name 作用在哪个类
  • arg.new_data 用于new和update的json
  • arg.query 用于提供查询信息的 json

arg.query

示例:

  {
     class:{    //针对class级的查询限制(比如limit数量)
         fun_name:fun_arg  //比如 limit:10
     }        
     fields:{ //针对每个field级的查询限制
         field_name:[fun_name, condition] // name:[equalTo, '张鑫语']
     } 
  }
  

arg.new_data

示例:

 {
    field_name: { //对于每个field,数据该如何更新+创建
        data:{} //对于该field要传入的数据(可以是对象,或者任何类型)
        operators:"" //要使用的operator,比如$set, 默认为$set, 也可是数组(operator级联操作, 会一个操作很可能arg中的data)
        info:{
           compare_on:"", //从数组中pull的时候,根据什么比较(默认==)
           class_name:""  //$instance 的时候,成为什么类的实例                                                             
        }                                                                                    
    }     
  }
    

operators

model.api.User

由于用户操作比较特殊, 这里分出了部分api

电话号码一键登录+注册接口

重置密码接口

更多

  1. 要给 School 设置beforeSavehook,来检测name的重复性, afterDelete来删除所有其相关的班级

  2. 在 Class 中添加school属性, 之后定义cloud函数,beforeDelete来把相关 School 中的班级删除, 完成数据完整性的保证。