Skip to content

数据库交互API #8

@jayjiahua

Description

@jayjiahua

如无特殊说明,以下callback函数的都有两个参数:err和result

1. user模块

1. getUserById(id, callback);
// id 为用户id
result = {username: string,
           password: string,
           nickname: string
           }
2. login(username, password, callback);
result = user (if exist)
3. addUser(userInfor, callback);
userInfor = {username: string,
             password: string,
            ...
          }
result.affectedRows   // 影响行数
4. updateUserById(id, userInfor, callback);
result.affectedRows   // 影响行数

2. team模块

1.  getTeamsByActivityId(id, callback);
result = [ {
             teamname: string,
             create_time: string,
            .... 
            }, {}
           ]
2. addTeam: (teamInfo, userId, callback);  // 新增队伍
result.affectedRows   // 影响行数
3. getUsersInTeam: (teamId, callback);
result = [{
             username: string,
             nickname: string,
            ....
               }, {}, {}...]
4. deleteTeamById: (teamId, userId, callback); // 删除队伍

5. addTeammate: (info, callback); // 添加队员
info = {role: 1/2
            user_id: num
            team_id: num}

3. activity 模块

1. addActivity: (activityInfo, callback);   // 增加活动
activityInfo = { name: string,
         content: string,
         start_time: string,
         end_time: string,
           tag: string}
2. getAllActivities: (callback);
result: list of the activities
3. getActivityById(id, callback);
result = {
               name: string,
              content: string,
             start_time: string,
         ...}
4. deleteActivityById(id, callback);
result.affectedRows   // 影响行数

随着功能的完善将持续更新

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions