(data: z.infer<typeof zChannelUpsertMany>)
| 321 | } |
| 322 | |
| 323 | export function upsertManyChannels(data: z.infer<typeof zChannelUpsertMany>) { |
| 324 | return upsertMany({ |
| 325 | input: data, |
| 326 | find: () => findManyChannelsById(data.map((c) => c.create.id)), |
| 327 | getInputId(input) { |
| 328 | return input.create.id; |
| 329 | }, |
| 330 | getFetchedDataId(input) { |
| 331 | return input.id; |
| 332 | }, |
| 333 | create: (toCreate) => createManyChannels(toCreate.map((c) => c.create)), |
| 334 | update: (toUpdate) => |
| 335 | updateManyChannels( |
| 336 | toUpdate |
| 337 | .filter((c) => c.update) |
| 338 | .map((c) => ({ |
| 339 | id: c.create.id, |
| 340 | ...c.update!, |
| 341 | })), |
| 342 | ), |
| 343 | }); |
| 344 | } |
| 345 | |
| 346 | export async function findChannelsBeforeId(input: { |
| 347 | serverId: string; |
no test coverage detected