page.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { Ref } from './common';
  2. import { IUser } from './user';
  3. import { IRevision } from './revision';
  4. import { ITag } from './tag';
  5. import { HasObjectId } from './has-object-id';
  6. export interface IPage {
  7. path: string,
  8. status: string,
  9. revision: Ref<IRevision>,
  10. tags: Ref<ITag>[],
  11. creator: Ref<IUser>,
  12. createdAt: Date,
  13. updatedAt: Date,
  14. seenUsers: Ref<IUser>[],
  15. parent: Ref<IPage> | null,
  16. descendantCount: number,
  17. isEmpty: boolean,
  18. grant: number,
  19. grantedUsers: Ref<IUser>[],
  20. grantedGroup: Ref<any>,
  21. lastUpdateUser: Ref<IUser>,
  22. liker: Ref<IUser>[],
  23. commentCount: number
  24. slackChannels: string,
  25. pageIdOnHackmd: string,
  26. revisionHackmdSynced: Ref<IRevision>,
  27. hasDraftOnHackmd: boolean,
  28. deleteUser: Ref<IUser>,
  29. deletedAt: Date,
  30. }
  31. export type IPageHasId = IPage & HasObjectId;
  32. export type IPageForItem = Partial<IPageHasId & {isTarget?: boolean}>;
  33. export type IPageInfo = {
  34. bookmarkCount: number,
  35. sumOfLikers: number,
  36. likerIds: string[],
  37. sumOfSeenUsers: number,
  38. seenUserIds: string[],
  39. isSeen?: boolean,
  40. isLiked?: boolean,
  41. }
  42. export type IPageWithMeta<M = Record<string, unknown>> = {
  43. pageData: IPageHasId,
  44. pageMeta?: Partial<IPageInfo> & M,
  45. };