mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 10:06:17 +08:00
feat: shared link list (#14200)
#### PR Dependency Tree * **PR #14200** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Added a "Shared Links" panel to workspace management, enabling admins to view all published documents within a workspace * Added publication date tracking for published documents, now displayed alongside shared links * **Chores** * Removed deprecated `publicPages` field; use `publicDocs` instead <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -79,6 +79,18 @@ class AdminWorkspaceMember {
|
||||
status!: WorkspaceMemberStatus;
|
||||
}
|
||||
|
||||
@ObjectType()
|
||||
class AdminWorkspaceSharedLink {
|
||||
@Field()
|
||||
docId!: string;
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
title?: string | null;
|
||||
|
||||
@Field(() => Date, { nullable: true })
|
||||
publishedAt?: Date | null;
|
||||
}
|
||||
|
||||
@ObjectType()
|
||||
export class AdminWorkspace {
|
||||
@Field()
|
||||
@@ -128,6 +140,9 @@ export class AdminWorkspace {
|
||||
|
||||
@Field(() => SafeIntResolver)
|
||||
blobSize!: number;
|
||||
|
||||
@Field(() => [AdminWorkspaceSharedLink])
|
||||
sharedLinks!: AdminWorkspaceSharedLink[];
|
||||
}
|
||||
|
||||
@InputType()
|
||||
@@ -250,6 +265,18 @@ export class AdminWorkspaceResolver {
|
||||
}));
|
||||
}
|
||||
|
||||
@ResolveField(() => [AdminWorkspaceSharedLink], {
|
||||
description: 'Shared links of workspace',
|
||||
})
|
||||
async sharedLinks(@Parent() workspace: AdminWorkspace) {
|
||||
const publicDocs = await this.models.doc.findPublics(workspace.id, 'desc');
|
||||
return publicDocs.map(doc => ({
|
||||
docId: doc.docId,
|
||||
title: doc.title,
|
||||
publishedAt: doc.publishedAt ?? null,
|
||||
}));
|
||||
}
|
||||
|
||||
@Mutation(() => AdminWorkspace, {
|
||||
description: 'Update workspace flags and features for admin',
|
||||
nullable: true,
|
||||
|
||||
@@ -230,14 +230,6 @@ export class WorkspaceDocResolver {
|
||||
};
|
||||
}
|
||||
|
||||
@ResolveField(() => [DocType], {
|
||||
complexity: 2,
|
||||
deprecationReason: 'use [WorkspaceType.publicDocs] instead',
|
||||
})
|
||||
async publicPages(@Parent() workspace: WorkspaceType) {
|
||||
return this.publicDocs(workspace);
|
||||
}
|
||||
|
||||
@ResolveField(() => [DocType], {
|
||||
description: 'Get public docs of a workspace',
|
||||
complexity: 2,
|
||||
|
||||
Reference in New Issue
Block a user