|
1 | 1 | // import { createUserJoinJob } from 'queue/jobs'; |
2 | 2 |
|
3 | | -import { ChannelType, prisma } from '@linen/database'; |
4 | | -import { notifyChannels } from 'services/channels/userJoined'; |
| 3 | +// import { ChannelType, prisma } from '@linen/database'; |
| 4 | +// import { notifyChannels } from 'services/channels/userJoined'; |
5 | 5 |
|
6 | 6 | export type UserJoin = { |
7 | 7 | userId: string; |
8 | 8 | }; |
9 | 9 |
|
10 | 10 | export async function eventUserJoin(event: UserJoin) { |
11 | | - await Promise.allSettled([ |
12 | | - userJoinTask(event), // run it synchronously |
13 | | - ]); |
| 11 | + // await Promise.allSettled([ |
| 12 | + // userJoinTask(event), // run it synchronously |
| 13 | + // ]); |
14 | 14 | } |
15 | 15 |
|
16 | | -const userJoinTask = async (payload: { userId: string }) => { |
17 | | - const user = await prisma.users.findUnique({ |
18 | | - where: { id: payload.userId }, |
19 | | - include: { auth: true, account: true }, |
20 | | - }); |
| 16 | +// const userJoinTask = async (payload: { userId: string }) => { |
| 17 | +// const user = await prisma.users.findUnique({ |
| 18 | +// where: { id: payload.userId }, |
| 19 | +// include: { auth: true, account: true }, |
| 20 | +// }); |
21 | 21 |
|
22 | | - if (user && user.auth && user.account) { |
23 | | - const channels = await prisma.channels.findMany({ |
24 | | - select: { id: true, channelName: true }, |
25 | | - where: { |
26 | | - accountId: user.account.id, |
27 | | - hidden: false, |
28 | | - default: true, |
29 | | - type: ChannelType.PUBLIC, |
30 | | - }, |
31 | | - }); |
| 22 | +// if (user && user.auth && user.account) { |
| 23 | +// const channels = await prisma.channels.findMany({ |
| 24 | +// select: { id: true, channelName: true }, |
| 25 | +// where: { |
| 26 | +// accountId: user.account.id, |
| 27 | +// hidden: false, |
| 28 | +// default: true, |
| 29 | +// type: ChannelType.PUBLIC, |
| 30 | +// }, |
| 31 | +// }); |
32 | 32 |
|
33 | | - if (channels.length) { |
34 | | - await prisma.memberships.createMany({ |
35 | | - data: channels.map((c) => { |
36 | | - return { |
37 | | - usersId: user.id, |
38 | | - channelsId: c.id, |
39 | | - }; |
40 | | - }), |
41 | | - skipDuplicates: true, |
42 | | - }); |
43 | | - await notifyChannels(user, channels); |
44 | | - } |
45 | | - } |
46 | | -}; |
| 33 | +// if (channels.length) { |
| 34 | +// await prisma.memberships.createMany({ |
| 35 | +// data: channels.map((c) => { |
| 36 | +// return { |
| 37 | +// usersId: user.id, |
| 38 | +// channelsId: c.id, |
| 39 | +// }; |
| 40 | +// }), |
| 41 | +// skipDuplicates: true, |
| 42 | +// }); |
| 43 | +// await notifyChannels(user, channels); |
| 44 | +// } |
| 45 | +// } |
| 46 | +// }; |
0 commit comments