()
| 95 | } |
| 96 | |
| 97 | static async mark() { |
| 98 | const threads = await prisma.threads.findMany({ |
| 99 | select: { id: true }, |
| 100 | where: { |
| 101 | OR: [ |
| 102 | { |
| 103 | channelId: config.linen.feedChannelId, |
| 104 | }, |
| 105 | { |
| 106 | messageCount: { |
| 107 | gte: 3, |
| 108 | }, |
| 109 | // messages: { |
| 110 | // none: { |
| 111 | // author: { |
| 112 | // isBot: true, |
| 113 | // }, |
| 114 | // }, |
| 115 | // }, |
| 116 | }, |
| 117 | ], |
| 118 | channel: { |
| 119 | type: 'PUBLIC', |
| 120 | account: { |
| 121 | anonymizeUsers: false, |
| 122 | type: 'PUBLIC', |
| 123 | }, |
| 124 | archived: false, |
| 125 | hidden: false, |
| 126 | }, |
| 127 | lastReplyAt: { gt: daysAgo(1).getTime() }, |
| 128 | hidden: false, |
| 129 | }, |
| 130 | }); |
| 131 | await prisma.$transaction(async (tx) => { |
| 132 | await tx.threads.updateMany({ |
| 133 | where: { |
| 134 | feed: true, |
| 135 | id: { notIn: threads.map((t) => t.id) }, |
| 136 | }, |
| 137 | data: { |
| 138 | feed: false, |
| 139 | }, |
| 140 | }); |
| 141 | await tx.threads.updateMany({ |
| 142 | where: { |
| 143 | id: { in: threads.map((t) => t.id) }, |
| 144 | }, |
| 145 | data: { |
| 146 | feed: true, |
| 147 | }, |
| 148 | }); |
| 149 | }); |
| 150 | } |
| 151 | } |
no test coverage detected