feat(server): add settings resolver (#10797)

close CLOUD-166
This commit is contained in:
fengmk2
2025-03-18 00:41:21 +00:00
parent 5dcbae6f86
commit 3f0981a6fa
8 changed files with 231 additions and 4 deletions
@@ -2,6 +2,7 @@ export * from './blobs';
export * from './invite';
export * from './notification';
export * from './permission';
export * from './settings';
export * from './testing-app';
export * from './testing-module';
export * from './user';
@@ -0,0 +1,33 @@
import type { SettingsType, UpdateSettingsInput } from '../../core/user/types';
import type { TestingApp } from './testing-app';
export async function getSettings(app: TestingApp): Promise<SettingsType> {
const res = await app.gql(
`
query settings {
currentUser {
settings {
receiveInvitationEmail
receiveMentionEmail
}
}
}
`
);
return res.currentUser.settings;
}
export async function updateSettings(
app: TestingApp,
input: UpdateSettingsInput
): Promise<boolean> {
const res = await app.gql(
`
mutation updateSettings($input: UpdateSettingsInput!) {
updateSettings(input: $input)
}
`,
{ input }
);
return res.updateSettings;
}