| 98 | } |
| 99 | |
| 100 | export async function createRemoveCommunityJob(accountId: string) { |
| 101 | const worker = await WorkerSingleton.getInstance(); |
| 102 | const dayInMs = 24 * 60 * 60 * 1000; |
| 103 | const runAt = new Date(Date.now() + dayInMs); |
| 104 | await worker.addJob( |
| 105 | 'typesenseOnCommunityDeletion', |
| 106 | { accountId }, |
| 107 | { |
| 108 | jobKey: `typesenseOnCommunityDeletion:${accountId}`, |
| 109 | runAt, |
| 110 | } |
| 111 | ); |
| 112 | return await worker.addJob( |
| 113 | 'remove-community', |
| 114 | { accountId }, |
| 115 | { |
| 116 | jobKey: `remove-community:${accountId}`, |
| 117 | runAt, |
| 118 | } |
| 119 | ); |
| 120 | } |
| 121 | |
| 122 | export async function createTypesenseDeletion(payload: { |
| 123 | accountId: string; |