mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-22 04:26:23 +08:00
fix(server): test & schema
This commit is contained in:
@@ -33,17 +33,20 @@ import {
|
||||
export class CalendarServerConfigResolver {
|
||||
constructor(
|
||||
private readonly providerFactory: CalendarProviderFactory,
|
||||
private readonly config: Config
|
||||
private readonly config: Config,
|
||||
private readonly calendar: CalendarService
|
||||
) {}
|
||||
|
||||
@ResolveField(() => [CalendarProviderName])
|
||||
calendarProviders() {
|
||||
return this.providerFactory.providers.filter(provider => {
|
||||
return (
|
||||
provider !== CalendarProviderName.Google ||
|
||||
this.config.calendar.google.allowNewAccounts !== false
|
||||
);
|
||||
});
|
||||
async calendarProviders(@CurrentUser() user?: CurrentUser) {
|
||||
const providers = [];
|
||||
for (const provider of this.providerFactory.providers) {
|
||||
if (!(await this.calendar.canLinkProvider(user?.id, provider))) {
|
||||
continue;
|
||||
}
|
||||
providers.push(provider);
|
||||
}
|
||||
return providers;
|
||||
}
|
||||
|
||||
@ResolveField(() => [CalendarCalDAVProviderPresetObjectType])
|
||||
|
||||
Reference in New Issue
Block a user