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

Function applyServerSettingsSideEffects

packages/core/src/server.ts:22–41  ·  view source on GitHub ↗
({ old, updated }: { old: F; updated: T })

Source from the content-addressed store, hash-verified

20} from './zod';
21
22export async function applyServerSettingsSideEffects<
23 F extends { bitfield: number },
24 T extends z.infer<typeof zServerMutable>,
25>({ old, updated }: { old: F; updated: T }) {
26 const { flags, ...updateDataWithoutFlags } = updated;
27 if (updateDataWithoutFlags.vanityUrl) {
28 const doesAliasExistAlready = await findServerByAliasOrId(
29 updateDataWithoutFlags.vanityUrl,
30 );
31 if (doesAliasExistAlready) {
32 throw new Error(
33 `Server with alias ${updateDataWithoutFlags.vanityUrl} already exists`,
34 );
35 }
36 }
37 return {
38 ...updateDataWithoutFlags,
39 bitfield: flags ? mergeServerFlags(old.bitfield, flags) : undefined,
40 };
41}
42
43export async function findServerByCustomDomain(domain: string) {
44 const found = await db.query.dbServers.findFirst({

Callers 2

createServerFunction · 0.85
updateServerFunction · 0.85

Calls 2

mergeServerFlagsFunction · 0.90
findServerByAliasOrIdFunction · 0.85

Tested by

no test coverage detected