diff --git a/collection/uni-im-conversation/collection.json b/collection/uni-im-conversation/collection.json new file mode 100644 index 0000000..f82cd15 --- /dev/null +++ b/collection/uni-im-conversation/collection.json @@ -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": [] +} diff --git a/collection/uni-im-conversation/package.json b/collection/uni-im-conversation/package.json new file mode 100644 index 0000000..9cd64c8 --- /dev/null +++ b/collection/uni-im-conversation/package.json @@ -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": "" + } + ] + } +} diff --git a/collection/uni-im-msg/collection.json b/collection/uni-im-msg/collection.json new file mode 100644 index 0000000..b86232a --- /dev/null +++ b/collection/uni-im-msg/collection.json @@ -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": [] +} diff --git a/collection/uni-im-msg/package.json b/collection/uni-im-msg/package.json new file mode 100644 index 0000000..f749b8b --- /dev/null +++ b/collection/uni-im-msg/package.json @@ -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": "" + } + ] + } +}