bookmark-info.ts 997 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { Ref } from '@growi/core';
  2. import { IPageHasId } from '~/interfaces/page';
  3. import { IUser } from '~/interfaces/user';
  4. export type IBookmarkInfo = {
  5. sumOfBookmarks: number;
  6. isBookmarked: boolean,
  7. bookmarkedUsers: IUser[]
  8. };
  9. type 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 {
  22. _id: string
  23. name: string
  24. parent: string
  25. children: this[]
  26. bookmarks: BookmarkedPage[]
  27. }
  28. export const DRAG_ITEM_TYPE = {
  29. FOLDER: 'FOLDER',
  30. BOOKMARK: 'BOOKMARK',
  31. } as const;
  32. type BookmarkDragItem = {
  33. bookmarkFolder: BookmarkFolderItems
  34. level: number
  35. root: string
  36. }
  37. export type DragItemDataType = BookmarkDragItem & {
  38. parentFolder: BookmarkFolderItems | null
  39. } & IPageHasId
  40. export type DragItemType = typeof DRAG_ITEM_TYPE[keyof typeof DRAG_ITEM_TYPE];