revision.ts 931 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import type { Ref } from './common';
  2. import type { HasObjectId } from './has-object-id';
  3. import type { IPage } from './page';
  4. import type { IUser } from './user';
  5. export const Origin = {
  6. View: 'view',
  7. Editor: 'editor',
  8. } as const;
  9. export type Origin = (typeof Origin)[keyof typeof Origin];
  10. export const allOrigin = Object.values(Origin);
  11. export type IRevision = {
  12. pageId: Ref<IPage>;
  13. body: string;
  14. author: Ref<IUser>;
  15. format: string;
  16. hasDiffToPrev?: boolean;
  17. origin?: Origin;
  18. createdAt: Date;
  19. updatedAt: Date;
  20. };
  21. export type IRevisionHasId = IRevision & HasObjectId;
  22. export type IRevisionsForPagination = {
  23. revisions: IRevisionHasId[]; // revisions in one pagination
  24. totalCounts: number; // total counts
  25. };
  26. export type HasRevisionShortbody = {
  27. revisionShortBody?: string;
  28. };
  29. export type SWRInfinitePageRevisionsResponse = {
  30. revisions: IRevisionHasId[];
  31. totalCount: number;
  32. offset: number;
  33. };