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

Function createServer

packages/core/src/server.ts:51–68  ·  view source on GitHub ↗
(
	input: z.infer<typeof zServerCreate> & {
		id: string;
		name: string;
	},
)

Source from the content-addressed store, hash-verified

49}
50
51export async function createServer(
52 input: z.infer<typeof zServerCreate> & {
53 id: string;
54 name: string;
55 },
56) {
57 // Explicitly type this to avoid passing into .parse missing information
58 const combinedCreateData = await applyServerSettingsSideEffects({
59 old: getDefaultServerWithFlags(input),
60 updated: input,
61 });
62 await db.insert(dbServers).values(zServerCreate.parse(combinedCreateData));
63 const created = await db.query.dbServers.findFirst({
64 where: eq(dbServers.id, input.id),
65 });
66 if (!created) throw new Error(`Error creating server with id ${input.id}`);
67 return addFlagsToServer(created);
68}
69
70export async function findAllServers(opts?: {
71 includeKicked: boolean;

Callers 7

message.test.tsFile · 0.90
channel.test.tsFile · 0.90
server.test.tsFile · 0.90
default.test.tsFile · 0.90
upsertServerFunction · 0.85

Calls 4

addFlagsToServerFunction · 0.90
parseMethod · 0.45

Tested by

no test coverage detected