Aller au contenu

virtuals/sdk/modules/notificationSettings

Ce contenu n’est pas encore disponible dans votre langue.

Defined in: studiocms/packages/studiocms/src/virtuals/sdk/modules/notificationSettings.ts:32^

  • any

new SDKCore_NotificationSettings(): SDKCore_NotificationSettings;

SDKCore_NotificationSettings

Effect.Service<SDKCore_NotificationSettings>()(
'studiocms/sdk/SDKCore/modules/notificationSettings',
{
dependencies: [AstroDB.Default, SDKCore_CONFIG.Default],
effect: genLogger('studiocms/sdk/SDKCore/modules/notificationSettings/effect')(function () {
const { notificationConfig } = yield SDKCore_CONFIG;
const notificationSettings = {
site: {
/
Retrieves the site-wide notification settings.
@returns An Effect that resolves to the current notification settings.
@throws SDKCoreError when a database error occurs.
/
get: () =>
Effect.gen(function () {
const data = yield notificationConfig.get();
if (!data) return yield notificationConfig.init(NotificationSettingsDefaults);
return data;
}).pipe(
Effect.catchTags({
LibSQLClientError: (cause) =>
Effect.fail(
new SDKCoreError({
type: 'LibSQLDatabaseError',
cause: new StudioCMS_SDK_Error(
notificationSettings.site.get Error: ${cause}
),
})
),
})
),
/
Updates the site-wide notification settings.
@param settings - The new notification settings to be updated.
@returns An Effect that resolves to the updated settings.
@throws SDKCoreError when a database error occurs.
/
update: (settings: Omit<StudioCMSNotificationSettings, '_config_version'>) =>
notificationConfig.update(settings),
},
};
return notificationSettings;
}),
}
).constructor