diff --git a/collection/uni-im-conversation/collection.json b/collection/uni-im-conversation/collection.json index f82cd15..659e117 100644 --- a/collection/uni-im-conversation/collection.json +++ b/collection/uni-im-conversation/collection.json @@ -3,9 +3,9 @@ "bsonType": "object", "required": [], "permission": { - "read": "doc.owner_uid == auth.uid", + "read": "doc.user_id == auth.uid", "create": false, - "update": "doc.owner_uid == auth.uid", + "update": "doc.user_id == auth.uid", "delete": false }, "properties": { @@ -26,15 +26,15 @@ "write": false } }, - "owner_uid": { + "user_id": { "description": "所属用户id", "bsonType": "string", "permission": { "write": false } }, - "user_id": { - "description": "对话的用户id", + "friend_uid": { + "description": "对话的好友的用户id", "permission": { "write": false } @@ -47,14 +47,18 @@ }, "unread_count": { "description": "未读消息数量", - "bsonType": "int" + "bsonType": "int", + "defaultValue": 0 }, "last_msg_note": { "description": "最后一条消息概述(文本消息的前n个字,消息为多媒体时只描述类型)" }, "update_time": { "bsonType": "timestamp", - "description": "最后一次会话时间" + "description": "最后一次会话时间", + "defaultValue": { + "$env": "now" + } } } }, diff --git a/collection/uni-im-conversation/package.json b/collection/uni-im-conversation/package.json index 9cd64c8..40adcc4 100644 --- a/collection/uni-im-conversation/package.json +++ b/collection/uni-im-conversation/package.json @@ -1,6 +1,6 @@ { "name": "@opendb/uni-im-conversation", - "version": "0.0.1", + "version": "0.0.2", "description": "uni-im-conversation", "keywords": ["uni-im","即时通讯"], "opendb": { diff --git a/collection/uni-im-friend-invite/collection.json b/collection/uni-im-friend-invite/collection.json new file mode 100644 index 0000000..3ed1b99 --- /dev/null +++ b/collection/uni-im-friend-invite/collection.json @@ -0,0 +1,71 @@ +{ + "schema": { + "bsonType": "object", + "required": [], + "permission": { + "read": "doc.to_uid == auth.uid || doc.from_uid == auth.uid", + "create": true, + "update": "doc.to_uid == auth.uid", + "delete": "doc.to_uid == auth.uid" + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "from_uid": { + "description": "发出邀请的用户id", + "bsonType": "string", + "forceDefaultValue": { + "$env": "uid" + }, + "foreignKey": "uni-id-users._id" + }, + "to_uid": { + "defaultValue": "接收邀请的用户id", + "bsonType": "string", + "enum": { + "collection": "uni-id-users", + "field": "_id as value,username as text" + }, + "foreignKey": "uni-id-users._id" + }, + "message": { + "bsonType": "string", + "description": "申请加群的验证或请求信息" + }, + "creat_time": { + "bsonType": "timestamp", + "description": "申请入群时间", + "forceDefaultValue": { + "$env": "now" + } + }, + "state": { + "bsonType": "int", + "description": "状态", + "enum": [{ + "text": "待处理", + "value": 0 + }, + { + "text": "已同意", + "value": 100 + }, + { + "text": "已拒绝", + "value": -100 + } + ], + "forceDefaultValue": 0 + }, + "update_time": { + "bsonType": "timestamp", + "description": "更新申请入群时间(多次申请加入更新此字段)", + "forceDefaultValue": { + "$env": "now" + } + } + } + }, + "index": [] +} diff --git a/collection/uni-im-friend-invite/package.json b/collection/uni-im-friend-invite/package.json new file mode 100644 index 0000000..6c8114c --- /dev/null +++ b/collection/uni-im-friend-invite/package.json @@ -0,0 +1,17 @@ +{ + "name": "@opendb/uni-im-friend-invite", + "version": "0.0.1", + "description": "uni-im-friend-invite", + "keywords": ["uni-im","即时通讯"], + "opendb": { + "title": "uni-im邀请用户成为好友", + "type": "collection", + "contributors": [ + { + "name": "DCloud_JSON", + "email": "", + "homepage": "" + } + ] + } +} diff --git a/collection/uni-push-message/collection.json b/collection/uni-push-message/collection.json new file mode 100644 index 0000000..b280a87 --- /dev/null +++ b/collection/uni-push-message/collection.json @@ -0,0 +1,25 @@ +{ + "schema": { + "bsonType": "object", + "required": [], + "permission": { + "read": true, + "create": false, + "update": "doc.user_id == auth.uid", + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "is_read": { + "bsonType": "bool", + "defaultValue": false + }, + "payload": { + "state": {} + } + } + }, + "index": [] +} diff --git a/collection/uni-push-message/package.json b/collection/uni-push-message/package.json new file mode 100644 index 0000000..0418500 --- /dev/null +++ b/collection/uni-push-message/package.json @@ -0,0 +1,17 @@ +{ + "name": "@opendb/uni-push-message", + "version": "0.0.1", + "description": "uni-push-message", + "keywords": ["uni-push","即时通讯"], + "opendb": { + "title": "统一推送消息记录", + "type": "collection", + "contributors": [ + { + "name": "DCloud_JSON", + "email": "", + "homepage": "" + } + ] + } +}