revision.ts 957 B

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