MCPcopy Index your code
hub / github.com/AnswerOverflow/AnswerOverflow / updateManyChannels

Function updateManyChannels

packages/core/src/channel.ts:269–286  ·  view source on GitHub ↗
(
	data: z.infer<typeof zChannelUpdateMany>[],
)

Source from the content-addressed store, hash-verified

267}
268
269export async function updateManyChannels(
270 data: z.infer<typeof zChannelUpdateMany>[],
271) {
272 const dataReturned: Channel[] = [];
273 for await (const channel of data) {
274 await db
275 .update(dbChannels)
276 .set(channelInsertSchema.parse(channel))
277 .where(eq(dbChannels.id, channel.id));
278
279 const updated = await db.query.dbChannels.findFirst({
280 where: eq(dbChannels.id, channel.id),
281 });
282 if (!updated) throw new Error('Error updating channel');
283 dataReturned.push(updated);
284 }
285 return dataReturned;
286}
287
288export async function deleteChannel(id: string) {
289 await deleteManyMessagesByChannelId(id);

Callers 2

channel.test.tsFile · 0.90
upsertManyChannelsFunction · 0.85

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected