新增uni-im相关表

This commit is contained in:
linju 2022-11-04 18:08:49 +08:00
parent 799c0366cd
commit 78063ac2f4
4 changed files with 183 additions and 0 deletions

View File

@ -0,0 +1,62 @@
{
"schema": {
"bsonType": "object",
"required": [],
"permission": {
"read": "doc.owner_uid == auth.uid",
"create": false,
"update": "doc.owner_uid == auth.uid",
"delete": false
},
"properties": {
"_id": {
"description": "ID系统自动生成"
},
"id": {
"description": "会话ID由会话双方用户的id按一定规律排序后的哈希值",
"permission": {
"write": false
}
},
"type": {
"description": "会话类型,区分:群聊和单聊",
"bsonType": "int",
"label": "",
"permission": {
"write": false
}
},
"owner_uid": {
"description": "所属用户id",
"bsonType": "string",
"permission": {
"write": false
}
},
"user_id": {
"description": "对话的用户id",
"permission": {
"write": false
}
},
"group_id": {
"description": "对话的群id",
"permission": {
"write": false
}
},
"unread_count": {
"description": "未读消息数量",
"bsonType": "int"
},
"last_msg_note": {
"description": "最后一条消息概述文本消息的前n个字消息为多媒体时只描述类型"
},
"update_time": {
"bsonType": "timestamp",
"description": "最后一次会话时间"
}
}
},
"index": []
}

View File

@ -0,0 +1,17 @@
{
"name": "@opendb/uni-im-conversation",
"version": "0.0.1",
"description": "uni-im-conversation",
"keywords": ["uni-im","即时通讯"],
"opendb": {
"title": "即时通讯会话",
"type": "collection",
"contributors": [
{
"name": "DCloud_JSON",
"email": "",
"homepage": ""
}
]
}
}

View File

@ -0,0 +1,87 @@
{
"schema": {
"bsonType": "object",
"permission": {
"create": false,
"delete": false,
"read": "auth.uid == doc.to_uid || auth.uid == doc.from_uid",
"update": false
},
"required": [
"to_uid",
"body",
"type"
],
"properties": {
"_id": {
"description": "ID系统自动生成"
},
"from_uid": {
"bsonType": "string",
"description": "消息发送方 UserID用于指定发送消息方帐号",
"forceDefaultValue": {
"$env": "uid"
}
},
"to_uid": {
"bsonType": "string",
"description": "消息接收方 UserID"
},
"group_id": {
"bsonType": "string",
"description": "group_id即消息接收群的id"
},
"body": {
"description": "消息内容包含的键会随type变化。需要自己写valedateFunction验证"
},
"is_read": {
"bsonType": "bool",
"description": "是否已读",
"forceDefaultValue": false
},
"type": {
"bsonType": "string",
"enum": [{
"text": "文本",
"value": "text"
},
{
"text": "图像",
"value": "image"
},
{
"text": "语音",
"value": "sound"
},
{
"text": "视频",
"value": "video"
},
{
"text": "文件",
"value": "file"
},
{
"text": "位置",
"value": "location"
}
]
},
"create_time": {
"bsonType": "timestamp",
"description": "消息发送时间戳",
"forceDefaultValue": {
"$env": "now"
}
},
"client_create_time": {
"bsonType": "timestamp",
"description": "客户端创建消息的时间戳",
"forceDefaultValue": {
"$env": "now"
}
}
}
},
"index": []
}

View File

@ -0,0 +1,17 @@
{
"name": "@opendb/uni-im-msg",
"version": "0.0.1",
"description": "uni-im-msg",
"keywords": ["uni-im","即时通讯"],
"opendb": {
"title": "即时通讯消息",
"type": "collection",
"contributors": [
{
"name": "DCloud_JSON",
"email": "",
"homepage": ""
}
]
}
}