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

Function updateChannel

packages/core/src/channel.ts:242–267  ·  view source on GitHub ↗
({
	update,
	old,
}: {
	update: z.infer<typeof zChannelUpdate>;
	old: ChannelWithFlags | null;
})

Source from the content-addressed store, hash-verified

240}
241
242export async function updateChannel({
243 update,
244 old,
245}: {
246 update: z.infer<typeof zChannelUpdate>;
247 old: ChannelWithFlags | null;
248}) {
249 if (!old) old = await findChannelById(update.id);
250 if (!old) throw new Error('Channel not found');
251 const combinedData = applyChannelSettingsChangesSideEffects({
252 old,
253 updated: update,
254 });
255 await db
256 .update(dbChannels)
257 .set(channelInsertSchema.parse(combinedData))
258 .where(eq(dbChannels.id, update.id));
259
260 const updated = await db.query.dbChannels.findFirst({
261 where: eq(dbChannels.id, update.id),
262 });
263
264 if (!updated) throw new Error('Error updating channel');
265
266 return addFlagsToChannel(updated);
267}
268
269export async function updateManyChannels(
270 data: z.infer<typeof zChannelUpdateMany>[],

Callers 8

channel.test.tsFile · 0.90
applyLastIndexedFunction · 0.90
channel.tsFile · 0.90
indexRootChannelFunction · 0.90
runMethod · 0.90
runMethod · 0.90
runMethod · 0.90
upsertChannelFunction · 0.85

Calls 4

addFlagsToChannelFunction · 0.90
findChannelByIdFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected