mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-30 04:05:39 +00:00
Fix create doc (#2672)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
117f9f291a
commit
dae9de4800
@ -45,10 +45,7 @@
|
||||
// date = new Date().getTime() + value.shift
|
||||
// }
|
||||
if (date === undefined) return
|
||||
const _id = await client.createDoc(calendar.class.Event, space, {
|
||||
attachedTo,
|
||||
attachedToClass,
|
||||
collection: 'reminders',
|
||||
const _id = await client.addCollection(calendar.class.Event, space, attachedTo, attachedToClass, 'reminders', {
|
||||
date,
|
||||
description: '',
|
||||
participants,
|
||||
|
@ -36,13 +36,13 @@
|
||||
async function onMessage (event: CustomEvent) {
|
||||
const { message, attachments } = event.detail
|
||||
const me = getCurrentAccount()._id
|
||||
await client.createDoc<Message>(
|
||||
await client.addCollection(
|
||||
_class,
|
||||
space,
|
||||
space,
|
||||
chunter.class.ChunterSpace,
|
||||
'messages',
|
||||
{
|
||||
attachedTo: space,
|
||||
attachedToClass: chunter.class.ChunterSpace,
|
||||
collection: 'messages',
|
||||
content: message,
|
||||
createOn: Date.now(),
|
||||
createBy: me,
|
||||
@ -59,12 +59,9 @@
|
||||
chunterSpace.members
|
||||
.filter((accId) => accId !== me)
|
||||
.map((accId) =>
|
||||
client.createDoc(notification.class.LastView, space, {
|
||||
client.addCollection(notification.class.LastView, space, space, chunterSpace._class, 'lastViews', {
|
||||
user: accId,
|
||||
lastView: 0,
|
||||
attachedTo: space,
|
||||
attachedToClass: chunterSpace._class,
|
||||
collection: 'lastViews'
|
||||
lastView: 0
|
||||
})
|
||||
)
|
||||
)
|
||||
|
@ -195,13 +195,17 @@
|
||||
|
||||
const reaction = reactions?.find((r) => r.emoji === emoji && r.createBy === me)
|
||||
if (!reaction) {
|
||||
await client.createDoc(chunter.class.Reaction, message.space, {
|
||||
attachedTo: message._id,
|
||||
attachedToClass: chunter.class.ChunterMessage,
|
||||
emoji,
|
||||
createBy: me,
|
||||
collection: 'reactions'
|
||||
})
|
||||
await client.addCollection(
|
||||
chunter.class.Reaction,
|
||||
message.space,
|
||||
message._id,
|
||||
chunter.class.ChunterMessage,
|
||||
'reactions',
|
||||
{
|
||||
emoji,
|
||||
createBy: me
|
||||
}
|
||||
)
|
||||
} else {
|
||||
await client.removeDoc(chunter.class.Reaction, message.space, reaction._id)
|
||||
}
|
||||
|
@ -152,13 +152,13 @@
|
||||
async function onMessage (event: CustomEvent) {
|
||||
const { message, attachments } = event.detail
|
||||
const me = getCurrentAccount()._id
|
||||
await client.createDoc(
|
||||
await client.addCollection(
|
||||
chunter.class.ThreadMessage,
|
||||
currentSpace,
|
||||
_id,
|
||||
chunter.class.Message,
|
||||
'replies',
|
||||
{
|
||||
attachedTo: _id,
|
||||
attachedToClass: chunter.class.Message,
|
||||
collection: 'replies',
|
||||
content: message,
|
||||
createBy: me,
|
||||
createOn: Date.now(),
|
||||
|
@ -41,10 +41,7 @@
|
||||
} else if (status && !newStatus) {
|
||||
client.removeDoc(contact.class.Status, status.space, status._id)
|
||||
} else {
|
||||
client.createDoc(contact.class.Status, employee!.space, {
|
||||
attachedTo: employeeId,
|
||||
attachedToClass: contact.class.Employee,
|
||||
collection: 'statuses',
|
||||
client.addCollection(contact.class.Status, employee!.space, employeeId, contact.class.Employee, 'statuses', {
|
||||
name: newStatus.name,
|
||||
dueDate: newStatus.dueDate
|
||||
})
|
||||
|
@ -62,7 +62,8 @@
|
||||
async function createCustomer () {
|
||||
const candidate: Data<Contact> = {
|
||||
name: formatName(targetClass._id, firstName, lastName, object.name),
|
||||
city: object.city
|
||||
city: object.city,
|
||||
createOn: Date.now()
|
||||
}
|
||||
if (avatar !== undefined) {
|
||||
candidate.avatar = await avatarEditor.createAvatar()
|
||||
|
@ -129,16 +129,16 @@
|
||||
async function onMessage (event: CustomEvent) {
|
||||
if (channel === undefined) return
|
||||
const { message, attachments } = event.detail
|
||||
await client.createDoc(
|
||||
await client.addCollection(
|
||||
telegram.class.NewMessage,
|
||||
telegram.space.Telegram,
|
||||
channel._id,
|
||||
channel._class,
|
||||
'newMessages',
|
||||
{
|
||||
content: message,
|
||||
status: 'new',
|
||||
attachments,
|
||||
attachedTo: channel._id,
|
||||
attachedToClass: channel._class,
|
||||
collection: 'newMessages'
|
||||
attachments
|
||||
},
|
||||
objectId
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user