2
0

bookmark-info.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { Ref } from '@growi/core';
  2. import { IPageHasId } from '~/interfaces/page';
  3. import { IUser } from '~/interfaces/user';
  4. export interface IBookmarkInfo {
  5. sumOfBookmarks: number;
  6. isBookmarked: boolean,
  7. bookmarkedUsers: IUser[]
  8. }
  9. export interface BookmarkedPage {
  10. _id: string,
  11. page: IPageHasId,
  12. user: Ref<IUser>,
  13. createdAt: Date,
  14. }
  15. export type MyBookmarkList = BookmarkedPage[]
  16. export interface IBookmarkFolder {
  17. name: string
  18. owner: Ref<IUser>
  19. parent?: Ref<this>
  20. }
  21. export interface BookmarkFolderItems extends IBookmarkFolder {
  22. _id: string;
  23. children: BookmarkFolderItems[];
  24. bookmarks: BookmarkedPage[];
  25. }
  26. export const DRAG_ITEM_TYPE = {
  27. FOLDER: 'FOLDER',
  28. BOOKMARK: 'BOOKMARK',
  29. } as const;
  30. interface BookmarkDragItem {
  31. bookmarkFolder: BookmarkFolderItems
  32. level: number
  33. root: string
  34. }
  35. export interface DragItemDataType extends BookmarkDragItem, IPageHasId {
  36. parentFolder: BookmarkFolderItems | null
  37. }
  38. export type DragItemType = typeof DRAG_ITEM_TYPE[keyof typeof DRAG_ITEM_TYPE];